This notebook covers how to get started with the openGauss VectorStore. openGauss is a high-performance relational database with native vector storage and retrieval capabilities. This integration enables ACID-compliant vector operations within LangChain applications, combining traditional SQL functionality with modern AI-driven similarity search. vector store.Documentation Index
Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
设置
Launch openGauss Container
Install langchain-opengauss
- openGauss ≥ 7.0.0
- Python ≥ 3.8
- psycopg2-binary
凭证
Using your openGauss Credentials初始化
管理向量存储
向向量存储添加项目
Update items in vector store
从向量存储删除项目
查询向量存储
一旦创建了向量存储并添加了相关文档,您很可能希望在链或智能体运行期间对其进行查询。直接查询
可以按以下方式执行简单的相似度搜索:- TODO: Edit and then run code cell to generate output
转换为检索器进行查询
您还可以将向量存储转换为检索器,以便在链中更方便地使用。- TODO: Edit and then run code cell to generate output
用于检索增强生成
有关如何将此向量存储用于检索增强生成 (RAG) 的指南,请参阅以下部分:配置
Connection settings
| Parameter | Default | Description |
|---|---|---|
host | localhost | Database server address |
port | 8888 | Database connection port |
user | gaussdb | Database username |
password | - | Complex password string |
database | postgres | Default database name |
min_connections | 1 | Connection pool minimum size |
max_connections | 5 | Connection pool maximum size |
table_name | langchain_docs | Name of the table for storing vector data and metadata |
index_type | IndexType.HNSW | Vector index algorithm type. Options: HNSW or IVFFLAT\nDefault is HNSW. |
vector_type | VectorType.vector | Type of vector representation to use. Default is Vector. |
distance_strategy | DistanceStrategy.COSINE | Vector similarity metric to use for retrieval. Options: euclidean (L2 distance), cosine (angular distance, ideal for text embeddings), manhattan (L1 distance for sparse data), negative_inner_product (dot product for normalized vectors).\n Default is cosine. |
embedding_dimension | 1536 | Dimensionality of the vector embeddings. |
Supported combinations
| Vector Type | Dimensions | Index Types | Supported Distance Strategies |
|---|---|---|---|
| vector | ≤2000 | HNSW/IVFFLAT | COSINE/EUCLIDEAN/MANHATTAN/INNER_PROD |
Performance optimization
Index tuning guidelines
HNSW Parameters:m: 16-100 (balance between recall and memory)ef_construction: 64-1000 (must be > 2*m)
Connection pooling
Limitations
bitandsparsevecvector types currently in development- Maximum vector dimensions: 2000 for
vectortype
连接这些文档到 Claude、VSCode 等工具,通过 MCP 获取实时答案。

