Skip to content

Support num_partitions to decide no of partition other then default #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/milvus/langchain_milvus/vectorstores/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def __init__(
enable_dynamic_field: bool = False,
metadata_field: Optional[str] = None,
partition_key_field: Optional[str] = None,
num_partitions: Optional[int] = None,
partition_names: Optional[list] = None,
replica_number: int = 1,
timeout: Optional[float] = None,
Expand Down Expand Up @@ -339,6 +340,7 @@ def __init__(
self.search_params = search_params
self.consistency_level = consistency_level
self.auto_id = auto_id
self.num_partitions = num_partitions

# In order for a collection to be compatible, pk needs to be varchar
self._primary_field = primary_field
Expand Down Expand Up @@ -658,13 +660,15 @@ def _create_collection(
consistency_level=self.consistency_level,
using=self.alias,
num_shards=self.num_shards,
num_partitions=self.num_partitions,
)
else:
self.col = Collection(
name=self.collection_name,
schema=schema,
consistency_level=self.consistency_level,
using=self.alias,
num_partitions=self.num_partitions,
)
# Set the collection properties if they exist
if self.collection_properties is not None:
Expand Down