Skip to content

Commit

Permalink
Update READMEs (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjakob authored Apr 9, 2024
1 parent 10af66e commit c80be6f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 🦜️🔗 LangChain Elastic

This repository contains 1 package with ElasticSearch integrations with LangChain:
This repository contains 1 package with Elasticsearch integrations with LangChain:

- [langchain-elasticsearch](https://pypi.org/project/langchain-elasticsearch/) integrates [ElasticSearch](https://www.elastic.co/elasticsearch).
- [langchain-elasticsearch](https://pypi.org/project/langchain-elasticsearch/) integrates [Elasticsearch](https://www.elastic.co/elasticsearch).
- [ElasticsearchStore](https://python.langchain.com/docs/integrations/vectorstores/elasticsearch/)
- [ElasticsearchRetriever](https://python.langchain.com/docs/integrations/retrievers/elasticsearch_retriever/)
- [ElasticsearchEmbeddings](https://python.langchain.com/docs/integrations/text_embedding/elasticsearch/)
- [ElasticsearchChatMessageHistory](https://python.langchain.com/docs/integrations/memory/elasticsearch_chat_message_history/)
31 changes: 31 additions & 0 deletions libs/elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,37 @@ vectorstore = ElasticsearchStore(
)
```

### ElasticsearchRetriever

The `ElasticsearchRetriever` class can be user to implement more complex queries.
This can be useful for power users and necessary if data was ingested outside of LangChain
(for example using a web crawler).

```python
def fuzzy_query(search_query: str) -> Dict:
return {
"query": {
"match": {
text_field: {
"query": search_query,
"fuzziness": "AUTO",
}
},
},
}


fuzzy_retriever = ElasticsearchRetriever.from_es_params(
es_cloud_id="your-cloud-id",
es_api_key="your-api-key",
index_name="your-index-name",
body_func=fuzzy_query,
content_field=text_field,
)

fuzzy_retriever.get_relevant_documents("fooo")
```

### ElasticsearchEmbeddings

The `ElasticsearchEmbeddings` class provides an interface to generate embeddings using a model
Expand Down

0 comments on commit c80be6f

Please sign in to comment.