Skip to content

Commit

Permalink
async support (#53)
Browse files Browse the repository at this point in the history
* async support

* format

* fixed unit test failures

* sort imports

* more code reformat

* typing fixes

* typing fixes

* one more reformat

* typing fixes

* docs

* use sed to change get_messages() to messages
  • Loading branch information
miguelgrinberg authored Nov 27, 2024
1 parent ff71063 commit 9c3bccd
Show file tree
Hide file tree
Showing 46 changed files with 7,334 additions and 2,374 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
34 changes: 31 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,51 @@
)

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,
)
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__ = [
"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 9c3bccd

Please sign in to comment.