-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (41 loc) · 1.07 KB
/
Copy pathapp.py
File metadata and controls
46 lines (41 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from fastapi import FastAPI, Request
import uvicorn
from dotenv import load_dotenv
from pydantic import BaseModel
from supervisor_workflow import SupervisorWorkflow
load_dotenv()
app = FastAPI()
supervised_workflow = SupervisorWorkflow()
supervised_chain = supervised_workflow.gen_chain()
@app.get("/")
async def default():
return {
"data": {
"msg": "success"
}
}
# # TODO manage request body
# class SupervisorData(BaseModel):
# message: str
# user_id: str
# thread_id: str
#
# # TODO provide the thread_id and the user_id
# @app.post("/supervisor")
# async def supervisor(supervisor_request: SupervisorData):
# request_body = supervisor_request.model_dump()
# message = request_body["message"]
# reply = supervised_chain.invoke(
# message,
# {
# "recursion_limit": 150,
# "user_id": "restebance@gmail.com",
# "thread_id": "16"
# },
# )
# print(reply['response'])
# return {
# "data": {
# "message": reply['response']
# }
# }