### Install Dependencies and Run Chatbot (npm) Source: https://docs.vectorize.io/learn/learning-paths/build-your-first-pipeline Installs the necessary project dependencies and starts the development server for the chatbot. This allows you to interact with your chatbot locally. ```bash npm install npm run dev ``` -------------------------------- ### Start Groq Desktop Application (Bash) Source: https://docs.vectorize.io/build-deploy/agents/mcp/integrations/groq-desktop This command starts the Groq Desktop application after its dependencies have been installed. The application will automatically create necessary configuration files on its first launch. ```bash npm start ``` -------------------------------- ### Get Pipeline Metrics - Python Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This Python script utilizes the `requests` library to retrieve pipeline metrics. It constructs the API URL and sends a GET request with the required Authorization and Accept headers. The JSON response is then printed to the console. Make sure to install the `requests` library (`pip install requests`). ```python import requests def get_pipeline_metrics(organization_id, pipeline_id, token): url = f"https://api.vectorize.io/v1/org/{organization_id}/pipelines/{pipeline_id}/metrics" headers = { "Authorization": f"Bearer {token}", "Accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Request failed with status code: {response.status_code}") # Example usage: # get_pipeline_metrics('your_org_id', 'your_pipeline_id', 'your_token') ``` -------------------------------- ### Setting up Vectorize Test Environment (Bash) Source: https://docs.vectorize.io/developer-resources/multi-user-connectors/vectorize-managed-oauth This example provides bash commands to clone the Vectorize test SDK repository, install dependencies, set up necessary environment variables (.env.local), and run the development server for testing purposes. ```bash git clone https://github.com/vectorize-io/test-vectorize-connect-sdk.git cd test-vectorize-connect-sdk npm install # Set up environment variables echo "VECTORIZE_API_KEY=your_token" >> .env.local echo "VECTORIZE_ORGANIZATION_ID=your_org_id" >> .env.local npm run dev ``` -------------------------------- ### Get Pipeline Metrics - PHP Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This PHP script demonstrates how to fetch pipeline metrics using cURL. It sets the request URL, includes the necessary Authorization and Accept headers, and executes the cURL request. The response is then printed to the output. Ensure the cURL extension is enabled in your PHP installation. ```php ``` -------------------------------- ### Get Destination Connector - Success Response Example Source: https://docs.vectorize.io/api/Connectors/Destination%20Connectors/get-destination-connector An example of a successful response payload when fetching a destination connector. This demonstrates the expected values for each field. ```json { "id": "b843c74d-ef33-4138-82aa-6550622b3293", "type": "example-type", "name": "My DestinationConnector", "configDoc": {}, "createdAt": "example-createdAt", "createdById": "b843c74d-ef33-4138-82aa-6550622b3293", "lastUpdatedById": "b843c74d-ef33-4138-82aa-6550622b3293", "createdByEmail": "user@example.com", "lastUpdatedByEmail": "user@example.com", "errorMessage": "Operation completed successfully", "verificationStatus": "verified" } ``` -------------------------------- ### Intercom Source Connector Setup Source: https://docs.vectorize.io/learn/quickstarts/intercom-quickstart Steps to create and configure an Intercom source connector within the Vectorize platform, including authentication and optional filtering. ```APIDOC ## Intercom Source Connector Setup ### Description This section outlines the process of creating a new Intercom source connector in Vectorize. It involves selecting Intercom as the source, authorizing the connection via OAuth, and optionally configuring filters for data ingestion. ### Method N/A (UI-driven process) ### Endpoint N/A (UI-driven process) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) Connector successfully created and authorized. #### Response Example N/A ### Optional Filters - **Date range**: Filter conversations by a specific time period. - **Conversation state**: Filter by 'open', 'closed', or 'snoozed' states. - **Tags or assignees**: Filter conversations based on assigned tags or team members. ``` -------------------------------- ### Get Pipeline Metrics - Curl Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This example shows how to fetch pipeline metrics using curl. It specifies the GET request to the API endpoint and includes the necessary Authorization header with a Bearer token. Ensure you replace `` with your actual API token. ```shell curl -X GET "https://api.vectorize.io/v1/org/:organizationId/pipelines/:pipelineId/metrics" \ -H "Authorization: Bearer " \ -H "Accept: application/json" ``` -------------------------------- ### Example System Prompt for Chat Widget Source: https://docs.vectorize.io/build-deploy/agents/chat/chat-widget-setup This example demonstrates how to define the behavior and tone of the AI assistant for a chat widget. It includes placeholders for website name and support URL, and advises on conciseness and fallback responses. ```text You are a helpful assistant embedded on [website name]. Answer questions about our product and documentation. Keep responses short. If unsure, suggest contacting support at [URL]. ``` -------------------------------- ### Get Workspace by ID (JSON Example) Source: https://docs.vectorize.io/api/Workspaces/get-workspace-by-id An example JSON object representing a successful response for fetching workspace details. This illustrates the expected format and sample values for the workspace's properties. ```json { "id": "b843c74d-ef33-4138-82aa-6550622b3293", "name": "My GetWorkspaceByIdResponse", "createdAt": "example-createdAt", "updatedAt": "example-updatedAt" } ``` -------------------------------- ### Get AI Platform Connector Example Response - JSON Source: https://docs.vectorize.io/api/Connectors/AI%20Platform%20Connectors/get-ai-platform-connector An example of a successful JSON response when fetching an AI platform connector. This illustrates the structure and typical values returned by the API. ```json { "id": "b843c74d-ef33-4138-82aa-6550622b3293", "type": "example-type", "name": "My AIPlatformConnector", "configDoc": {}, "createdAt": "example-createdAt", "createdById": "b843c74d-ef33-4138-82aa-6550622b3293", "lastUpdatedById": "b843c74d-ef33-4138-82aa-6550622b3293", "createdByEmail": "user@example.com", "lastUpdatedByEmail": "user@example.com", "errorMessage": "Operation completed successfully", "verificationStatus": "verified" } ``` -------------------------------- ### Clone Groq Desktop Repository and Install Dependencies (Bash) Source: https://docs.vectorize.io/build-deploy/agents/mcp/integrations/groq-desktop This snippet demonstrates how to clone the Groq Desktop beta repository using Git and install its Node.js dependencies using npm. Ensure Git and Node.js are installed on your system before executing these commands. ```bash git clone https://github.com/groq/groq-desktop-beta.git cd groq-desktop-beta npm install ``` -------------------------------- ### Start Deep Research API Request Body Example (JSON) Source: https://docs.vectorize.io/api/Pipelines/start-deep-research Example JSON payload for initiating a deep research task. This structure includes the query, optional webSearch and schema parameters, and n8n configuration. ```json { "query": "string", "webSearch": false, "schema": "string", "n8n": { "account": "string", "webhookPath": "string", "headers": {} } } ``` -------------------------------- ### Configure Environment Variables (.env.development) Source: https://docs.vectorize.io/learn/learning-paths/build-your-first-pipeline Sets up essential API keys and tokens for the chatbot application. Ensure you replace placeholder values with your actual credentials. ```env OPENAI_API_KEY=sk-... VECTORIZE_TOKEN=your-vectorize-token ``` -------------------------------- ### Deploy RAG Pipeline Source: https://docs.vectorize.io/learn/quickstarts/intercom-quickstart Instructions for deploying the configured Retrieval-Augmented Generation (RAG) pipeline. ```APIDOC ## Deploy RAG Pipeline ### Description This step involves reviewing the complete pipeline configuration and deploying it to start processing data. ### Method N/A (UI-driven process) ### Endpoint N/A (UI-driven process) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) Pipeline deployed and processing initiated. #### Response Example N/A ### Review Checklist: - Source: Your Intercom connector - AI Platform: Vectorize (Built-in) - Destination: Vectorize (Built-in) Vector Database Click **Deploy RAG Pipeline** to finalize. ``` -------------------------------- ### Get Pipeline Metrics - Ruby Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This Ruby example uses the `net/http` library to fetch pipeline metrics. It constructs the request, sets the necessary headers including Authorization, and sends the GET request. The response body is then printed. For more complex scenarios, consider using gems like `httparty` or `faraday`. ```ruby require 'net/http' require 'uri' def get_pipeline_metrics(organization_id, pipeline_id, token) uri = URI.parse("https://api.vectorize.io/v1/org/#{organization_id}/pipelines/#{pipeline_id}/metrics") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) request['Authorization'] = "Bearer #{token}" request['Accept'] = "application/json" response = http.request(request) puts response.body end # Example usage: # get_pipeline_metrics('your_org_id', 'your_pipeline_id', 'your_token') ``` -------------------------------- ### Get Pipeline Metrics - Kotlin Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics A Kotlin code snippet demonstrating how to fetch pipeline metrics using Ktor's `HttpClient`. This example sets up the client, creates an HTTP GET request with the correct URL and headers (Authorization and Accept), and prints the response body. Ensure you have the Ktor client dependency added. ```kotlin import io.ktor.client.* import io.ktor.client.request.* import io.ktor.client.statement.* suspend fun getPipelineMetrics(organizationId: String, pipelineId: String, token: String) { val client = HttpClient() val response: HttpResponse = client.get("https://api.vectorize.io/v1/org/$organizationId/pipelines/$pipelineId/metrics") { headers { append("Authorization", "Bearer $token") append("Accept", "application/json") } } println(response.bodyAsText()) client.close() } ``` -------------------------------- ### Python RAG Pipeline Example Source: https://docs.vectorize.io/learn/learning-paths/build-your-first-pipeline This Python script demonstrates the complete process of building a RAG pipeline using the Vectorize.io client library. It covers creating file upload and AI platform connectors, uploading a document, configuring and waiting for the pipeline to process, and finally querying the pipeline. Ensure you have the 'vectorize_client' library installed and the necessary environment variables set. ```python #!/usr/bin/env python3 """ Complete example for building your first RAG pipeline with Vectorize. This is a hand-written example that corresponds to the test file: api-clients/python/tests/developer_journeys/build_your_first_pipeline.py IMPORTANT: Keep this file in sync with the test file's snippets! This example shows how to: 1. Create a file upload connector 2. Upload a document 3. Create and configure a RAG pipeline 4. Wait for processing to complete 5. Query your pipeline for answers """ import os import sys import time import urllib3 import vectorize_client as v def get_api_config(): """Get API configuration from environment variables.""" organization_id = os.environ.get("VECTORIZE_ORGANIZATION_ID") api_key = os.environ.get("VECTORIZE_API_KEY") if not organization_id or not api_key: print("\ud83d\udc49 Setup required:") print("1. Get your API key from: https://app.vectorize.io/settings") print("2. Set environment variables:") print(" export VECTORIZE_ORGANIZATION_ID='your-org-id'") print(" export VECTORIZE_API_KEY='your-api-key'") sys.exit(1) # Always use production API configuration = v.Configuration( host="https://api.vectorize.io/v1", access_token=api_key ) return configuration, organization_id def create_file_upload_connector(api_client, organization_id): """Create a file upload connector for ingesting documents.""" print("\ud83d\udcc1 Step 1: Create a File Upload Connector") # Create the connectors API client connectors_api = v.SourceConnectorsApi(api_client) try: # Create a file upload connector file_upload = v.FileUpload( name="my-document-upload", type="FILE_UPLOAD", config={} ) request = v.CreateSourceConnectorRequest(file_upload) response = connectors_api.create_source_connector( organization_id, request ) connector_id = response.connector.id print(f"\u2705 Created file upload connector: {connector_id}") return connector_id except Exception as e: print(f"\u274c Error creating connector: {e}") raise def create_ai_platform_connector(api_client, organization_id): """Create an AI platform connector.""" connectors_api = v.AIPlatformConnectorsApi(api_client) try: # Create the AI platform connector request = v.CreateAIPlatformConnectorRequest( name="pipeline-example-ai", type="VECTORIZE", config={} ) response = connectors_api.create_ai_platform_connector( organization_id, request ) print(f"\u2705 Created AI platform connector: {response.connector.name}") print(f" Connector ID: {response.connector.id}\n") return response.connector.id except Exception as e: print(f"\u274c Error creating AI platform connector: {e}") raise def create_destination_connector(api_client, organization_id): """Create a destination connector.""" connectors_api = v.DestinationConnectorsApi(api_client) try: # Create the destination connector connector_config = v.DestinationConnectorInput( name="pipeline-example-dest", type="VECTORIZE", config={} ) request = v.CreateDestinationConnectorRequest(connector_config) response = connectors_api.create_destination_connector( organization_id, request ) print(f"\u2705 Created destination connector: {response.connector.name}") print(f" Connector ID: {response.connector.id}\n") return response.connector.id except Exception as e: print(f"\u274c Error creating destination connector: {e}") raise def upload_document(api_client, organization_id, source_connector_id): """Upload your first document to the connector.""" print("\ud83d\udcc4 Step 2: Upload Your First Document") # Create uploads API client uploads_api = v.UploadsApi(api_client) # Define the file to upload file_path = "/tmp/intro_to_rag.txt" file_name = os.path.basename(file_path) # Create a sample file with RAG introduction content ``` -------------------------------- ### Get Pipeline Metrics - JavaScript Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This JavaScript example uses the `fetch` API to retrieve pipeline metrics. It constructs the request with the appropriate URL and headers, including the Authorization header for authentication. The response is then parsed as JSON and logged to the console. ```javascript async function getPipelineMetrics(organizationId, pipelineId, token) { const url = `https://api.vectorize.io/v1/org/${organizationId}/pipelines/${pipelineId}/metrics`; const response = await fetch(url, { method: 'GET', headers: { 'Authorization': `Bearer ${token}`, 'Accept': 'application/json', }, }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } ``` -------------------------------- ### Running the Main Example Function (JavaScript) Source: https://docs.vectorize.io/learn/learning-paths/make-ai-smarter-with-metadata This snippet demonstrates how to execute the main asynchronous function of the example. It uses a common Node.js pattern to run the `main` function and catch any top-level errors, exiting the process if an error occurs. ```javascript // Run the example if (require.main === module) { main().catch(error => { console.error('❌ Error:', error); process.exit(1); }); } module.exports = { main }; ``` -------------------------------- ### Install Vectorize SDK Source: https://docs.vectorize.io/developer-resources/multi-user-connectors/vectorize-managed-oauth Installs the Vectorize Connect SDK using npm. This is the first step to integrating Vectorize-Managed OAuth into your application. ```bash npm install @vectorize-io/vectorize-connect ``` -------------------------------- ### Get Pipeline Metrics - Node.js Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics This Node.js example uses the built-in `https` module to make a GET request to the Vectorize.io API for pipeline metrics. It constructs the request options, including headers for authorization and content type, and handles the response data stream. For a more streamlined approach, consider using libraries like `axios` or `node-fetch`. ```nodejs const https = require('https'); function getPipelineMetrics(organizationId, pipelineId, token) { const options = { hostname: 'api.vectorize.io', port: 443, path: `/v1/org/${organizationId}/pipelines/${pipelineId}/metrics`, method: 'GET', headers: { 'Authorization': `Bearer ${token}`, 'Accept': 'application/json', } }; const req = https.request(options, (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { console.log(JSON.parse(data)); }); }); req.on('error', (error) => { console.error(error); }); req.end(); } ``` -------------------------------- ### Get Pipeline Metrics - C# Example Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-metrics Example of how to retrieve pipeline metrics using C# with HttpClient. This code snippet demonstrates setting up the request, adding necessary headers (Accept and Authorization), sending the request, and handling the response. It requires the System.Net.Http namespace. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.vectorize.io/v1/org/:organizationId/pipelines/:pipelineId/metrics"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Bearer Token Authorization Example (C#) Source: https://docs.vectorize.io/api/Connectors/Destination%20Connectors/create-destination-connector Demonstrates how to make a POST request to the Vectorize.io API using C# with Bearer token authentication. This example shows setting up HttpClient, constructing the request with necessary headers, and handling the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://docs.vectorize.io/org/:organizationId/connectors/destinations"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent(string.Empty); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### User Added to Source Connector (JSON Response Example) Source: https://docs.vectorize.io/api/Connectors/Source%20Connectors/add-user-to-source-connector An example of a successful JSON response when a user is added to a source connector. This confirms the operation completed successfully. ```json { "message": "Operation completed successfully" } ``` -------------------------------- ### Get Pipeline Events API Request (Python) Source: https://docs.vectorize.io/api/Pipelines/get-pipeline-events This Python code snippet uses the `requests` library to fetch pipeline events. It constructs the request with the appropriate URL and headers, including the Authorization token. Make sure to install the `requests` library (`pip install requests`). ```python import requests def get_pipeline_events(organization_id, pipeline_id, token): url = f"https://api.vectorize.io/v1/org/{organization_id}/pipelines/{pipeline_id}/events" headers = { "Accept": "application/json", "Authorization": f"Bearer {token}" } response = requests.get(url, headers=headers) if response.status_code == 200: return response.json() else: response.raise_for_status() # Raise an exception for bad status codes # Example usage: # try: # events = get_pipeline_events('your_org_id', 'your_pipeline_id', 'your_token') # print(events) # except requests.exceptions.RequestException as e: # print(f"Error: {e}") ``` -------------------------------- ### Get AI Platform Connectors (Swift) Source: https://docs.vectorize.io/api/Connectors/AI%20Platform%20Connectors/get-ai-platform-connectors This Swift code example shows how to use URLSession to make a GET request for AI Platform connectors. It configures the request with the correct URL and headers. ```swift import Foundation func getAiPlatformConnectors(organizationId: String, token: String) { guard let url = URL(string: "https://api.vectorize.io/v1/org/(organizationId)/connectors/aiplatforms") else { return } var request = URLRequest(url: url) request.httpMethod = "GET" request.setValue("application/json", forHTTPHeaderField: "Accept") request.setValue("Bearer (token)", forHTTPHeaderField: "Authorization") let task = URLSession.shared.dataTask(with: request) { data, response, error in if let error = error { print(error); return } guard let data = data else { return } if let responseString = String(data: data, encoding: .utf8) { print(responseString) } } task.resume() } ``` -------------------------------- ### Add User to Source Connector (C# HttpClient) Source: https://docs.vectorize.io/api/Connectors/Source%20Connectors/add-user-to-source-connector Demonstrates how to add a user to a source connector using C# with HttpClient. It includes setting up the request, headers, and content, and handling the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://api.vectorize.io/v1/org/:organizationId/connectors/sources/:sourceConnectorId/users"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent("{\n \"userId\": \"user_123456\",\n \"selectedFiles\": {}, \"refreshToken\": \"sl.example_refresh_token_string\", \"accessToken\": \"secret_example_access_token_string\" }", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Workspace by ID (HTTP) Source: https://docs.vectorize.io/api/Workspaces/get-workspace-by-id Example HTTP request for fetching workspace details from the Vectorize.io API. This demonstrates the GET method, URL structure with path parameters, and required headers like Accept and Authorization. ```http GET /v1/org/:organizationId/workspaces/:workspaceId HTTP/1.1 Host: api.vectorize.io Authorization: Bearer Accept: application/json ``` -------------------------------- ### Query Intercom Knowledge Base via API Source: https://docs.vectorize.io/learn/quickstarts/intercom-quickstart Demonstrates how to programmatically query the deployed Intercom data pipeline using the Vectorize API's retrieval endpoint. ```APIDOC ## Query Intercom Knowledge Base via API ### Description This endpoint allows you to programmatically query your Intercom knowledge base after the data pipeline has been deployed and processed. It retrieves relevant information based on your query. ### Method POST ### Endpoint `/v1/rag/retrieve` ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **pipeline_id** (string) - Required - The unique identifier for your deployed RAG pipeline. - **query** (string) - Required - The natural language query to search your knowledge base. - **top_k** (integer) - Optional - The number of top results to return. Defaults to a reasonable number if not specified. ### Request Example ```json { "pipeline_id": "YOUR_PIPELINE_ID", "query": "summarize customer feedback about onboarding", "top_k": 5 } ``` ### Response #### Success Response (200) - **results** (array) - A list of retrieved documents or snippets relevant to the query. - **content** (string) - The content of the retrieved document/snippet. - **score** (float) - The relevance score of the result. - **metadata** (object) - Any associated metadata for the result. #### Response Example ```json { "results": [ { "content": "Customers have expressed concerns about the complexity of the initial onboarding process, particularly regarding feature discovery.", "score": 0.95, "metadata": {"conversation_id": "conv_123", "timestamp": "2023-10-27T10:00:00Z"} }, { "content": "We need to improve the onboarding tutorial to better guide new users through the setup.", "score": 0.92, "metadata": {"conversation_id": "conv_456", "timestamp": "2023-10-26T15:30:00Z"} } ] } ``` ``` -------------------------------- ### Use Case: Customer Knowledge Base Source: https://docs.vectorize.io/build-deploy/connect-your-data/source-connectors/plain Example configuration for building a customer knowledge base using the Plain Source Connector. ```APIDOC ## Use Case: Customer Knowledge Base ### Description Configure the Plain Source Connector to build a searchable knowledge base from resolved customer support conversations. ### Configuration Steps 1. **Include Threads**: Enable to capture resolved conversations. 2. **Filter by Status**: Include only "Done" threads (resolved conversations). 3. **Lookup Customer Details**: Disable to focus on conversation content rather than customer profiles. 4. **Date Ranges**: Set to include historical conversations that contain valuable support patterns. ``` -------------------------------- ### Get AI Platform Connectors (Curl) Source: https://docs.vectorize.io/api/Connectors/AI%20Platform%20Connectors/get-ai-platform-connectors This example shows how to retrieve AI Platform connectors using curl. It specifies the GET request, the API endpoint, and includes headers for content acceptance and authorization. ```shell curl -X GET "https://api.vectorize.io/v1/org/:organizationId/connectors/aiplatforms" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ```