| from fastapi import FastAPI |
| from fastapi.responses import HTMLResponse |
| from pydantic import BaseModel |
| from typing import List |
|
|
| from main import run_conversation_pipeline |
|
|
|
|
| |
| |
| |
|
|
| app = FastAPI( |
| title="SHL Assessment Recommendation Agent", |
| version="1.0.0" |
| ) |
|
|
|
|
| |
| |
| |
|
|
| class Message(BaseModel): |
| role: str |
| content: str |
|
|
|
|
| class ChatRequest(BaseModel): |
| messages: List[Message] |
|
|
|
|
| |
| |
| |
| @app.get("/", response_class=HTMLResponse) |
| async def root(): |
| with open( "templates/home.html", "r", encoding="utf-8" ) as f: |
| return f.read() |
|
|
|
|
| |
| |
| |
|
|
| @app.get("/health") |
| async def health(): |
|
|
| return { |
| "status": "ok" |
| } |
|
|
|
|
| |
| |
| |
|
|
| @app.post("/chat") |
| async def chat(req: ChatRequest): |
|
|
| response = run_conversation_pipeline( |
| messages=req.messages |
| ) |
|
|
| return response |
|
|