-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
26 lines (21 loc) · 693 Bytes
/
app.py
File metadata and controls
26 lines (21 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from fastapi import FastAPI
from pydantic import BaseModel
from chain import run_langchain
from graph import run_langgraph
app = FastAPI(
title="LLM Multi-Agent API",
description="Chatbot API with LangChain and LangGraph endpoints.",
version="1.0.0"
)
class ChatRequest(BaseModel):
message: str
class ChatResponse(BaseModel):
response: str
@app.post("/chat/chain", response_model=ChatResponse)
async def chat_chain(req: ChatRequest):
reply = run_langchain(req.message)
return {"response": reply}
@app.post("/chat/graph", response_model=ChatResponse)
async def chat_graph(req: ChatRequest):
reply = run_langgraph(req.message)
return {"response": reply}