from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Prompt(BaseModel): text: str @app.post("/chat") async def chat(prompt: Prompt): response = generate_response(prompt.text) return {"response": response}