Context Store API

The Context Store API allows you to manage context stores, which are used to store and retrieve SQL prompts and associated metadata. This API provides endpoints for creating, retrieving, updating, and deleting context stores.

Endpoints

1. Create a Context Store

Endpoint: /api/v1/context-stores Method: POST Request Body:

{
    "db_connection_id": "string",
    "prompt": "string",
    "sql": "string",
    "metadata": {"key": "value"}
}

Description: Creates a new context store entry with the specified database connection ID, prompt, SQL query, and optional metadata.

Response:

{
    "id": "string",
    "db_connection_id": "string",
    "prompt": "string",
    "sql": "string",
    "metadata": {"key": "value"},
    "created_at": "string"
}

2. Retrieve All Context Stores

Endpoint: /api/v1/context-stores Method: GET Description: Retrieves a list of all context stores.

Response:

3. Retrieve a Specific Context Store

Endpoint: /api/v1/context-stores/{context_store_id} Method: GET Description: Retrieves the details of a specific context store entry identified by context_store_id.

Response:

4. Retrieve Similar Context Stores

Endpoint: /api/v1/context-stores/semantic-search Method: POST Description: Retrieves the details of top k most similar context store entries excluding the exact match.

Response:

5. Update a Context Store

Endpoint: /api/v1/context-stores/{context_store_id} Method: PUT Request Body:

Description: Updates the details of an existing context store entry identified by context_store_id.

Response:

6. Delete a Context Store

Endpoint: /api/v1/context-stores/{context_store_id} Method: DELETE Description: Deletes a specific context store entry identified by context_store_id.

Response:

Example Usage

Creating a Context Store

To create a new context store, send a POST request to /api/v1/context-stores:

Request:

Response:

Retrieving All Context Stores

To retrieve a list of all context stores, send a GET request to /api/v1/context-stores:

Request:

Response:

Retrieving a Specific Context Store

To retrieve a specific context store, send a GET request to /api/v1/context-stores/{context_store_id}:

Request:

Response:

Retrieving Similar Context Stores

To retrieve a specific context store, send a POST request to /api/v1/context-stores/semantic-search:

Request:

Response:

Updating a Context Store

To update a context store, send a PUT request to /api/v1/context-stores/{context_store_id}:

Request:

Response:

Deleting a Context Store

To delete a context store, send a DELETE request to /api/v1/context-stores/{context_store_id}:

Request:

Response:

Last updated