Score threshold search returns only results that meet a minimum similarity score. This ensures that all returned documents have a meaningful semantic relationship to your query. Use score thresholds when result quality matters more than result count. Without a threshold, search always returns up toDocumentation Index
Fetch the complete documentation index at: https://docs.vectoraidb.actian.com/llms.txt
Use this file to discover all available pages before exploring further.
limit results regardless of how relevant they are. A threshold discards low-confidence matches early, reducing noise in downstream processing.
Before running this example, make sure you have a VectorAI DB instance running at localhost:6574 and the relevant SDK installed. For setup instructions, see Docker installation.
score_threshold in Python, scoreThreshold in JavaScript) filters out any result with a cosine similarity score below 0.5. The number of returned results may be less than limit if fewer documents meet the threshold.
Each result includes these fields:
id: The unique identifier of the matching documentscore: Similarity score guaranteed to be at or above the thresholdpayload: Metadata object containing the document text and attributes
Choosing a threshold
The optimal threshold depends on your embedding model and data:- Higher thresholds (for example, 0.7 or above) return fewer, more precise results. Use this when false positives are costly.
- Lower thresholds (for example, 0.3 to 0.5) return more results with broader recall. Use this when coverage matters more than precision.
- No threshold returns exactly
limitresults regardless of quality. Use this when you always need a fixed number of results.