langchain - ✅(Solved) Fix Missing await in async similarity_search example [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#37058Fetched 2026-04-29 06:11:30
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×3cross-referenced ×2issue_type_added ×1

The async example in the QdrantVectorStore docstring is missing an await for asimilarity_search.

Current example:

results = vector_store.asimilarity_search(query="thud", k=1)

This returns a coroutine instead of actual results when executed.

Expected behavior:

results = await vector_store.asimilarity_search(query="thud", k=1)

This is also inconsistent with the other async examples in the same section, which correctly use await.

Suggested fix: Add await to the asimilarity_search call in the async example.

Error Message

Error Message and Stack Trace (if applicable)

Root Cause

The async example in the QdrantVectorStore docstring is missing an await for asimilarity_search.

Current example:

results = vector_store.asimilarity_search(query="thud", k=1)

This returns a coroutine instead of actual results when executed.

Expected behavior:

results = await vector_store.asimilarity_search(query="thud", k=1)

This is also inconsistent with the other async examples in the same section, which correctly use await.

Suggested fix: Add await to the asimilarity_search call in the async example.

Fix Action

Fix / Workaround

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

PR fix notes

PR #37055: docs(qdrant): fix missing await in async similarity_search example

Description (problem / solution / changelog)

Fixes #37058

The async example for asimilarity_search is missing an await, which results in a coroutine being returned instead of actual results.

This PR adds the missing await for correctness and consistency with other async examples.

Changed files

  • libs/partners/qdrant/langchain_qdrant/qdrant.py (modified, +1/-1)

PR #37066: docs: await async vector store searches

Description (problem / solution / changelog)

Fixes #37058

Summary

  • add the missing await in the Qdrant async asimilarity_search doc example
  • apply the same small correction to matching InMemory and Chroma vector store async examples
  • normalize the affected examples spacing while touching the lines

Tests

  • /opt/homebrew/bin/python3.13 -m py_compile libs/partners/qdrant/langchain_qdrant/qdrant.py libs/core/langchain_core/vectorstores/in_memory.py libs/partners/chroma/langchain_chroma/vectorstores.py
  • git diff --check
  • git grep -n "# results = vector_store.asimilarity_search" returns no remaining matches

Changed files

  • libs/core/langchain_core/vectorstores/in_memory.py (modified, +1/-1)
  • libs/partners/chroma/langchain_chroma/vectorstores.py (modified, +1/-1)
  • libs/partners/qdrant/langchain_qdrant/qdrant.py (modified, +1/-1)

Code Example

from langchain_qdrant import QdrantVectorStore

# async call without await
results = vector_store.asimilarity_search(query="thud", k=1)

print(results)

---
RAW_BUFFERClick to expand / collapse

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

from langchain_qdrant import QdrantVectorStore

# async call without await
results = vector_store.asimilarity_search(query="thud", k=1)

print(results)

Error Message and Stack Trace (if applicable)

Description

The async example in the QdrantVectorStore docstring is missing an await for asimilarity_search.

Current example:

results = vector_store.asimilarity_search(query="thud", k=1)

This returns a coroutine instead of actual results when executed.

Expected behavior:

results = await vector_store.asimilarity_search(query="thud", k=1)

This is also inconsistent with the other async examples in the same section, which correctly use await.

Suggested fix: Add await to the asimilarity_search call in the async example.

System Info

Not relevant

extent analysis

TL;DR

The issue can be fixed by adding the missing await keyword to the asimilarity_search call in the async example.

Guidance

  • The asimilarity_search method is an asynchronous function and requires the await keyword to return the actual results.
  • To fix the issue, modify the line results = vector_store.asimilarity_search(query="thud", k=1) to results = await vector_store.asimilarity_search(query="thud", k=1).
  • Ensure that the function containing this line is defined as async to allow the use of await.
  • Verify that the corrected code returns the expected results from the asimilarity_search method.

Example

from langchain_qdrant import QdrantVectorStore

async def search_example():
    # async call with await
    results = await vector_store.asimilarity_search(query="thud", k=1)
    print(results)

Notes

This fix assumes that the vector_store object is properly initialized and configured before calling the asimilarity_search method.

Recommendation

Apply workaround: Add await to the asimilarity_search call, as this is a straightforward fix that addresses the identified issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING