You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/templates/rag-elasticsearch
David Duong d39b4b61b6
Batch apply `poetry lock --no-update` for all templates (#12531)
Ran the following bash script for all templates

```bash
#!/bin/bash

set -e
current_dir="$(pwd)"
for directory in */; do
    if [ -d "$directory" ]; then
        (cd "$directory" && poetry lock --no-update)
    fi
done

cd "$current_dir"
```

Co-authored-by: Bagatur <baskaryan@gmail.com>
8 months ago
..
data Templates (#12294) 8 months ago
rag_elasticsearch Format Templates (#12396) 8 months ago
LICENSE Templates (#12294) 8 months ago
README.md Templates (#12294) 8 months ago
ingest.py Format Templates (#12396) 8 months ago
main.py Format Templates (#12396) 8 months ago
poetry.lock Batch apply `poetry lock --no-update` for all templates (#12531) 8 months ago
pyproject.toml Templates (#12294) 8 months ago

README.md

Elasticsearch RAG Example

Using Langserve and ElasticSearch to build a RAG search example for answering questions on workplace documents.

Relies on sentence transformer MiniLM-L6-v2 for embedding passages and questions.

Running Elasticsearch

There are a number of ways to run Elasticsearch.

Elastic Cloud

Create a free trial account on Elastic Cloud.

Once you have created an account, you can create a deployment. With a deployment, you can use these environment variables to connect to your Elasticsearch instance:

export ELASTIC_CLOUD_ID = <ClOUD_ID>
export ELASTIC_USERNAME = <ClOUD_USERNAME>
export ELASTIC_PASSWORD = <ClOUD_PASSWORD>

Docker

For local development, you can use Docker:

docker run -p 9200:9200 \
  -e "discovery.type=single-node" \
  -e "xpack.security.enabled=false" \
  -e "xpack.security.http.ssl.enabled=false" \
  -e "xpack.license.self_generated.type=trial" \
  docker.elastic.co/elasticsearch/elasticsearch:8.10.0

This will run Elasticsearch on port 9200. You can then check that it is running by visiting http://localhost:9200.

With a deployment, you can use these environment variables to connect to your Elasticsearch instance:

export ES_URL = "http://localhost:9200"

Documents

To load fictional workplace documents, run the following command from the root of this repository:

python ./data/load_documents.py

However, you can choose from a large number of document loaders here.

Installation

# from inside your LangServe instance
poe add rag-elasticsearch