langchain/docs/modules/models
Jeff Vestal 46e181aa8b
Allow ElasticsearchEmbeddings to create a connection with ES Client object (#5321)
This PR adds a new method `from_es_connection` to the
`ElasticsearchEmbeddings` class allowing users to use Elasticsearch
clusters outside of Elastic Cloud.

Users can create an Elasticsearch Client object and pass that to the new
function.
The returned object is identical to the one returned by calling
`from_credentials`

```
# Create Elasticsearch connection
es_connection = Elasticsearch(
    hosts=['https://es_cluster_url:port'], 
    basic_auth=('user', 'password')
)

# Instantiate ElasticsearchEmbeddings using es_connection
embeddings = ElasticsearchEmbeddings.from_es_connection(
  model_id,
  es_connection,
)
```

I also added examples to the elasticsearch jupyter notebook

Fixes # https://github.com/hwchase17/langchain/issues/5239

---------

Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
2023-05-30 17:26:30 -07:00
..
chat Harrison/vertex (#5049) 2023-05-24 15:51:12 -07:00
llms Harrison/prediction guard update (#5404) 2023-05-29 07:14:59 -07:00
text_embedding/examples Allow ElasticsearchEmbeddings to create a connection with ES Client object (#5321) 2023-05-30 17:26:30 -07:00
chat.rst big docs refactor (#1978) 2023-03-26 19:49:46 -07:00
getting_started.ipynb change heading 2023-05-13 09:52:23 -07:00
llms.rst big docs refactor (#1978) 2023-03-26 19:49:46 -07:00
text_embedding.rst big docs refactor (#1978) 2023-03-26 19:49:46 -07:00