Untitled
unknown
plain_text
9 months ago
986 B
3
Indexable
## FIRST API CALL to Initiate and Build the Graph:
@main_router.put("/init_workflow/")
async def init_workflow(request: Request):
try:
body = await request.json()
device = body["device"]
init_state = body["init_state"]
print(device)
print(init_state)
graph = build_graph(device=device)
if graph is None:
raise Exception("Graph is not built. Please check your RAG Docs or DB.")
StateStore.graph = graph
StateStore.latest_agent_state = AgentState(device=device, state_summary=init_state, api_request="", response="")
# StateStore.latest_agent_state["state_summary"] = state_summary_3 # Just for unit testing !
StateStore.list_agent_states = [StateStore.latest_agent_state]
return "LangGraph successfully built and saved in App State Manager."
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))Editor is loading...
Leave a Comment