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"
The maximum number of results to return. Defaults to 10.
Optional[float]
A minimum similarity score (0-1) for results. Defaults to None.
bool
default:"False"
A flag for stricter filtering. Defaults to False.
Dict[str, Any] - A dictionary containing the search results under the results key.
Raises: NamespaceNotFound, InvalidInputError.
Text search across one namespace
Search Example
Advanced Search Examples
Search across multiple namespacesMulti-Namespace Search
answer.generate
Submits a query to a text namespace to get a conversational answer generated by an LLM.Parameters
str
required
The single text namespace to search for context.
str
required
The user’s question or prompt.
int
default:"5"
Number of search results to use as context. Defaults to 5.
str
default:"deepseek.r1-v1:0"
The identifier for the LLM to use. See Generate AI Answer for the full model list.
Optional[List[Dict]]
A list of previous conversation turns to maintain context.
float
default:"0.7"
The sampling temperature for the LLM (0-1). Defaults to 0.7.
Dict[str, Any] - A dictionary containing the answer, model, and other metadata.
Raises: NamespaceNotFound, InvalidInputError.
Generate Answer Example
Advanced AI Generation
Maintain conversation contextConversational AI with History
Complete Search & AI Workflow
Complete Search and AI Workflow
Search Result Structure
Search results contain the following fields:Search Result Format
AI Response Structure
AI generation responses contain:AI Response Format
Best Practices
Search Optimization
- 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
AI Generation
- Provide clear, specific questions
- Use chat history for conversational experiences
- Adjust temperature based on creativity needs
- Choose appropriate AI models for your use case
Error Handling
Robust Search with Error Handling