Skip to content

Fix upsert_available in Qdrant to correctly reflect Qdrant's upsert support #7728

@skatset

Description

@skatset

The upsert_available method in the Qdrant class currently inherits the default implementation from the VectorDb abstract base class, which returns False. However, Qdrant does support the upsert operation — both Qdrant.upsert / Qdrant.async_upsert are implemented in agno, and the underlying qdrant_client.QdrantClient.upsert / AsyncQdrantClient.upsert calls back this directly. So this method should return True to accurately reflect the capabilities of the underlying database.

This discrepancy can lead to:

  • Misleading behavior: Code that relies on upsert_available to check for upsert support will incorrectly assume that upsert is not available.
  • Missed optimizations: Developers might avoid using upsert even though it is supported, leading to less efficient code.

Expected Behavior

The upsert_available method in the Qdrant class should return True because Qdrant supports the upsert operation.

Steps to Reproduce

Create an instance of the Qdrant class:

from agno.vectordb.qdrant import Qdrant

qdrant_db = Qdrant(collection="my_collection", url="http://localhost:6333")

Check the value of upsert_available:

print(qdrant_db.upsert_available())  # Output: False (incorrect)

Proposed Fix

Override the upsert_available method in the Qdrant class to return True:

def upsert_available(self) -> bool:
    """Check if upsert is available in Qdrant."""
    return True

Additional Context

Qdrant's Python client supports the upsert operation, as confirmed by its documentation and source code. The agno Qdrant class already implements both upsert and async_upsert, and insert itself routes through client.upsert(...).

The current implementation of upsert_available in Qdrant does not reflect this capability, which is likely an oversight — exactly analogous to the ChromaDB issue fixed in #1698 / #1699.

Why This Matters

  • Correctness: The upsert_available method should accurately reflect the capabilities of the underlying database.
  • Efficiency: Developers can use upsert to simplify their code and avoid unnecessary checks for document existence.
  • Consistency: This fix ensures that the Qdrant class behaves as expected when integrated with other parts of the framework — most notably, knowledge-base loading flows that batch-load PDFs from a folder rely on upsert_available() to dedupe; with the current value, documents get reinserted instead of upserted.
class Qdrant(VectorDb):
    def upsert_available(self) -> bool:
        """Check if upsert is available in Qdrant."""
        return True

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions