Skip to content

Commit 0148ffc

Browse files
committed
feat(storage): add Milvus vector adapter
1 parent f8ae35c commit 0148ffc

10 files changed

Lines changed: 2376 additions & 174 deletions

File tree

docs/en/guides/01-configuration.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ Vector database storage configuration
12091209

12101210
| Parameter | Type | Description | Default |
12111211
|-----------|------|-------------|---------|
1212-
| `backend` | str | VectorDB backend type: 'local' (file-based), 'http' (remote service), 'volcengine' (cloud VikingDB), 'vikingdb' (private deployment), 'cuvs' (local storage + GPU dense search), 'qdrant', or 'opengauss' | "local" |
1212+
| `backend` | str | VectorDB backend type: 'local' (file-based), 'http' (remote service), 'volcengine' (cloud VikingDB), 'vikingdb' (private deployment), 'cuvs' (local storage + GPU dense search), 'qdrant', 'milvus', or 'opengauss' | "local" |
12131213
| `name` | str | VectorDB collection name | "context" |
12141214
| `url` | str | Remote service URL for 'http' type (e.g., 'http://localhost:5000') | null |
12151215
| `project_name` | str | Project name (alias project) | "default" |
@@ -1220,6 +1220,7 @@ Vector database storage configuration
12201220
| `vikingdb` | object | 'vikingdb' type private deployment configuration | - |
12211221
| `cuvs` | object | NVIDIA cuVS configuration for the 'cuvs' backend and the opt-in memory-aware auto mode on 'local'; see the [cuVS guide](./16-cuvs.md) | - |
12221222
| `qdrant` | object | 'qdrant' type Qdrant configuration | - |
1223+
| `milvus` | object | 'milvus' type Milvus or Zilliz Cloud configuration | - |
12231224
| `opengauss` | object | 'opengauss' native vector backend configuration | - |
12241225

12251226
Default local mode
@@ -1254,6 +1255,37 @@ Supports cloud-deployed VikingDB on Volcengine
12541255
```
12551256
</details>
12561257

1258+
<details>
1259+
<summary><b>Milvus</b></summary>
1260+
1261+
Install the `milvus` optional extra before using this backend. The default `uri`
1262+
uses Milvus Lite and stores data in a local `milvus.db` file. Use an HTTP URI for
1263+
self-hosted Milvus, or a cloud endpoint plus `token` for Zilliz Cloud.
1264+
1265+
```json
1266+
{
1267+
"storage": {
1268+
"vectordb": {
1269+
"name": "context",
1270+
"backend": "milvus",
1271+
"project": "default",
1272+
"distance_metric": "cosine",
1273+
"dimension": 1024,
1274+
"milvus": {
1275+
"uri": "./milvus.db",
1276+
"token": null,
1277+
"db_name": null,
1278+
"consistency_level": "Session"
1279+
}
1280+
}
1281+
}
1282+
}
1283+
```
1284+
1285+
For a self-hosted server, set `"uri": "http://localhost:19530"`. For Zilliz Cloud,
1286+
set `"uri"` to the cloud endpoint and provide `"token"`.
1287+
</details>
1288+
12571289
<details>
12581290
<summary><b>openGauss</b></summary>
12591291

docs/zh/guides/01-configuration.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ RAGFS 默认使用 Rust binding 模式,通过 Rust 实现直接访问文件系
11811181

11821182
| 参数 | 类型 | 说明 | 默认值 |
11831183
|------|------|------|--------|
1184-
| `backend` | str | VectorDB 后端类型: 'local'(基于文件), 'http'(远程服务), 'volcengine'(云上 VikingDB), 'vikingdb'(私有部署), 'cuvs'(本地存储 + GPU dense search), 'qdrant' 或 'opengauss' | "local" |
1184+
| `backend` | str | VectorDB 后端类型: 'local'(基于文件), 'http'(远程服务), 'volcengine'(云上 VikingDB), 'vikingdb'(私有部署), 'cuvs'(本地存储 + GPU dense search), 'qdrant'、'milvus' 或 'opengauss' | "local" |
11851185
| `name` | str | VectorDB 的集合名称 | "context" |
11861186
| `url` | str | 'http' 类型的远程服务 URL(例如 'http://localhost:5000') | null |
11871187
| `project_name` | str | 项目名称(别名 project) | "default" |
@@ -1192,6 +1192,7 @@ RAGFS 默认使用 Rust binding 模式,通过 Rust 实现直接访问文件系
11921192
| `vikingdb` | object | 'vikingdb' 类型的私有部署配置 | - |
11931193
| `cuvs` | object | NVIDIA cuVS 配置,也用于在 'local' 下显式开启显存感知自动模式,参见 [cuVS 使用指南](./16-cuvs.md) | - |
11941194
| `qdrant` | object | 'qdrant' 类型的 Qdrant 配置 | - |
1195+
| `milvus` | object | 'milvus' 类型的 Milvus 或 Zilliz Cloud 配置 | - |
11951196
| `opengauss` | object | 'opengauss' 原生向量后端配置 | - |
11961197

11971198
默认使用本地模式
@@ -1226,6 +1227,37 @@ RAGFS 默认使用 Rust binding 模式,通过 Rust 实现直接访问文件系
12261227
```
12271228
</details>
12281229

1230+
<details>
1231+
<summary><b>Milvus</b></summary>
1232+
1233+
使用该后端前需要安装 `milvus` 可选依赖。默认 `uri` 使用 Milvus Lite,
1234+
并把数据写入本地 `milvus.db` 文件。自托管 Milvus 使用 HTTP URI;
1235+
Zilliz Cloud 使用云端 endpoint 并配置 `token`。
1236+
1237+
```json
1238+
{
1239+
"storage": {
1240+
"vectordb": {
1241+
"name": "context",
1242+
"backend": "milvus",
1243+
"project": "default",
1244+
"distance_metric": "cosine",
1245+
"dimension": 1024,
1246+
"milvus": {
1247+
"uri": "./milvus.db",
1248+
"token": null,
1249+
"db_name": null,
1250+
"consistency_level": "Session"
1251+
}
1252+
}
1253+
}
1254+
}
1255+
```
1256+
1257+
如果连接自托管服务,可设置 `"uri": "http://localhost:19530"`。如果使用
1258+
Zilliz Cloud,把 `"uri"` 设置为云端 endpoint,并填写 `"token"`。
1259+
</details>
1260+
12291261
<details>
12301262
<summary><b>openGauss</b></summary>
12311263

openviking/storage/vectordb_adapters/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,32 @@
146146
1. `backend`: 填写 Adapter 类的完整 Python 路径(例如 `my_project.adapters.MyAdapter`)。
147147
2. `custom_params`: 这是一个字典,你可以放入任何自定义参数,Adapter 的 `from_config` 方法可以通过 `config.custom_params` 获取这些值。
148148

149+
内置 Milvus 后端可直接使用 registry 名称,并通过 `milvus` 配置块传递连接信息:
150+
151+
```json
152+
{
153+
"storage": {
154+
"vectordb": {
155+
"backend": "milvus",
156+
"name": "context",
157+
"project": "default",
158+
"distance_metric": "cosine",
159+
"dimension": 1024,
160+
"milvus": {
161+
"uri": "./milvus.db",
162+
"token": null,
163+
"db_name": null,
164+
"consistency_level": "Session"
165+
}
166+
}
167+
}
168+
}
169+
```
170+
171+
`uri` 默认为 Milvus Lite 本地文件;也可以设置为自建 Milvus 服务
172+
(如 `http://localhost:19530`)或 Zilliz Cloud endpoint,认证统一使用
173+
`token` 字段。
174+
149175

150176

151177
---
@@ -238,4 +264,4 @@ class ThirdPartyCollectionAdapter(CollectionAdapter):
238264
- `backend=thirdparty` 可正常初始化。
239265
- create 后可完成 upsert/get/query/delete/count 全流程。
240266
- 不改上层业务调用方式即可参与 `find/search` 检索链路。
241-
- 后端差异全部封装在 adapter 层。
267+
- 后端差异全部封装在 adapter 层。

openviking/storage/vectordb_adapters/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .factory import create_collection_adapter
77
from .http_adapter import HttpCollectionAdapter
88
from .local_adapter import CuVSCollectionAdapter, LocalCollectionAdapter
9+
from .milvus_adapter import MilvusCollectionAdapter
910
from .opengauss_adapter import OpenGaussCollectionAdapter
1011
from .qdrant_adapter import QdrantCollectionAdapter
1112
from .vikingdb_private_adapter import VikingDBPrivateCollectionAdapter
@@ -16,6 +17,7 @@
1617
"LocalCollectionAdapter",
1718
"CuVSCollectionAdapter",
1819
"HttpCollectionAdapter",
20+
"MilvusCollectionAdapter",
1921
"OpenGaussCollectionAdapter",
2022
"QdrantCollectionAdapter",
2123
"VolcengineCollectionAdapter",

openviking/storage/vectordb_adapters/factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .base import CollectionAdapter
1010
from .http_adapter import HttpCollectionAdapter
1111
from .local_adapter import CuVSCollectionAdapter, LocalCollectionAdapter
12+
from .milvus_adapter import MilvusCollectionAdapter
1213
from .opengauss_adapter import OpenGaussCollectionAdapter
1314
from .qdrant_adapter import QdrantCollectionAdapter
1415
from .vikingdb_private_adapter import VikingDBPrivateCollectionAdapter
@@ -18,6 +19,7 @@
1819
"local": LocalCollectionAdapter,
1920
"cuvs": CuVSCollectionAdapter,
2021
"http": HttpCollectionAdapter,
22+
"milvus": MilvusCollectionAdapter,
2123
"opengauss": OpenGaussCollectionAdapter,
2224
"qdrant": QdrantCollectionAdapter,
2325
"volcengine": VolcengineCollectionAdapter,

0 commit comments

Comments
 (0)