Skip to content

Conversation

@miguelgonzpk
Copy link

PR Title:
feat(community): add native async support to OpenSearchVectorSearch

PR Message:

Description:
This PR implements native asynchronous support for the OpenSearchVectorSearch vector store in langchain-community, replacing the default run_in_executor workaround with true non-blocking calls using the AsyncOpenSearch client.

Key changes:

  • Implemented asimilarity_search, asimilarity_search_with_score, and asimilarity_search_with_score_by_vector using self.async_client.
  • Added _araw_similarity_search_with_score_by_vector to handle the low-level async API calls, maintaining feature parity with the synchronous version (including hybrid_search, script_scoring, painless_scripting, and routing support).
  • Refactored the response parsing logic into a new private helper method _hits_to_documents to reuse code between sync and async implementations (DRY).
  • Fixed an issue where routing parameters might be ignored in async contexts.

Issue:
N/A

Dependencies:
No new dependencies (relies on existing opensearch-py).

  • Lint and test: I have run make format, make lint and make test from the root of the package(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant