anslem19/llm-fastapi-boilerplate
0
โก LLM FastAPI Boilerplate
A robust backend service for deploying GGUF language models using FastAPI and Docker.
๐ฏ Overview
This boilerplate provides a production-ready API for serving Large Language Models, with focus on type safety, easy deployment, and standardized interfaces.
โจ Key Features
- Type-Safe Backend: FastAPI with comprehensive request/response typing
- Model Support: GGUF format via
llama-cpp-python - Production Ready: CORS support, health checks, and Docker deployment
- Flexible: Configurable inference parameters (temperature, topp, topk)
- Developer Friendly: OpenAPI documentation included
๐ Project Structure
.
โโโ app/
โ โโโ main.py # FastAPI application and routes
โ โโโ schemas.py # Pydantic data models
โ โโโ llm_utils.py # LLM inference engine
โ โโโ __init__.py
โโโ requirements.txt # Dependencies
โโโ Dockerfile # Container configuration
โโโ README.md๐ Getting Started
Local Development
git clone https://github.com/Anslemakadu/llm-fastapi-boilerplate
cd llm-fastapi-boilerplate
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 7860API documentation available at: http://localhost:7860/docs
Docker Deployment
docker build -t llm-fastapi-boilerplate .
docker run -p 7860:7860 llm-fastapi-boilerplate๐ API Endpoints
โ๏ธ Configuration
๐ Example Usage
curl -X POST "https://anslem19-llm-fastapi-boilerplate.hf.space/chat" \
-H "Content-Type: application/json" \
-d '{
"session_id": "demo",
"message": "Hello LLM Boilerplate!"
}'๐ License
MIT License ยฉ 2025 Anslem Akadu
