langchain/docs/modules
Jeff Vestal 0b542a9706
Add ElasticsearchEmbeddings class for generating embeddings using Elasticsearch models (#3401)
This PR introduces a new module, `elasticsearch_embeddings.py`, which
provides a wrapper around Elasticsearch embedding models. The new
ElasticsearchEmbeddings class allows users to generate embeddings for
documents and query texts using a [model deployed in an Elasticsearch
cluster](https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-model-ref.html#ml-nlp-model-ref-text-embedding).

### Main features:

1. The ElasticsearchEmbeddings class initializes with an Elasticsearch
connection object and a model_id, providing an interface to interact
with the Elasticsearch ML client through
[infer_trained_model](https://elasticsearch-py.readthedocs.io/en/v8.7.0/api.html?highlight=trained%20model%20infer#elasticsearch.client.MlClient.infer_trained_model)
.
2. The `embed_documents()` method generates embeddings for a list of
documents, and the `embed_query()` method generates an embedding for a
single query text.
3. The class supports custom input text field names in case the deployed
model expects a different field name than the default `text_field`.
4. The implementation is compatible with any model deployed in
Elasticsearch that generates embeddings as output.

### Benefits:

1. Simplifies the process of generating embeddings using Elasticsearch
models.
2. Provides a clean and intuitive interface to interact with the
Elasticsearch ML client.
3. Allows users to easily integrate Elasticsearch-generated embeddings.

Related issue https://github.com/hwchase17/langchain/issues/3400

---------

Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
2023-05-23 14:50:33 -07:00
..
agents Add AzureCognitiveServicesToolkit to call Azure Cognitive Services API (#5012) 2023-05-23 06:45:48 -07:00
callbacks add more color to callbacks docs (#3856) 2023-04-30 19:13:01 -07:00
chains Harrison/neo4j (#5078) 2023-05-22 07:31:48 -07:00
indexes Add link to Psychic from document loaders documentation page (#5115) 2023-05-23 06:47:23 -07:00
memory Zep memory (#4898) 2023-05-17 20:01:01 -07:00
models Add ElasticsearchEmbeddings class for generating embeddings using Elasticsearch models (#3401) 2023-05-23 14:50:33 -07:00
prompts fix prompt saving (#4987) 2023-05-20 08:21:52 -07:00
utils/examples Pass parsed inputs through to tool _run (#4309) 2023-05-08 09:13:05 -07:00
agents.rst DOC: Misspelling in agents.rst documentation (#5038) 2023-05-20 22:24:08 -07:00
chains.rst big docs refactor (#1978) 2023-03-26 19:49:46 -07:00
indexes.rst Correct typo in documentation for word 'therefore' (#2529) 2023-04-06 23:20:30 -07:00
memory.rst big docs refactor (#1978) 2023-03-26 19:49:46 -07:00
models.rst Harrison/standard llm interface (#4615) 2023-05-13 09:05:31 -07:00
paul_graham_essay.txt Fix notebook example (#3142) 2023-04-19 08:55:06 -07:00
prompts.rst Harrison/prompt constructor methods (#4616) 2023-05-13 09:23:51 -07:00
state_of_the_union.txt Docs refactor (#480) 2023-01-02 08:24:09 -08:00