Vector Store
Example Code: examples/knowledge/vectorstores
Vector store is the core component of the Knowledge system, responsible for storing and retrieving vector representations of documents.
Supported Vector Stores
trpc-agent-go supports multiple vector store implementations:
| Vector Store | Description |
|---|---|
| Memory | In-memory vector store |
| PGVector | PostgreSQL + pgvector extension |
| TcVector | Tencent Cloud vector database |
| Elasticsearch | Supports v7/v8/v9 versions |
| Qdrant | High-performance vector database |
| Milvus | High-performance vector database |
Search Modes
Vector stores support four search modes. The system automatically selects the most appropriate mode based on the query:
| Search Mode | Enum Value | Description | Requirements |
|---|---|---|---|
| Vector | SearchModeVector |
Semantic similarity search, understands query intent | Requires Embedder |
| Keyword | SearchModeKeyword |
Exact keyword matching, suitable for technical terms | PGVector requires WithEnableTSVector(true) |
| Hybrid | SearchModeHybrid |
Combines vector and keyword search (recommended, default) | PGVector requires WithEnableTSVector(true) |
| Filter | SearchModeFilter |
Metadata-only filtering, no similarity score | - |
Examples:
Filter Support
All vector stores support filter functionality, including ID filtering, metadata filtering, and complex condition filtering (FilterCondition).