PsTuts-RAG / DEVELOPER.md
mbudisic's picture
chore: Reorganize dependencies structure and fix deptry configuration
059d9b6
|
raw
history blame
2.49 kB

πŸ› οΈ Developer Documentation

πŸ“¦ Project Structure

.
β”œβ”€β”€ app.py                # Main Chainlit application
β”œβ”€β”€ app_simple_rag.py     # Simplified RAG application 
β”œβ”€β”€ pyproject.toml        # Project configuration and dependencies
β”œβ”€β”€ pstuts_rag/           # Core package
β”‚   └── pstuts_rag/       # Source code
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ datastore.py  # Vector database management
β”‚       β”œβ”€β”€ loader.py     # Data loading utilities
β”‚       β”œβ”€β”€ rag.py        # RAG implementation
β”‚       β”œβ”€β”€ agents.py     # Team agent implementation
β”‚       └── ...
β”œβ”€β”€ data/                 # Dataset files
└── README.md             # User documentation

🧩 Dependency Structure

Dependencies are organized into logical groups:

  • Core: Basic dependencies needed for the RAG system (includes Jupyter support)
  • Dev: Development tools (linting, testing, etc.)
  • Web: Dependencies for web server functionality
  • Extras: Additional optional packages (numpy, ragas, tavily)

You can install different combinations using pip's extras syntax:

pip install -e ".[dev,web]"  # Install core + dev + web dependencies

πŸ”§ Technical Details

The application uses LangChain, LangGraph, and Chainlit to create an agentic RAG system:

Key Components

  • DatastoreManager: Manages the Qdrant vector store and document retrieval
  • RAGChainFactory: Creates retrieval-augmented generation chains
  • PsTutsTeamState: Manages the state of the agent-based system
  • Langgraph: Implements the routing logic between different agents

πŸš€ Running Locally

  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -e ".[dev]"  # Install with development tools
  1. Set up API keys:
export OPENAI_API_KEY="your-openai-key"
export TAVILY_API_KEY="your-tavily-key"  # Optional, for web search
  1. Run the application:
chainlit run app.py

πŸ§ͺ Code Quality

To check for dependency issues:

deptry .

For linting:

black .
ruff check .
mypy .

πŸ“š Resources