A simple FastAPI backend for LLM-based features.
The project has a clean API route, request validation, environment configuration, and an LLM service layer. If no API key is available, it returns a demo response so the backend can still be tested locally.
- FastAPI
/generateendpoint - request and response models
- optional OpenAI API support
- demo mode without an API key
- simple health check route
- Dockerfile included
- Python
- FastAPI
- Pydantic
- OpenAI API optional
- Docker
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtCreate .env if using OpenAI:
OPENAI_API_KEY=your_api_key_hereuvicorn app.main:app --reloadOpen:
http://127.0.0.1:8000/docs
{
"prompt": "Explain embeddings in simple words",
"temperature": 0.3
}