ai-hub | 10 days ago | ||
.gitignore | 11 days ago | ||
KickoffPlan.md | 12 days ago | ||
README.md | 11 days ago |
Cortex Hub is a modular and scalable API service designed to act as a central gateway to various Large Language Models (LLMs). It features a stateful, session-based chat system with conversational memory, powered by a Retrieval-Augmented Generation (RAG) pipeline for grounding responses in your own data.
You can run the entire application stack (API server and database) using Docker Compose.
The application is configured using a .env
file for secrets and a config.yaml
for non-sensitive settings.
First, copy the example environment file:
cp .env.example .env
Now, open the .env
file and add your secret API keys:
# .env DEEPSEEK_API_KEY="your_deepseek_api_key_here" GEMINI_API_KEY="your_gemini_api_key_here"
(You only need to provide a key for the model you intend to use.)
This is the simplest way to get the service running.
docker-compose up --build
The API server will be available at http://127.0.0.1:8000
.
If you prefer to run without Docker:
# Install dependencies pip install -r requirements.txt # Run the server uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload
The easiest way to interact with the service is by using the provided chat script. It handles starting the server, creating a session, and managing the conversation.
In your terminal, simply run:
bash run_chat.sh
You will be prompted to enter your questions in a continuous loop. Type exit
to end the session and shut down the server.
Once the server is running, interactive API documentation (powered by Swagger UI) is automatically available at:
The project includes a comprehensive test suite using pytest
.
These tests cover individual components in isolation and use mocks for external services and the database.
pytest tests/
These tests run against a live instance of the server to verify the end-to-end functionality of the API. The script handles starting and stopping the server for you.
bash run_integration_tests.sh
The project follows a standard, scalable structure for modern Python applications.
. โโโ app/ # Main application package โ โโโ api/ # API layer: routes, schemas, dependencies โ โโโ core/ # Core business logic: services, pipelines, providers โ โโโ db/ # Database layer: models, session management โ โโโ app.py # FastAPI application factory โ โโโ main.py # Application entry point โโโ config.yaml # Default configuration โโโ data/ # Persistent data (SQLite DB, FAISS index) โโโ integration_tests/ # End-to-end tests โโโ tests/ # Unit tests โโโ Dockerfile โโโ docker-compose.yml