sam522 commited on
Commit
5b7afbf
·
1 Parent(s): bbf0eaf
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -88,4 +88,20 @@ def assistant(state: AgentState):
88
  ## The graph
89
  builder = StateGraph(AgentState)
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  demo.launch()
 
88
  ## The graph
89
  builder = StateGraph(AgentState)
90
 
91
+ # Define nodes: these do the work
92
+ builder.add_node("assistant", assistant)
93
+ builder.add_node("tools", ToolNode(tools))
94
+
95
+ # Define edges: these determine how the control flow moves
96
+ builder.add_edge(START, "assistant")
97
+ builder.add_conditional_edges(
98
+ "assistant",
99
+ # If the latest message requires a tool, route to tools
100
+ # Otherwise, provide a direct response
101
+ tools_condition,
102
+ )
103
+ builder.add_edge("tools", "assistant")
104
+ alfred = builder.compile()
105
+
106
+
107
  demo.launch()