Skip to content

Commit e5fe7cc

Browse files
committed
Add support for other Milvus connection options
Signed-off-by: Juan Cruz-Benito <[email protected]>
1 parent 04ff531 commit e5fe7cc

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ result = query("Write a report about xxx.") # Your question here
326326
<li>
327327
If you have a large-scale dataset, you can set up a more performant Milvus server using
328328
<a href="https://milvus.io/docs/quickstart.md" target="_blank">Docker or Kubernetes</a>.
329-
In this setup, use the server URI, e.g., <code>http://localhost:19530</code>, as your <code>uri</code>.
329+
In this setup, use the server URI, e.g., <code>http://localhost:19530</code>, as your <code>uri</code>.
330+
You can also use any other connection parameters supported by Milvus such as <code>host</code>, <code>user</code>, <code>password</code>, or <code>secure</code>.
330331
</li>
331332
</ul>
332333
<ul>

deepsearcher/vector_db/milvus.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ def __init__(
1818
default_collection: str = "deepsearcher",
1919
uri: str = "http://localhost:19530",
2020
token: str = "root:Milvus",
21+
user: str = "",
22+
password: str = "",
2123
db: str = "default",
2224
hybrid: bool = False,
25+
**kwargs,
2326
):
2427
"""
2528
Initialize the Milvus client.
@@ -28,12 +31,17 @@ def __init__(
2831
default_collection (str, optional): Default collection name. Defaults to "deepsearcher".
2932
uri (str, optional): URI for connecting to Milvus server. Defaults to "http://localhost:19530".
3033
token (str, optional): Authentication token for Milvus. Defaults to "root:Milvus".
34+
user (str, optional): Username for authentication. Defaults to "".
35+
password (str, optional): Password for authentication. Defaults to "".
3136
db (str, optional): Database name. Defaults to "default".
3237
hybrid (bool, optional): Whether to enable hybrid search. Defaults to False.
38+
**kwargs: Additional keyword arguments to pass to the MilvusClient.
3339
"""
3440
super().__init__(default_collection)
3541
self.default_collection = default_collection
36-
self.client = MilvusClient(uri=uri, token=token, db_name=db, timeout=30)
42+
self.client = MilvusClient(
43+
uri=uri, user=user, password=password, token=token, db_name=db, timeout=30, **kwargs
44+
)
3745

3846
self.hybrid = hybrid
3947

docs/configuration/vector_db.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ config.set_provider_config("vector_db", "Milvus", {"uri": "./milvus.db", "token"
3535
config.set_provider_config("vector_db", "Milvus", {"uri": "http://localhost:19530", "token": ""})
3636
```
3737

38+
Also, you could specify other connection parameters supported by Milvus such as `user`, `password`, `secure` or others.
39+
```python
40+
config.set_provider_config("vector_db", "Milvus", {"uri": "http://localhost:19530", "user": "<username>", "password":"<password>", "secure": True, "token": ""})
41+
```
42+
3843
??? example "Zilliz Cloud (Managed Service)"
3944

4045
[Zilliz Cloud](https://zilliz.com/cloud) provides a fully managed cloud service for Milvus. To use Zilliz Cloud, adjust the `uri` and `token` according to the [Public Endpoint and API Key](https://docs.zilliz.com/docs/on-zilliz-cloud-console#free-cluster-details):

0 commit comments

Comments
 (0)