Skip to main content
POST
/
api
/
v1
/
llm
/
vector_stores
/
{vector_store_id}
/
search
Python (SDK)
from mka1 import SDK


with SDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.llm.vector_stores.search(vector_store_id="vs_abc123", query="How do I reset my password?", max_num_results=5, rewrite_query=False)

    # Handle response
    print(res)
{
  "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

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

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.