Mini RAG From A to Z is a FastAPI-based project that processes and manages project data. It includes functionalities for uploading files, processing file content into chunks, and storing these chunks in a MongoDB database.
- Upload files to specific projects
- Validate file types and sizes
- Process file content into manageable chunks
- Store project and chunk data in MongoDB
- Retrieve and manage project data
file:
## Project Structure
miniRag/
├── docker/
│ ├── .gitignore
│ └── docker-compose.yml
├── src/
│ ├── assets/
│ │ ├── .gitignore
│ │ ├── .gitkeep
│ │ └── adel.txt
│ ├── controllers/
│ │ ├── BaseController.py
│ │ ├── DataController.py
│ │ ├── ProcessController.py
│ │ ├── ProjectController.py
│ │ └── __init__.py
│ ├── helpers/
│ │ ├── __init__.py
│ │ └── config.py
│ ├── models/
│ │ ├── BaseDataModel.py
│ │ ├── ChunkModel.py
│ │ ├── ProjectModel.py
│ │ ├── __init__.py
│ │ ├── db_schemas/
│ │ │ ├── __init__.py
│ │ │ ├── data_chunk.py
│ │ │ └── project.py
│ │ ├── enums/
│ │ │ ├── DataBaseEnum.py
│ │ │ ├── ProcessingEnum.py
│ │ │ ├── ResponseEnum.py
│ │ │ └── __init__.py
│ ├── routes/
│ │ ├── base.py
│ │ ├── data.py
│ │ ├── schemas/
│ │ │ ├── __init__.py
│ │ │ └── data_schema.py
│ │ └── __init__.py
│ ├── .gitignore
│ ├── .gitkeep
│ ├── env.txt
│ ├── error.txt
│ ├── main.py
│ ├── requirements.txt
│ └── run.sh
├── LICENSE
└──
README.mdThis structure provides an overview of the project's organization, making it easier for contributors and users to navigate the codebase. This structure provides an overview of the project's organization, making it easier for contributors and users to navigate the codebase.
- Python 3.8+
- Docker
- MongoDB
-
Clone the repository:
git clone https://github.com/yourusername/miniRag.git cd miniRag -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r src/requirements.txt
-
Set up environment variables:
cp src/env.txt .env # Edit .env file with your configuration -
Start the MongoDB service using Docker:
cd docker cp env.txt .env docker-compose up -d
- And Update
.envfile with your credentials
-
Run the FastAPI application:
cd src ./run.sh -
Access the application at
http://localhost:5000.
- Home:
GET /api/v1/ - Upload Data:
POST /api/v1/data/upload/{project_id} - Process Data:
POST /api/v1/data/process/{project_id}
The application configuration is managed via environment variables defined in the .env file. Key settings include:
- APP_NAME
- APP_VERSION
- APP_PORT
- APP_HOST
- APP_URL
- OPENAI_API_KEY
- FILE_ALLOWED_TYPES
- FILE_MAX_SIZE
- FILE_DEFAULT_CHUNK_SIZE
- MONGODB_URL
- MONGODB_DATABASE
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the terms specified in the LICENSE file.
Special thanks to all contributors and open-source projects that made this project possible.