similarity_search.query
Performs a semantic search across one or more namespaces.Parameters
List[str]
required
A list of one or more namespace names to search within.
Union[str, List[float]]
required
The search query (text or a vector).
int
default:"10"
Number of top relevant chunks for your query across given namespaces. Default is 10.
Optional[float]
Minimum relevance score threshold (0-1) to filter out chunks below this relevance level. Required when kiosk_mode is true.
bool
default:"False"
Enable kiosk mode to filter chunks below certain relevance. When kiosk mode is on, threshold is required.
Dict[str, Any] - A dictionary containing the search results under the results key.
Raises: NamespaceNotFound, InvalidInputError.
Basic Example
Search Example
Advanced Examples
Multi-Namespace Search
Vector Search
Complete Example
Complete Search Workflow
Search Result Structure
Search results contain the following fields:Search Result Format
ITS Scoring System
Results are scored using Information Theoretic Similarity (ITS), providing nuanced relevance measurements:Best Practices
- Use specific, clear queries for better results
- Set appropriate thresholds to filter low-quality results
- Use multiple namespaces for comprehensive searches
- Consider kiosk_mode for production applications
- Use appropriate
top_kvalues - higher values provide more context but may increase response time
Error Handling
Robust Search with Error Handling
Use Cases
- Document Retrieval: Find relevant documents across knowledge bases
- Content Discovery: Explore related content with semantic understanding
- Customer Support: Find relevant answers from support documentation
- Research & Analysis: Search through research papers and technical documents
- E-commerce: Product similarity and recommendation engines
Related Operations
- Upload Text Data - Add searchable text documents
- Upload Vector Data - Add searchable vector embeddings
- Generate AI Answer - Get AI-generated answers from search results