Search API¶
The Search API enables vector and full-text search across the Unique AI knowledge base for Retrieval-Augmented Generation (RAG).
Overview¶
Perform semantic search with support for:
- Vector search
- Combined vector + full-text search
- Metadata filtering with UniqueQL
- Reranking
- Score thresholds
- Multi-scope search
Methods¶
unique_sdk.Search.create - Search the knowledge base
Search the knowledge base with various filtering and ranking options.
Search Types:
VECTOR- Semantic vector searchCOMBINED- Vector + full-text search for enhanced precision
Parameters:
searchString(str, required) - Query text to search forsearchType(Literal["VECTOR", "COMBINED"], required) - Search modechatId(str, optional) - Include chat documents in search scopescopeIds(List[str], optional) - List of scope IDs to search withinchatOnly(bool, optional) - Restrict search to chat documents onlylimit(int, optional) - Maximum number of results (default: 20, max: 1000)page(int, optional) - Page number for pagination (default: 1)scoreThreshold(float, optional) - Minimum similarity score (recommended: 0)language(str, optional) - Language for full-text search (e.g., "English")reranker(Dict[str, Any], optional) - Reranker configuration (e.g.,{"deploymentName": "my_deployment"})metaDataFilter(Dict[str, Any], optional) - UniqueQL metadata filtercontentIds(List[str], optional) - Filter search to specific content IDs
Returns:
Returns a list of Search objects.
Example - Basic Search:
Example - Combined Search with Filtering:
Example - Search with Metadata Filter:
Example - Chat-Only Search:
Return Types¶
Search¶
The Search object represents a single search result
Fields:
id(str) - Unique search result identifierchunkId(str) - Chunk identifier within the documenttext(str) - Chunk text contentcreatedAt(str) - Creation timestamp (ISO 8601)updatedAt(str) - Last update timestamp (ISO 8601)url(str | None) - Content URLtitle(str | None) - Document titlekey(str | None) - File key/name with page numbers (e.g., "document.pdf : 5,6,7")order(int) - Chunk order in documentstartPage(int) - Starting page numberendPage(int) - Ending page numbermetadata(Dict[str, Any] | None) - Custom metadata dictionaryscore(float, optional) - Similarity score (may be present in API response)
Returned by: Search.create()
Best Practices¶
Use Combined Search for Better Results
Enhance Queries with Context
Related Resources¶
- SearchString API - Enhance queries with context
- Content API - Manage searchable content
- UniqueQL - Advanced filtering
- Token Management - Optimize token usage