Quick Start
Last updated
Last updated
For more details, see our
The fastest way to use RAGchain is using . In this example, we use and , which is simple but powerful.
Before run pipelines, you need to make Redis DB. It is essential part for link retrieval and DB. Please read docs for more information.
You can choose between , , or as your data storage. The choice depends on your project's requirements.
For example, let's take a look at a setup that uses RedisDB
as a linker.
A great way to set up a Redis DB is using the free Redis.com DB. Go to redis.com and create your database.
After you build your own Redis DB, you can get the Redis host URL, port number, DB name (number like 0), and password. You must set these values to environment variables like below.
If you want to use DynamoLinker
or JsonLinker
, you can set LINKER_TYPE
to "dynamodb" of "json" and set the environment variables for each linker.
We want to use Vector DB retrieval and openai embedding in this example. So, you have to set your OpenAI API key. Set openai API key environment variable like below:
You have to set path to location that you want to store chroma and pickle db.
While running above code, retrieval automatically retrieve related passages to your question. And, it uses OpenAI model, generate great answer to your question according to retrieved passages in your text file.
That's it! Now you can do question&answering about your files using LLM.
Plus, you can load various kind of files, embed contents with embedding models, store vectors at various vector stores which compatible with Langchain. Also, you can use Langchain LCEL with RAGchain, so using various LLM models is really easy.
Then, you can ingest file. Prepare your .txt file. And run like below.
In this example, we use for simple saving to local disk. And use for ingesting .txt file. And we use VectorDBRetrieval for simple dense passage retireval. As vector db, we use .
When you run above code, automatically load your .txt file, split into passages, and save it to DB. Also, passage contents embeds to vector represnetation and save to Chroma vector DB.
After ingestion, you can simply run RAG workflow using like below.
You can use various kind of , , . Also, you can use whole workflow easily using another .
Lastly, please feel free to ask and contribute to RAGchain at in our git repo!