File size: 369 Bytes
1beff3e
643a4d6
 
667929f
643a4d6
 
667929f
 
 
 
643a4d6
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI
from pydantic import BaseModel
from qabot import llm_chain

app = FastAPI()

@app.get("/")
def health_check():
    return {"status": "FastAPI is running!"}

class Query(BaseModel):
    query: str

@app.post("/ask")
def ask_question(query: Query):
    result = llm_chain.invoke({"query": query.query})
    return {"answer": result["result"]}