AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Missing Await In Async Similarity_search Example In QdrantVectorStore Docstring

The docstring for QdrantVectorStore contains an asynchronous example that calls asimilarity_search without await, causing users to receive a coroutine object instead of the actual search results.

mediumConfidence 95%LangChainlangchain-coreAgentsVector Stores

Origin Analysis

The example code in the docstring omitted the await keyword for the asynchronous method asimilarity_search, leading to incorrect usage that returns a coroutine instead of executed results.
1. Copy the example code from the QdrantVectorStore docstring: ```python from langchain_qdrant import QdrantVectorStore # assume vector_store is already initialized results = vector_store.asimilarity_search(query="thud", k=1) print(results) ``` 2. Run the code. Observe that the output is a coroutine object, not a list of documents.

Fixing Code Block

```python # Fixed async example: add await and wrap in an async function import asyncio from langchain_qdrant import QdrantVectorStore async def main(): # Assume vector_store is already initialized results = await vector_store.asimilarity_search(query="thud", k=1) print(results) asyncio.run(main()) ```
Add the await keyword before the asynchronous call to asimilarity_search to properly execute the coroutine and obtain the results. The example is wrapped in an async function and executed with asyncio.run to provide a complete, runnable snippet.

Edge Case Audit

Users who copy this fix must ensure they are inside an asynchronous context (async def). If the await is used outside an async function, a SyntaxError will occur. Also, different versions of langchain-qdrant may have slightly different APIs; verify that asimilarity_search exists in the installed version. To roll back, simply revert the docstring change or the user's code to the previous version.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state