from fastapi import FastAPI from pydantic import BaseModel from utils import chat_completion_request app = FastAPI() class ChatRequest(BaseModel): input_str: str @app.get("/") async def root(): return {"message": "PDF Chatbot API"} @app.post("/chat") async def submit_query(request: ChatRequest): chat_response = chat_completion_request(request.input_str) return {"role": "assistant", "content": chat_response}