feat: add Tencent VectorDB retriever backend
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
[返回目录](./README.md)
|
||||
|
||||
向量存储(VectorStore)API 用于管理向量数据库连接配置。支持 Elasticsearch、PostgreSQL、Qdrant、Milvus、Weaviate、SQLite 六种引擎类型。
|
||||
向量存储(VectorStore)API 用于管理向量数据库连接配置。支持 Elasticsearch、PostgreSQL、Qdrant、Milvus、Weaviate、Tencent VectorDB、SQLite 七种引擎类型。
|
||||
|
||||
| 方法 | 路径 | 描述 |
|
||||
| ------ | ---------------------------- | ------------------------------ |
|
||||
@@ -110,6 +110,8 @@ curl --location 'http://localhost:8080/api/v1/vector-stores/test' \
|
||||
|
||||
创建一个新的向量存储配置。同一 endpoint + index 组合不允许重复注册(包括环境变量配置的存储)。
|
||||
|
||||
Tencent VectorDB 使用 `engine_type: "tencent_vectordb"`。`connection_config` 中 `addr`、`username`、`api_key` 为必填,`database` 可选;`index_config.collection_name` 表示集合名前缀,实际集合会按向量维度追加后缀,例如 `weknora_embeddings_768`。
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
@@ -130,6 +132,27 @@ curl --location 'http://localhost:8080/api/v1/vector-stores' \
|
||||
}'
|
||||
```
|
||||
|
||||
**Tencent VectorDB 请求示例**:
|
||||
|
||||
```curl
|
||||
curl --location 'http://localhost:8080/api/v1/vector-stores' \
|
||||
--header 'X-API-Key: sk-xxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "tencent-vectordb",
|
||||
"engine_type": "tencent_vectordb",
|
||||
"connection_config": {
|
||||
"addr": "http://your-instance.tencentvectordb.com",
|
||||
"username": "root",
|
||||
"api_key": "your_api_key",
|
||||
"database": "weknora"
|
||||
},
|
||||
"index_config": {
|
||||
"collection_name": "weknora_embeddings"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
**响应** (201):
|
||||
|
||||
```json
|
||||
|
||||
@@ -61,6 +61,7 @@ YOUR_DATABASE_PASSWORD=password
|
||||
- ElasticsearchV7: `internal/application/repository/retriever/elasticsearch/v7/`
|
||||
- ElasticsearchV8: `internal/application/repository/retriever/elasticsearch/v8/`
|
||||
- Apache Doris 4.1: `internal/application/repository/retriever/doris/`
|
||||
- Tencent VectorDB: `internal/application/repository/retriever/tencentvectordb/`
|
||||
|
||||
## Apache Doris 4.1 集成要点
|
||||
|
||||
@@ -87,6 +88,21 @@ DORIS_TABLE_PREFIX=weknora_embeddings
|
||||
|
||||
启动方式:`docker compose --profile doris up -d`,然后在 FE 上 `CREATE DATABASE weknora;`。
|
||||
|
||||
## Tencent VectorDB
|
||||
|
||||
WeKnora 内置 Tencent VectorDB 适配器,驱动名为 `tencent_vectordb`。该适配器支持向量检索和索引管理,关键词检索不在当前适配器范围内。
|
||||
|
||||
```env
|
||||
RETRIEVE_DRIVER=tencent_vectordb
|
||||
TENCENT_VECTORDB_ADDR=http://your-instance.tencentvectordb.com
|
||||
TENCENT_VECTORDB_USERNAME=root
|
||||
TENCENT_VECTORDB_API_KEY=your_tencent_vectordb_api_key
|
||||
TENCENT_VECTORDB_DATABASE=weknora
|
||||
TENCENT_VECTORDB_COLLECTION=weknora_embeddings
|
||||
```
|
||||
|
||||
`TENCENT_VECTORDB_COLLECTION` 是集合名前缀。WeKnora 会按向量维度创建实际集合,例如 `weknora_embeddings_768`。
|
||||
|
||||
## 相关主题
|
||||
|
||||
- [添加网络搜索引擎](../集成扩展/添加网络搜索引擎.md) — 同类扩展开发模式(接口实现 + 注册 + DI)
|
||||
|
||||
@@ -184,6 +184,7 @@ const (
|
||||
- ElasticsearchV7: `internal/application/repository/retriever/elasticsearch/v7/`
|
||||
- ElasticsearchV8: `internal/application/repository/retriever/elasticsearch/v8/`
|
||||
- Apache Doris 4.1: `internal/application/repository/retriever/doris/`
|
||||
- Tencent VectorDB: `internal/application/repository/retriever/tencentvectordb/`
|
||||
|
||||
通过遵循以上步骤和参考现有实现,你可以成功集成新的向量数据库到 WeKnora 系统中,扩展其向量检索能力。
|
||||
|
||||
@@ -275,5 +276,20 @@ docker exec -it WeKnora-doris-fe mysql -h 127.0.0.1 -P 9030 -uroot \
|
||||
|
||||
随后启动 WeKnora 后端,知识库写入即会按维度自动建表。
|
||||
|
||||
## Tencent VectorDB
|
||||
|
||||
WeKnora 内置 Tencent VectorDB 适配器,驱动名为 `tencent_vectordb`。该适配器支持向量检索和索引管理,关键词检索不在当前适配器范围内。
|
||||
|
||||
### 环境变量示例
|
||||
|
||||
```env
|
||||
RETRIEVE_DRIVER=tencent_vectordb
|
||||
TENCENT_VECTORDB_ADDR=http://your-instance.tencentvectordb.com
|
||||
TENCENT_VECTORDB_USERNAME=root
|
||||
TENCENT_VECTORDB_API_KEY=your_tencent_vectordb_api_key
|
||||
TENCENT_VECTORDB_DATABASE=weknora
|
||||
TENCENT_VECTORDB_COLLECTION=weknora_embeddings
|
||||
```
|
||||
|
||||
`TENCENT_VECTORDB_COLLECTION` 是集合名前缀。WeKnora 会按向量维度创建实际集合,例如 `weknora_embeddings_768`,用于隔离不同 embedding 模型维度的数据。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user