|
|
3 kuukautta sitten | |
|---|---|---|
| .github | 3 kuukautta sitten | |
| .kiro | 3 kuukautta sitten | |
| alembic | 3 kuukautta sitten | |
| doc | 3 kuukautta sitten | |
| docker | 3 kuukautta sitten | |
| docs | 3 kuukautta sitten | |
| examples | 3 kuukautta sitten | |
| scripts | 3 kuukautta sitten | |
| src | 3 kuukautta sitten | |
| tests | 3 kuukautta sitten | |
| .coveragerc | 3 kuukautta sitten | |
| .gitignore | 3 kuukautta sitten | |
| CHECKPOINT_1_VERIFICATION.md | 3 kuukautta sitten | |
| CI_CD_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| DEPLOYMENT_CHECKLIST.md | 3 kuukautta sitten | |
| FINAL_PROJECT_STATUS.md | 3 kuukautta sitten | |
| LOGGING_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| PERFORMANCE_BENCHMARK_SUMMARY.md | 3 kuukautta sitten | |
| PROJECT_COMPLETION_SUMMARY.md | 3 kuukautta sitten | |
| README.md | 3 kuukautta sitten | |
| REFACTORING_SUMMARY.md | 3 kuukautta sitten | |
| TASK_3.10_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_3.11_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_3.8_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.10_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.1_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.2_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.3_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.4_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| TASK_5.8_IMPLEMENTATION_SUMMARY.md | 3 kuukautta sitten | |
| alembic.ini | 3 kuukautta sitten | |
| benchmark_results_simulated.json | 3 kuukautta sitten | |
| codecov.yml | 3 kuukautta sitten | |
| coverage.json | 3 kuukautta sitten | |
| main.py | 3 kuukautta sitten | |
| pytest.ini | 3 kuukautta sitten | |
| requirements.txt | 3 kuukautta sitten | |
| requirements.txt.bak.1 | 3 kuukautta sitten | |
| test_logging_manual.py | 3 kuukautta sitten | |
| test_qa_workflow.py | 3 kuukautta sitten | |
| verification_report.txt | 3 kuukautta sitten |
A production-ready Retrieval-Augmented Generation (RAG) system built with FastAPI, featuring clean architecture, comprehensive testing, and CI/CD integration.
# Clone the repository
git clone https://github.com/YOUR_USERNAME/rag-system.git
cd rag-system
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run tests
pytest
# Start the application
python main.py
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Install development dependencies:
pip install pytest pytest-asyncio pytest-cov hypothesis httpx
pip install flake8 black isort mypy # For linting
pip install safety bandit # For security scanning
Set up pre-commit hooks (optional):
pip install pre-commit
pre-commit install
Configuration is managed through environment variables and the .env file.
Copy .env.example to .env and configure:
# Application
APP_NAME=RAG System
DEBUG=false
# Database
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=rag_system
DB_USERNAME=your_username
DB_PASSWORD=your_password
# Vector Database (infinity or elasticsearch)
VECTOR_DB_TYPE=infinity
# Infinity Configuration
INFINITY_HOST=localhost
INFINITY_PORT=23817
# Elasticsearch Configuration
ES_HOST=localhost
ES_PORT=9200
See Configuration Guide for detailed configuration options.
# Run all tests
pytest
# Run with coverage
pytest --cov=src --cov-report=html
# Run specific test types
pytest -m unit # Unit tests only
pytest -m integration # Integration tests only
pytest -m e2e # End-to-end tests only
# Run fast tests only
pytest -m "not slow"
# Run all tests with CI configuration
python scripts/run_tests.py
# Run with coverage report
python scripts/run_tests.py --coverage --html
# Run all checks (tests + lint + security)
python scripts/run_tests.py --all
# Run in parallel
python scripts/run_tests.py --parallel
# Run simulated performance test (quick)
python scripts/benchmark_simple.py
# Run real performance test (requires running server)
python main.py # In one terminal
python scripts/benchmark.py # In another terminal
See Performance Guide for detailed performance testing documentation.
Tests are organized by type:
tests/unit/: Fast, isolated unit teststests/integration/: Component interaction teststests/e2e/: Complete workflow testsSee Testing Guide for detailed testing documentation.
The project uses GitHub Actions for continuous integration and deployment.
Coverage reports are automatically uploaded to Codecov on every push.
Enable GitHub Actions: Already configured in .github/workflows/test.yml
Set up Codecov:
CODECOV_TOKEN to GitHub SecretsSee CI/CD Guide for detailed pipeline documentation.
The system follows a clean, layered architecture:
┌─────────────────────────────────────┐
│ Presentation Layer │ FastAPI routes, middleware
├─────────────────────────────────────┤
│ Application Layer │ Use cases, handlers, DTOs
├─────────────────────────────────────┤
│ Domain Layer │ Entities, value objects, services
├─────────────────────────────────────┤
│ Infrastructure Layer │ Databases, external services
└─────────────────────────────────────┘
rag_system/
├── src/
│ ├── domain/ # Domain layer (business logic)
│ ├── application/ # Application layer (use cases)
│ ├── infrastructure/ # Infrastructure layer (databases, APIs)
│ ├── presentation/ # Presentation layer (API routes)
│ ├── config/ # Configuration management
│ └── shared/ # Shared utilities
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
├── docs/ # Documentation
├── scripts/ # Utility scripts
└── docker/ # Docker configuration
See Architecture Documentation for detailed design information.
We welcome contributions! Please follow these guidelines:
git checkout -b feature/your-featurepython scripts/run_tests.py --allgit push origin feature/your-feature# Format code
black src tests
isort src tests
# Lint code
flake8 src tests
# Type check
mypy src
# Run all checks
python scripts/run_tests.py --all
Current coverage by layer:
| Layer | Target | Current |
|---|---|---|
| Domain Layer | 90% | TBD |
| Application Layer | 85% | TBD |
| Infrastructure Layer | 70% | TBD |
| Presentation Layer | 75% | TBD |
| Overall | 80% | TBD |
safetybanditReport security vulnerabilities to: security@example.com
This project is licensed under the MIT License - see the LICENSE file for details.
See Implementation Plan for detailed roadmap.
Built with ❤️ using Clean Architecture principles