Ragna, a very young project announced at the end of October 2023, demonstrates its power and user-friendly nature in this brief tutorial.
It draws from the expertise of professionals experienced in LLM projects and RAG applications. Unlike generic frameworks like LangChain or LlamaIndex, Ragna involves less abstraction, facilitating faster prototyping with CLI tools for easier configuration, while maintaining a scalable architecture.
In the diagram from Ragna's official website, we see various components connected through an API, utilizing concepts of queues and workers to enhance scalability.
Ragna is developed in Python and is distributed under a BSD-3-Clause license.
Install
For local installation, follow these steps, elaborated further than the official documentation:
- Install Ragna and its dependencies:
pip install 'ragna[all]'
- Address any dependency issues, such as with jinja2:
pip install jinja2==3.1.2
- Initialize the configuration file using the
ragna init
CLI:
$ ragna init
Welcome to the Ragna config creation wizard!
I'll help you create a configuration file to use with ragna.
Due to the large amount of parameters, I unfortunately can't cover everything. If you want to customize
everything, please have a look at the documentation instead.
? Which of the following statements describes best what you want to do? I want to try Ragna and its builtin source storages and assistants, which potentially require additional dependencies or setup.
ragna has the following components builtin. Select the ones that you want to use. If the requirements of a
selected component are not met, I'll show you instructions how to meet them later.
? Which source storages do you want to use? [Chroma]
? Which assistants do you want to use? [OpenAI/gpt-4]
The output path /home/raph/Dev/ragna/ragna.toml already exists and you didn't pass the --force flag to
overwrite it.
? What do you want to do? Overwrite the existing file.
And with that we are done ๐ I'm writing the configuration file to /home/raph/Dev/ragna/ragna.toml.
You can choose different options or directly edit the ragna.toml
file. For using the GPT-4 model, provide your OpenAI API key:
export OPENAI_API_KEY="sk-<the-rest-of-the-key>"
Verify Ragna's configuration with the ragna check
command:
$ ragna check
source storages
โโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ
โ โ name โ environment variables โ packages โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ โ
โ Chroma โ โ โ
chromadb>=0.4.13 โ
โ โ โ โ โ
tiktoken โ
โโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ
assistants
โโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโ
โ โ name โ environment variables โ packages โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ โ
โ OpenAI/gpt-4 โ โ
OPENAI_API_KEY โ โ
โโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโ
Use
To start using Ragna:
- Start the API component:
$ ragna api
INFO: RagnaDemoAuthentication: You can log in with any username and a matching password.
INFO: Started server process [4016]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:31476 (Press CTRL+C to quit)
Ragna's REST API is detailed in the OpenAPI format. The project also offers a Python API.
- Use the built-in Web UI:
$ ragna ui
Launching server at http://localhost:31477
You can now log in and start chats by uploading documents:
And querying their content:
Extend
Ragna's architecture facilitates easy extension. Its dynamic community is likely to soon offer new features, vectorstores, and models.
Inspired by an article, I was able to easily add basic Azure OpenAI support:
And to connect Ragna to my company instance:
In conclusion, Ragna stands out as a robust and versatile tool for RAG orchestration, offering ease of use and extensibility, which positions it as a promising asset for AI-enhanced document management.
Top comments (3)
Hi, I'm a part of the Ragna development team. Thank you for checking out Ragna, and writing a clear and complete tutorial!
One small clarification, cloning the repository is not required for installation, it's only needed if we want to extend or contribute to Ragna. Running
pip install 'ragna[all]'
should be enough because Ragna is available on PyPI.Also, could you please elaborate on the dependency issues? Ragna doesn't actually use
jinja2
, so I'm curious about any errors that you encountered. More details will help us track down the issue and improve the project. :)Thanks again for the article! ๐ป
Thanks Pavithra for the clarification, I updated the article.
Regarding jinja2 I will try and reproduce the problem and log an issue in the GitHub project.
Great article, thanks!