Semantic search
Semantic search finds knowledge-base chunks whose meaning is closest to your query β not just keyword matches. Use search before composing a custom prompt, or rely on useKnowledgeBase: true in sendAI for automatic retrieval.
Method
search({
senderId: string,
query: string,
limit?: number,
minSimilarity?: number, // 0.0 β 1.0
filterbySource?: string, // matches metadata.source
})query
Natural-language question or keywords
limit
Max results (default server-side)
minSimilarity
Drop hits below this score
filterbySource
Filter by metadata.source from addDocument
search uses the vector store and embedding model on notifier.serverConfig. Pass vectorStore or embedding on the call to override that for one query. Keyword and hybrid search run on Postgres.
β Vector stores and embeddings
Search vs useKnowledgeBase
search then sendAI
You choose which chunks to inject
Higher β custom prompts
Tuning tips
Fewer false positives
Raise minSimilarity (e.g. 0.7)
Broader recall
Lower minSimilarity (e.g. 0.3)
Scoped search
Set filterbySource matching metadata.source
Debug empty results
Verify documents exist via listDocuments
Language guides
Next steps
Manage documents β Index content first
Vector stores and embeddings β Choose the store and embedding model
Example: RAG bot β End-to-end Q&A
Last updated