RayhanAdii/simple-rag-refactor

★ 0Forks 0PythonGitHub ↗Compare

README

Simple RAG Refactor

Name: Rayhan Adi Wicaksono

Design Decision

In this code, we try to modularize the code from single main.py file into modular project structure following best practice of FastAPI app. The structures is separated into below structure:

simple-rag-refactor/
│
├── main.py                         # ASGI entrypoint (app = create_app())
│
├── app/
│   ├── __init__.py                 # Application factory (create_app)
│   └── __pycache__/
│
├── api/
│   ├── routes.py                   # FastAPI routes (ask, add, status)
│   └── __pycache__/
│
├── core/
│   ├── qdrant_setup.py             # Qdrant initialization and configuration
│   └── __pycache__/
│
├── models/
│   ├── schemas.py                  # Pydantic request/response models
│   └── __pycache__/
│
├── services/
│   ├── document_store.py           # Qdrant and InMemory document stores
│   ├── embedding.py                # Embedding service abstraction
│   ├── rag_workflow.py             # RAG pipeline orchestration
│   └── __pycache__/
│
├── requirements.txt                # Python dependencies
├── README.md                       # Project documentation (The Explanation)
├── notes.md                        # Original readme
└── .gitignore

Trade-off Considered

The main trade-off is this structure is very scalable and maintainable for big project, but overkill for small project with only three endpoints such as this code. However, when the app is going bigger, this structure will improves scalability, maintainability, and testability.

Maintainability Improvements

  • Separation of each functionality, make it easier to understand.
  • Increased Scalability. Adding new routes and services can be added without modifying other functionality.
  • Main.py remains minimal.

Contributors

RayhanAdii

Issues