Skip to main content
POST
/
api
/
v1
/
llm
/
vector_stores
/
{vector_store_id}
/
search
Typescript (SDK)
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.vectorStores.search({
    vectorStoreId: "vs_abc123",
    searchVectorStoreRequest: {
      query: "How do I reset my password?",
      maxNumResults: 5,
    },
  });

  console.log(result);
}

run();
{
  "object": "vector_store.search_results.page",
  "search_query": "How do I reset my password?",
  "data": [
    {
      "file_id": "file-abc123",
      "filename": "user-guide.pdf",
      "score": 0.92,
      "content": [
        {
          "type": "text",
          "text": "To reset your password, navigate to Settings > Security > Reset Password..."
        }
      ]
    }
  ],
  "has_more": false,
  "next_page": null
}

Authorizations

Authorization
string
header
required

Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.

Headers

X-On-Behalf-Of
string

Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.

Path Parameters

vector_store_id
string
required

The ID of the vector store to search.

Body

application/json

Request body for searching a vector store.

query
required

A query string for a search, or an array of query strings.

filters
object

A filter to apply based on file attributes.

max_num_results
integer
default:10

The maximum number of results to return. This number should be between 1 and 50 inclusive.

Required range: 1 <= x <= 50
ranking_options
object

Ranking options for search.

rewrite_query
boolean
default:false

Whether to rewrite the natural language query for vector search.

Response

200 - application/json

OK

A page of search results from the vector store.

object
any
required

The object type, which is always 'vector_store.search_results.page'.

search_query
string
required

The query that was used for the search.

data
object[]
required

Array of search results.

has_more
boolean
required

Whether there are more results available.

next_page
string | null
required

Cursor for the next page of results, or null if no more results.