Spaces:
Sleeping
Sleeping
| # Project Structure | |
| > **Primary Responsibility:** Directory layout and codebase organization | |
| Directory layout for the Enterprise AI Gateway. | |
| ``` | |
| Enterprise-AI-Gateway/ | |
| βββ src/ # Source code | |
| β βββ __init__.py | |
| β βββ main.py # FastAPI application entry point | |
| β βββ config.py # Configuration and LLM client | |
| β βββ api/ | |
| β β βββ routes.py # API route definitions | |
| β βββ llm/ | |
| β β βββ client.py # LLM provider client | |
| β βββ metrics/ | |
| β β βββ __init__.py # Metrics tracking | |
| β βββ models/ | |
| β β βββ __init__.py # Pydantic models | |
| β βββ providers/ | |
| β β βββ __init__.py # Provider configuration | |
| β βββ security/ | |
| β βββ __init__.py # Security utilities (auth, PII, toxicity) | |
| β | |
| βββ static/ | |
| β βββ index.html # Interactive demo dashboard | |
| β | |
| βββ tests/ | |
| β βββ __init__.py | |
| β βββ unit/ | |
| β β βββ test_security_models.py | |
| β βββ integration/ | |
| β βββ test_gateway.py | |
| β | |
| βββ docs/ # Documentation (MECE structure) | |
| β βββ README.md # Index + Quick Start | |
| β βββ api_reference.md # API endpoints & functions | |
| β βββ architecture.md # System design & data flow | |
| β βββ configuration.md # Environment variables | |
| β βββ deployment.md # Deployment procedures | |
| β βββ faq.md # Q&A format help | |
| β βββ project_structure.md # This file | |
| β βββ security_overview.md # Security architecture | |
| β βββ testing.md # Testing procedures | |
| β βββ troubleshooting.md # Problem resolution | |
| β | |
| βββ examples/ | |
| β βββ basic_usage.py # Usage examples | |
| β | |
| βββ scripts/ | |
| β βββ health_check.py # Health check script | |
| β | |
| βββ Dockerfile # Docker build configuration | |
| βββ requirements.txt # Python dependencies | |
| βββ README.md # Project overview (root) | |
| βββ BUSINESS_README.md # HuggingFace Spaces README | |
| ``` | |
| ## Key Directories | |
| ### `src/` - Source Code | |
| | Module | Purpose | | |
| |--------|---------| | |
| | `main.py` | FastAPI app initialization, middleware setup | | |
| | `config.py` | Environment config, LLM client initialization | | |
| | `api/routes.py` | HTTP endpoint handlers | | |
| | `llm/client.py` | Multi-provider LLM client with cascade | | |
| | `security/__init__.py` | Auth, PII detection, AI safety (Gemini + Lakera) | | |
| | `models/__init__.py` | Request/response Pydantic models | | |
| | `metrics/__init__.py` | Performance metrics tracking | | |
| | `providers/__init__.py` | Provider pricing and configuration | | |
| ### `static/` - Frontend | |
| Single-page interactive dashboard with: | |
| - Real-time pipeline visualization | |
| - Security gate status indicators | |
| - Rate limiting controls | |
| - Test scenario selector | |
| ### `tests/` - Test Suite | |
| | Directory | Purpose | | |
| |-----------|---------| | |
| | `unit/` | Unit tests for individual functions | | |
| | `integration/` | API endpoint integration tests | | |
| ### `docs/` - Documentation | |
| See [Documentation Index](README.md) for the complete MECE documentation structure. | |
| ## Data Flow | |
| ``` | |
| Request β src/main.py | |
| β | |
| src/security/ (auth, PII, toxicity check) | |
| β | |
| src/llm/client.py (provider cascade) | |
| β | |
| Response | |
| ``` | |
| ## Related Docs | |
| - [Architecture](architecture.md) - Detailed system design | |
| - [API Reference](api_reference.md) - Endpoint documentation | |
| - [Configuration](configuration.md) - Environment setup | |