Skip to main content

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

  1. Clone the repository to your local machine.

  2. Install the required Python packages using Pip:

    pip install .
    

    or if you are using uv:

     uv sync
    
  3. Start the MinIO, MongoDB and Qdrant service using Docker Compose:

    cd example
    docker compose up
    

Usage

  1. Modify the configuration in example/config.yaml as 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
    
  2. Start the RAG service by running the example/main.py script:

    cd example
    python main.py
    

Test

  • The test.py file contains simple tests for the RAG service functionalities. You can run it:

     python test.py
    
  • The test_rag_service.py file contains unit tests for the RAG service. You can run it using pytest:

     python test_rag_service.py
    

Metadata

Release files for demo-rag 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demo-rag 0.0.1
File Size Uploaded
demo_rag-0.0.1.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for demo-rag 0.0.1
File Interpreter ABI Platform
demo_rag-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / demo_rag-0.0.1.tar.gz

Download URL demo_rag-0.0.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9cd715552dd2e7c8e56c6e3379529e8eb94417578030ed018758195dcc4cc42d
BLAKE2b-256 checksum
How to use checksums
6ed6c248a621c761d1573c48960e0cc7498eeaddd30b54fd402c99e905d63bc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / demo_rag-0.0.1-py3-none-any.whl

Download URL demo_rag-0.0.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
519aafd26227b915243ca7cb93f798c932889ce1756d58f6105d21593535d2ab
BLAKE2b-256 checksum
How to use checksums
f94637a2c2cd6bed891682fec414ddd73305ff898e1b4e1435ea9c2b331e7d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page