Skip to content

Conversation

ritikpandey33
Copy link
Contributor

Description

This PR fixes a crash in QdrantVectorStore when initializing with only an async client (aclient) and enable_hybrid=True. It also ensures the lazy correction mechanism for legacy collections correctly handles user-provided custom functions.

Key Changes:

Prevents AttributeError: Guards synchronous checks in init to prevent crashes with async-only clients.
Robust Legacy Support: Implements lazy detection and adaptation to legacy sparse vector formats in async-only mode.
Respects Customizations: Auto-correction logic now preserves user-provided encoder functions.
Adds Comprehensive Tests: New tests for async initialization, legacy format correction, and hybrid search.
No Breaking Changes: Maintains full backward compatibility.

Fixes #20002

New Package?

Did I fill in the tool.llamahub section in the pyproject.toml and provide a detailed README.md for my new integration or package?

[ ] Yes

[x] No

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

[x] Yes

[ ] No

Type of Change

Please delete options that are not relevant.

[x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

[x] I added new unit tests to cover this change

Suggested Checklist:

[x] I have performed a self-review of my own code

[x] I have commented my code, particularly in hard-to-understand areas

[ ] I have made corresponding changes to the documentation

[ ] I have added Google Colab support for the newly added notebooks.

[x] My changes generate no new warnings

[x] I have added tests that prove my fix is effective or that my feature works

[x] New and existing unit tests pass locally with my changes

[x] I ran uv run make format; uv run make lint to appease the lint gods

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 3, 2025
Resolves an `AttributeError` that occurred when initializing
`QdrantVectorStore` with only an async client and `enable_hybrid=True`.

The fix implements a "lazy correction" strategy by deferring the
synchronous collection check from `__init__` to the first async
operation. This ensures the correct sparse encoders are configured
while respecting any user-provided custom functions.

New tests are added to validate the crash fix and the legacy
collection auto-correction.

Fixes run-llama#20002
@ritikpandey33 ritikpandey33 force-pushed the fix/qdrant-async-hybrid-init-20002 branch from 6b1dc48 to 3a39c77 Compare October 4, 2025 13:25
f"Could not detect vector format for collection {collection_name}: {e}"
)

async def _adetect_vector_format(self, collection_name: str) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method no longer mirrors the sync version -- maybe an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: QdrantVectorStore does not work with aclient and enable_hybrid
2 participants