Search a vector store for relevant chunks based on a query and file attributes filter.
Body
Required
-
Whether to rewrite the natural language query for vector search.
Default value is
false
. -
The maximum number of results to return. This number should be between 1 and 50 inclusive.
Minimum value is
1
, maximum value is50
. Default value is10
. -
Ranking options for search.
Additional properties are NOT allowed.
POST
/vector_stores/{vector_store_id}/search
curl \
--request POST 'https://api.openai.com/v1/vector_stores/vs_abc123/search' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"query":"string","rewrite_query":false,"max_num_results":10,"filters":{"type":"eq","key":"string","value":"string"},"ranking_options":{"ranker":"auto","score_threshold":0}}'
Request examples
{
"query": "string",
"rewrite_query": false,
"max_num_results": 10,
"filters": {
"type": "eq",
"key": "string",
"value": "string"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
Response examples (200)
{
"object": "vector_store.search_results.page",
"search_query": [
"string"
],
"data": [
{
"file_id": "string",
"filename": "string",
"score": 42.0,
"attributes": {},
"content": [
{
"type": "text",
"text": "string"
}
]
}
],
"has_more": true,
"next_page": "string"
}