> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inquantum.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Vector DB tracing with cURL

> Log any Vector DB interactions to Planck using cURL.

export const strings = {
  additionalHeadersForSessions: "Planck provides additional headers to help you manage and analyze your sessions.",
  azureOpenAIDocs: `To learn more about the differences between OpenAI and AzureOpenAI, review the <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/overview">documentation here</a>.`,
  chainOfThoughtPromptingCookbookDescription: "Craft effective prompts, ideal for complex responses requiring multi-step problem solving.",
  chatbotCookbookDescription: "This step-by-step guide covers function calling, response formatting and monitoring with Planck.",
  createPlanckManualLogger: "Create a new PlanckManualLogger instance",
  configureWebSocketConnection: "Configure WebSocket connection",
  environmentTrackingCookbookDescription: "Effortlessly track and manage your environments with Planck across different deployment contexts.",
  exportBaseUrl: tool => `Export your ${tool} base URL`,
  getStartedWithPackage: "To get started, install the @inquantum/planck-helpers package",
  generateKey: "Create an account and generate an API key",
  generateKeyInstructions: `Log into <a href="https://www.inquantum.ai" target="_blank">Planck</a> or create an account. Once you have an account, you can generate an <a href="https://inquantum.ai/developer" target="_blank">API key here</a>.`,
  generateSessionId: "Generate the unique session ID that will be used to track the session.",
  gettingUserRequestsCookbookDescription: "Retrieve user-specific requests to monitor, debug, and track costs for individual users.",
  groupingCallsWithSessions: "Grouping Calls with Planck Sessions",
  handleWebSocketEvents: "Handle WebSocket events",
  planckLoggerAPIReference: `To learn more about the <code>PlanckManualLogger</code> API, see the <a href="/getting-started/integration-method/custom" target="_blank">API Reference here</a>.`,
  howToIntegrate: "How to Integrate",
  howToPromptThinkingModelsCookbookDescription: "Best practices to to effectively prompt thinking models like Deepseek and OpenAI o1-o3 for optimal results.",
  howToUseSessions: "To group related API calls and analyze them collectively, you can use Planck's session tracking features. This is useful for grouping all interactions within a single conversation or user session.",
  includeHeadersInRequests: "Include headers in your requests",
  includeSessionHeaders: "Include the session headers when you make API requests. This way, the session information is attached to each request, allowing Planck to group and analyze them together.",
  installRequiredDependencies: "Install required dependencies",
  installSDK: tool => `Install ${tool}`,
  logYourRequest: "Log your request",
  modifyBasePath: "Modify the base URL path and set up authentication",
  optional: "Optional",
  relatedGuides: "Related documentation",
  replayLlmSessionsCookbookDescription: "Learn how to replay and modify LLM sessions using Planck to optimize your AI agents and improve their performance.",
  sessionManagement: "Session Management",
  setApiKey: "Set up your Planck API key in your .env file",
  setUpToolBaseUrl: tool => `Set up your ${tool} base URL`,
  setUpToolApiKey: tool => `Set up your ${tool} API key as an environment variable`,
  startUsing: tool => `Start using ${tool} with Planck`,
  useTheSDK: tool => `Use the ${tool} SDK`,
  verifyInPlanck: "Verify your requests in Planck",
  verifyInPlanckDescription: tool => `With the above setup, any calls to ${tool} will automatically be logged and monitored by Planck. Review them in your <a href="https://www.inquantum.ai/dashboard" target="_blank">Planck dashboard</a>.`,
  whyUseSessions: "By including the session headers in each request, you have more granular control over session tracking. This approach is especially useful if you want to handle sessions dynamically or manage multiple sessions concurrently.",
  viewRequestsInDashboard: "View requests in the Planck dashboard",
  viewRequestsInDashboardDescription: product => `All your ${product} requests are now visible in your <a href="https://us.inquantum.ai/dashboard" target="_blank">Planck dashboard</a>`,
  modelRegistryDescription: "You can find all 100+ supported models at <a href=\"https://inquantum.ai/models\" target=\"_blank\">inquantum.ai/models</a>."
};

## Example

```bash theme={null}
curl -X POST https://api.inquantum.ai/custom/v1/log \
-H "Authorization: Bearer <YOUR_PLANCK_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
  "providerRequest": {
    "url": "custom-model-nopath",
    "json": {
      "_type": "vector_db",
      "operation": "search",
      "text": "sample query text",
      "topK": 3,
      "databaseName": "sample_vector_db"
    },
    "meta": {
      "source": "test_integration",
      "environment": "development"
    }
  },
  "providerResponse": {
    "json": {
      "_type": "vector_db",
      "results": [
        {"id": "doc1", "score": 0.92, "content": "Sample document 1"},
        {"id": "doc2", "score": 0.85, "content": "Sample document 2"},
        {"id": "doc3", "score": 0.78, "content": "Sample document 3"}
      ]
    },
    "status": 200,
    "headers": {
      "content-type": "application/json"
    }
  },
  "timing": {
    "startTime": {
      "seconds": 1625686222,
      "milliseconds": 500
    },
    "endTime": {
      "seconds": 1625686244,
      "milliseconds": 750
    }
  }
}'
```

## Request Structure

### Endpoint

```
POST https://api.inquantum.ai/custom/v1/log
```

### Headers

| Name          | Value                          |
| ------------- | ------------------------------ |
| Authorization | Bearer `<YOUR_PLANCK_API_KEY>` |

<div dangerouslySetInnerHTML={{ __html: strings.generateKeyInstructions }} />

### Body

```typescript theme={null}
export type PlanckAsyncLogRequest = {
  providerRequest: ProviderRequest;
  providerResponse: ProviderResponse;
  timing: Timing;
};

export type ProviderRequest = {
  url: "custom-model-nopath";
  json: {
    _type: "vector_db";
    operation: "search" | "insert" | "delete" | "update";
    text?: string;
    vector?: number[];
    topK?: number;
    filter?: object;
    databaseName?: string;
    [key: string]: any;
  };
  meta: Record<string, string>;
};

export type ProviderResponse = {
  json: {
    _type?: "vector_db";
    [key: string]: any;
  };
  status: number;
  headers: Record<string, string>;
};

export type Timing = {
  // From Unix epoch in Milliseconds
  startTime: {
    seconds: number;
    milliseconds: number;
  };
  endTime: {
    seconds: number;
    milliseconds: number;
  };
};
```
