Skip to content
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

fix: Make the qdrant QdrantVectorStore.list API consistent with VectorStore #293

Open
ludwiktrammer opened this issue Jan 21, 2025 · 0 comments

Comments

@ludwiktrammer
Copy link
Collaborator

ludwiktrammer commented Jan 21, 2025

Description of the problem

In Ragbits the common interface for all vector stores includes the list command defined as:

async def list(
        self, where: WhereQuery | None = None, limit: int | None = None, offset: int = 0
    ) -> list[VectorStoreEntry]:

The optional where should be a dict mapping metadata field names to values that the resulting objects should contain (for example where={"foo": "bar"} means that the method will only return objects that have a "foo" field in their metadata with value "bar").

The WhereQuery type is also defined in Ragbits:

WhereQuery = dict[str, str | int | float | bool]

All vector store implementations are responsible for converting this common filter format to whatever format that the underlying store uses. Client code should be able to confidently use the VectorStore API without needing to know which implementation is being used behind the scenes.

Unfortunately the list method in QdrantVectorStore is not compatible with the base list method:

    async def list(  # type: ignore
        self,
        where: Filter | None = None,  # type: ignore
        limit: int | None = None,
        offset: int = 0,
    ) -> list[VectorStoreEntry]:

The where parameter has a completely different type - Filter is a class (pydantic model) defined internally in qdrant and is qdrant-specific. The # type: ignore is used to suppress the errors that would normally result from overwriting a method with an incompatible method.

Acceptance criteria

  1. The method signature should be identical to the one on the base model. where should be typed as WhereQuery and no # type: ignore should be present.
  2. Internally, inside the method's body, it should create the qdrant Filter object (based on the information passed in where) to pass it along to qdrant.
@ludwiktrammer ludwiktrammer converted this from a draft issue Jan 21, 2025
@ludwiktrammer ludwiktrammer changed the title fix: Make the qdrant VectorStore API consistent with others fix: Make the qdrant QdrantVectorStore.list API consistent with VectorStore Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant