Skip to content

awaiscom02/fastapi-llm-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI LLM Backend

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.

Features

  • FastAPI /generate endpoint
  • request and response models
  • optional OpenAI API support
  • demo mode without an API key
  • simple health check route
  • Dockerfile included

Tech Stack

  • Python
  • FastAPI
  • Pydantic
  • OpenAI API optional
  • Docker

Setup

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

Create .env if using OpenAI:

OPENAI_API_KEY=your_api_key_here

Run

uvicorn app.main:app --reload

Open:

http://127.0.0.1:8000/docs

Example Request

{
  "prompt": "Explain embeddings in simple words",
  "temperature": 0.3
}

About

FastAPI backend template for LLM-powered features

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors