How It Works
- The embedder converts the query to a vector.
- The vector database compares it with stored document vectors.
- The database orders results using its configured distance metric.
When to Use Vector Search
Test hybrid or keyword search when specific tokens such as IDs and error codes affect relevance.
Configuration
Basic Setup
Set the API key used byOpenAIEmbedder:
With Reranking
Set the API keys used by the default OpenAI embedder and Cohere reranker:CohereReranker to the vector-search candidates:
Example
1
Install dependencies
2
Run PgVector
3
Export the OpenAI API key
vector_search.py
Next Steps
Hybrid Search
Combine vector search with keyword matching
Embedders
Choose the right embedding model