Perform semantic searches across your vector stores to find relevant document content
POST /v1/vector_stores/{vector_store_id}/search
application/json
Path Parameters:
vector_store_id
: The ID of the vector store to search (required)query
: The search query string (required)max_num_results
: Maximum number of results to return (default: 10)filters
: Optional filters to apply based on file attributesrewrite_query
: Whether to rewrite the query for better vector search (default: false)ranking_options
: Options for ranking/scoring resultsquery
parameter is a natural language question or statement that describes the information you’re looking for. The system converts this query into a vector embedding and finds document chunks with similar embeddings.
max_num_results
parameter controls how many results are returned. The default is 10, but you can adjust this based on your needs:
filters
parameter lets you narrow search results based on file attributes. Filters follow a structured format that enables both simple and complex filtering conditions.
Operator | Description | Example |
---|---|---|
eq | Equal to | Match where language is “en” |
ne | Not equal to | Match where status is not “archived” |
gt | Greater than | Match where version > 1.0 |
gte | Greater than or equal to | Match where created_at ≥ 1672531200 |
lt | Less than | Match where priority < 3 |
lte | Less than or equal to | Match where size ≤ 1024 |
AND Filter
OR Filter
Nested Filters
ranking_options
parameter configures how results are scored and ranked:
score_threshold
: Minimum similarity score (0.0-1.0) for results to be includedHigh Threshold (0.8-0.95)
Medium Threshold (0.6-0.8)
Low Threshold (0.3-0.6)
file_id
: ID of the file containing the resultfilename
: Name of the filescore
: Similarity score (0.0-1.0)attributes
: File attributes for filteringcontent
: Array of content segmentshas_more
: Boolean indicating if there are more results availablenext_page
: Token for retrieving the next page of results (if available)file_search
tool provides an alternative way to search vector stores through the AI assistant API. This is especially useful for integrating search within conversational AI flows.
agentic_search
tool offers an AI-guided approach to search that handles complex research queries by performing multiple search iterations. Instead of a single search, it breaks down complex questions and refines queries iteratively until finding the most comprehensive results.
Be specific and clear
Use natural language
Include context
Use filters effectively
max_num_results
reasonable (5-20) for better performance