A demo project for RAG using FastAPI and LlamaIndex
Project description
Readme
This is a demo project for Retrieval-Augmented Generation (RAG) service based on LlamaIndex and FastAPI. It includes an example of how to set up and use the RAG service with a MinIO storage backend, MongoDB for metadata storage, and Qdrant for vector storage.
Prerequisites
- Docker and Docker Compose installed on your machine.
- Python 3.13 or higher installed.
- Required Python packages listed in
pyproject.toml.
Setup
-
Clone the repository to your local machine.
-
Install the required Python packages using Pip:
pip install .
or if you are using uv:
uv sync
-
Start the MinIO, MongoDB and Qdrant service using Docker Compose:
cd example docker compose up
Usage
-
Modify the configuration in
example/config.yamlas needed, especially the LLM settings.Note: we use the OpenAI-compatible models.
Here is an example configuration for the embedding and generation models:
rag: embedding_model: model_name: text-embedding-v4 api_base: https://dashscope.aliyuncs.com/compatible-mode/v1 api_key: <YOUR_API_KEY> generation_model: model_name: qwen3-next-80b-a3b-instruct api_base: https://dashscope.aliyuncs.com/compatible-mode/v1 api_key: <YOUR_API_KEY> other_parameters: is_chat_model: true
-
Start the RAG service by running the
example/main.pyscript:cd example python main.py
Test
-
The
test.pyfile contains simple tests for the RAG service functionalities. You can run it:python test.py
-
The
test_rag_service.pyfile contains unit tests for the RAG service. You can run it using pytest:python test_rag_service.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file demo_rag-0.0.1.tar.gz.
File metadata
- Download URL: demo_rag-0.0.1.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cd715552dd2e7c8e56c6e3379529e8eb94417578030ed018758195dcc4cc42d
|
|
| MD5 |
43e59db8e45cda3d7f367772df1ea5ba
|
|
| BLAKE2b-256 |
6ed6c248a621c761d1573c48960e0cc7498eeaddd30b54fd402c99e905d63bc2
|
File details
Details for the file demo_rag-0.0.1-py3-none-any.whl.
File metadata
- Download URL: demo_rag-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
519aafd26227b915243ca7cb93f798c932889ce1756d58f6105d21593535d2ab
|
|
| MD5 |
137c99d1d3e274542455de8e76b36a2e
|
|
| BLAKE2b-256 |
f94637a2c2cd6bed891682fec414ddd73305ff898e1b4e1435ea9c2b331e7d86
|