fix: VectorDB with metadata parameter

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
This commit is contained in:
Varsha Prasad Narsing 2025-06-26 12:04:38 -07:00
parent 3d27b7054c
commit 655468bbaf
6 changed files with 9 additions and 7 deletions

View file

@ -97,11 +97,14 @@ class VectorIORouter(VectorIO):
vector_db_id: str,
chunks: list[Chunk],
ttl_seconds: int | None = None,
params: dict[str, Any] | None = None,
) -> None:
logger.debug(
f"VectorIORouter.insert_chunks: {vector_db_id}, {len(chunks)} chunks, ttl_seconds={ttl_seconds}, chunk_ids={[chunk.metadata['document_id'] for chunk in chunks[:3]]}{' and more...' if len(chunks) > 3 else ''}",
)
return await self.routing_table.get_provider_impl(vector_db_id).insert_chunks(vector_db_id, chunks, ttl_seconds)
return await self.routing_table.get_provider_impl(vector_db_id).insert_chunks(
vector_db_id, chunks, ttl_seconds, params
)
async def query_chunks(
self,

View file

@ -178,6 +178,7 @@ class ChromaVectorIOAdapter(VectorIO, VectorDBsProtocolPrivate):
vector_db_id: str,
chunks: list[Chunk],
ttl_seconds: int | None = None,
params: dict[str, Any] | None = None,
) -> None:
index = await self._get_and_cache_vector_db_index(vector_db_id)

View file

@ -183,6 +183,7 @@ class MilvusVectorIOAdapter(VectorIO, VectorDBsProtocolPrivate):
vector_db_id: str,
chunks: list[Chunk],
ttl_seconds: int | None = None,
params: dict[str, Any] | None = None,
) -> None:
index = await self._get_and_cache_vector_db_index(vector_db_id)
if not index:

View file

@ -215,6 +215,7 @@ class PGVectorVectorIOAdapter(VectorIO, VectorDBsProtocolPrivate):
vector_db_id: str,
chunks: list[Chunk],
ttl_seconds: int | None = None,
params: dict[str, Any] | None = None,
) -> None:
index = await self._get_and_cache_vector_db_index(vector_db_id)
await index.insert_chunks(chunks)

View file

@ -370,12 +370,7 @@ class QdrantVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocolP
if params is not None:
distance_metric = params.get("distance_metric")
# Create metadata dict with distance_metric if provided
metadata = None
if distance_metric is not None:
metadata = {"distance_metric": distance_metric}
await index.insert_chunks(chunks, metadata=metadata)
await index.insert_chunks(chunks, distance_metric=distance_metric)
async def query_chunks(
self,

View file

@ -188,6 +188,7 @@ class WeaviateVectorIOAdapter(
vector_db_id: str,
chunks: list[Chunk],
ttl_seconds: int | None = None,
params: dict[str, Any] | None = None,
) -> None:
index = await self._get_and_cache_vector_db_index(vector_db_id)
if not index: