mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-16 17:53:37 +00:00
community: Support milvus partition key. (#15740)
- **Description:** Milvus's partition key is an important feature. It can support multi-tenancy. We hope to introduce this feature. https://milvus.io/docs/partition_key.md - **Issue:** No - **Dependencies:** No - **Twitter handle:** No --------- Signed-off-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
13b90232c1
commit
d5808f786c
@ -124,6 +124,7 @@ class Milvus(VectorStore):
|
||||
text_field: str = "text",
|
||||
vector_field: str = "vector",
|
||||
metadata_field: Optional[str] = None,
|
||||
partition_key_field: Optional[str] = None,
|
||||
partition_names: Optional[list] = None,
|
||||
replica_number: int = 1,
|
||||
timeout: Optional[float] = None,
|
||||
@ -166,6 +167,7 @@ class Milvus(VectorStore):
|
||||
# In order for compatibility, the vector field needs to be called "vector"
|
||||
self._vector_field = vector_field
|
||||
self._metadata_field = metadata_field
|
||||
self._partition_key_field = partition_key_field
|
||||
self.fields: list[str] = []
|
||||
self.partition_names = partition_names
|
||||
self.replica_number = replica_number
|
||||
@ -336,7 +338,11 @@ class Milvus(VectorStore):
|
||||
)
|
||||
|
||||
# Create the schema for the collection
|
||||
schema = CollectionSchema(fields, description=self.collection_description)
|
||||
schema = CollectionSchema(
|
||||
fields,
|
||||
description=self.collection_description,
|
||||
partition_key_field=self._partition_key_field,
|
||||
)
|
||||
|
||||
# Create the collection
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user