Skip to content

Commit

Permalink
async support
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Nov 21, 2024
1 parent ff71063 commit 6cb5b0a
Show file tree
Hide file tree
Showing 46 changed files with 7,164 additions and 2,363 deletions.
6 changes: 6 additions & 0 deletions libs/elasticsearch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ spell_fix:
check_imports: $(shell find langchain_elasticsearch -name '*.py')
poetry run python ./scripts/check_imports.py $^

run_unasync:
poetry run python ./scripts/run_unasync.py

run_unasync_check:
poetry run python ./scripts/run_unasync.py --check

######################
# HELP
######################
Expand Down
31 changes: 28 additions & 3 deletions libs/elasticsearch/langchain_elasticsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from elasticsearch.helpers.vectorstore import (
AsyncBM25Strategy,
AsyncDenseVectorScriptScoreStrategy,
AsyncDenseVectorStrategy,
AsyncRetrievalStrategy,
AsyncSparseVectorStrategy,
BM25Strategy,
DenseVectorScriptScoreStrategy,
DenseVectorStrategy,
Expand All @@ -8,28 +13,48 @@
)

from langchain_elasticsearch.cache import (
AsyncElasticsearchCache,
AsyncElasticsearchEmbeddingsCache,
ElasticsearchCache,
ElasticsearchEmbeddingsCache,
)
from langchain_elasticsearch.chat_history import ElasticsearchChatMessageHistory
from langchain_elasticsearch.embeddings import ElasticsearchEmbeddings
from langchain_elasticsearch.retrievers import ElasticsearchRetriever
from langchain_elasticsearch.chat_history import AsyncElasticsearchChatMessageHistory, ElasticsearchChatMessageHistory

Check failure on line 21 in libs/elasticsearch/langchain_elasticsearch/__init__.py

View workflow job for this annotation

GitHub Actions / cd libs/elasticsearch / make lint #3.11

Ruff (E501)

langchain_elasticsearch/__init__.py:21:89: E501 Line too long (118 > 88)
from langchain_elasticsearch.embeddings import (
AsyncElasticsearchEmbeddings,
ElasticsearchEmbeddings,
)
from langchain_elasticsearch.retrievers import (
AsyncElasticsearchRetriever,
ElasticsearchRetriever,
)
from langchain_elasticsearch.vectorstores import (
ApproxRetrievalStrategy,
AsyncElasticsearchStore,
BM25RetrievalStrategy,
ElasticsearchStore,
ExactRetrievalStrategy,
SparseRetrievalStrategy,
)

__all__ = [

Check failure on line 39 in libs/elasticsearch/langchain_elasticsearch/__init__.py

View workflow job for this annotation

GitHub Actions / cd libs/elasticsearch / make lint #3.11

Ruff (I001)

langchain_elasticsearch/__init__.py:1:1: I001 Import block is un-sorted or un-formatted
"AsyncElasticsearchCache",
"AsyncElasticsearchChatMessageHistory",
"AsyncElasticsearchEmbeddings",
"AsyncElasticsearchEmbeddingsCache",
"AsyncElasticsearchRetriever",
"AsyncElasticsearchStore",
"ElasticsearchCache",
"ElasticsearchChatMessageHistory",
"ElasticsearchEmbeddings",
"ElasticsearchEmbeddingsCache",
"ElasticsearchRetriever",
"ElasticsearchStore",
# retrieval strategies
"AsyncBM25Strategy",
"AsyncDenseVectorScriptScoreStrategy",
"AsyncDenseVectorStrategy",
"AsyncRetrievalStrategy",
"AsyncSparseVectorStrategy",
"BM25Strategy",
"DenseVectorScriptScoreStrategy",
"DenseVectorStrategy",
Expand Down
Loading

0 comments on commit 6cb5b0a

Please sign in to comment.