Search a vector store
Search a vector store for relevant chunks based on a query and file attributes filter.
Request
POST
https://ai.api.cloud.yandex.net/v1/vector_stores/{vector_store_id}/search
Path parameters
|
Name |
Description |
|
vector_store_id |
Type: string The ID of the vector store to search. Example: `` |
Body
application/json
{
"query": "example",
"rewrite_query": false,
"max_num_results": 10,
"filters": {
"type": "eq",
"key": "example",
"value": "example"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
|
Name |
Description |
||||
|
query |
One of 2 types
A query string for a search Example: |
||||
|
filters |
One of 2 types
A filter to apply based on file attributes. Example
|
||||
|
max_num_results |
Type: integer The maximum number of results to return. This number should be between 1 and 50 inclusive. Default: Min value: Max value: |
||||
|
ranking_options |
Type: object
Ranking options for search. Example
|
||||
|
rewrite_query |
Type: boolean Whether to rewrite the natural language query for vector search. Default: |
ComparisonFilter
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
|
Name |
Description |
|
key |
Type: string The key to compare against the value. Example: |
|
type |
Type: string Specifies the comparison operator:
Default: Enum: |
|
value |
One of 4 types
The value to compare against the attribute key; supports string, number, or boolean types. Example: |
Example
{
"type": "eq",
"key": "example",
"value": "example"
}
CompoundFilter
Combine multiple filters using and or or.
|
Name |
Description |
|
filters |
Type: arrayOne of 2 types
Array of filters to combine. Items can be Example
|
|
type |
Type: string Type of operation: Enum: |
Example
{
"type": "and",
"filters": [
{
"type": "eq",
"key": "example",
"value": "example"
}
]
}
Responses
200 OK
OK
Body
application/json
{
"object": "vector_store.search_results.page",
"search_query": [
"example"
],
"data": [
{
"file_id": "example",
"filename": "example",
"score": 0,
"attributes": null,
"content": [
{
"type": "text",
"text": "example"
}
]
}
],
"has_more": true,
"next_page": "example"
}
|
Name |
Description |
|
data |
Type: VectorStoreSearchResultItem[] The list of search result items. Example
|
|
has_more |
Type: boolean Indicates if there are more results to fetch. |
|
next_page |
Any of 2 types
Example: |
|
object |
Type: string The object type, which is always Const: Example: |
|
search_query |
Type: string[] Example
|
VectorStoreFileAttributes
Any of 2 types
-
Type: object
[additional]
One of 3 types
-
Type: string
Max length:
512Example:
example -
Type: number
-
Type: boolean
Example:
exampleSet of key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Max properties:
16Example
{} -
-
Type: unknown
Example:
null
Default: null
VectorStoreSearchResultContentObject
|
Name |
Description |
|
text |
Type: string The text content returned from search. Example: |
|
type |
Type: string The type of content. Const: Example: |
Example
{
"type": "text",
"text": "example"
}
VectorStoreSearchResultItem
|
Name |
Description |
|
attributes |
Type: VectorStoreFileAttributes Default: Example
|
|
content |
Type: VectorStoreSearchResultContentObject[] Content chunks from the file. Example
|
|
file_id |
Type: string The ID of the vector store file. Example: |
|
filename |
Type: string The name of the vector store file. Example: |
|
score |
Type: number The similarity score for the result. Min value: Max value: |
Example
{
"file_id": "example",
"filename": "example",
"score": 0,
"attributes": null,
"content": [
{
"type": "text",
"text": "example"
}
]
}