fix(vector_stores): handle vector=None in Milvus and Qdrant update methods (#4568)

Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Utkarsh
2026-03-27 21:50:54 +05:30
committed by GitHub
co-authored by utkarsh240799 Claude Opus 4.6
parent 68cf4e118d
commit e87240d4d9
4 changed files with 134 additions and 2 deletions
+11
View File
@@ -181,6 +181,17 @@ class MilvusDB(VectorStoreBase):
vector (List[float], optional): Updated vector.
payload (Dict, optional): Updated payload.
"""
if vector is None or payload is None:
existing = self.client.get(collection_name=self.collection_name, ids=vector_id)
if not existing:
raise ValueError(f"Vector with id {vector_id} not found in collection {self.collection_name}")
if vector is None:
vector = existing[0].get("vectors")
if vector is None:
raise ValueError(f"Existing record {vector_id} has no vector data")
if payload is None:
payload = existing[0].get("metadata")
schema = {"id": vector_id, "vectors": vector, "metadata": payload}
self.client.upsert(collection_name=self.collection_name, data=schema)