Skip to content

The agent engineering platform.

Support to create shards_num in milvus vectorstores (#20318)

Rohit Gupta25c4c24e896b
diff --git a/libs/community/langchain_community/vectorstores/milvus.py b/libs/community/langchain_community/vectorstores/milvus.py
index f1d3e0d929..1e14ad246c 100644
--- a/libs/community/langchain_community/vectorstores/milvus.py
+++ b/libs/community/langchain_community/vectorstores/milvus.py
@@ -133,6 +133,7 @@ class Milvus(VectorStore):
partition_names: Optional[list] = None,
replica_number: int = 1,
timeout: Optional[float] = None,
+ num_shards: Optional[int] = None,
):
"""Initialize the Milvus vector store."""
try:
@@ -191,6 +192,7 @@ class Milvus(VectorStore):
self.partition_names = partition_names
self.replica_number = replica_number
self.timeout = timeout
+ self.num_shards = num_shards
# Create the connection to the server
if connection_args is None:
@@ -381,6 +383,7 @@ class Milvus(VectorStore):
schema=schema,
consistency_level=self.consistency_level,
using=self.alias,
+ num_shards=self.num_shards,
)
# Set the collection properties if they exist
if self.collection_properties is not None: