feat (metadata): Added metadata parameter in query
Added metadata management for chunks in querying for all vdb, ONLY posgres with pgvector has been fully implemented
This commit is contained in:
parent
d0fba28e1f
commit
2728bb486e
5 changed files with 5 additions and 5 deletions
|
|
@ -180,7 +180,7 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||
return [m["__id__"] for m in list_data]
|
||||
|
||||
async def query(
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None, metadata_filter: dict[str, Any] | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Search by a textual query; returns top_k results with their metadata + similarity distance.
|
||||
|
|
|
|||
|
|
@ -1047,7 +1047,7 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|||
return results
|
||||
|
||||
async def query(
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None, metadata_filter: dict[str, Any] | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
# Ensure collection is loaded before querying
|
||||
self._ensure_collection_loaded()
|
||||
|
|
|
|||
|
|
@ -2216,7 +2216,7 @@ class MongoVectorDBStorage(BaseVectorStorage):
|
|||
return list_data
|
||||
|
||||
async def query(
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None, metadata_filter: dict[str, Any] | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Queries the vector database using Atlas Vector Search."""
|
||||
if query_embedding is not None:
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class NanoVectorDBStorage(BaseVectorStorage):
|
|||
)
|
||||
|
||||
async def query(
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None, metadata_filter: dict[str, Any] | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
# Use provided embedding or compute it
|
||||
if query_embedding is not None:
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class QdrantVectorDBStorage(BaseVectorStorage):
|
|||
return results
|
||||
|
||||
async def query(
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None
|
||||
self, query: str, top_k: int, query_embedding: list[float] = None, metadata_filter: dict[str, Any] | None = None
|
||||
) -> list[dict[str, Any]]:
|
||||
if query_embedding is not None:
|
||||
embedding = query_embedding
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue