Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,7 +42,13 @@ def assistant(state: MessagesState):
|
|
| 42 |
class BasicAgent:
|
| 43 |
|
| 44 |
def __init__(self):
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
print("BasicAgent initialized.")
|
| 47 |
|
| 48 |
def __call__(self, question: str) -> str:
|
|
@@ -55,13 +61,7 @@ class BasicAgent:
|
|
| 55 |
return response
|
| 56 |
|
| 57 |
def _build_graph(self):
|
| 58 |
-
|
| 59 |
-
graph.add_node("assistant", assistant)
|
| 60 |
-
graph.add_node("tools", ToolNode(tools))
|
| 61 |
-
graph.add_edge(START, "assistant")
|
| 62 |
-
graph.add_conditional_edges("assistant", tools_condition)
|
| 63 |
-
graph.add_edge("tools", "assistant")
|
| 64 |
-
return graph.compile()
|
| 65 |
|
| 66 |
|
| 67 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 42 |
class BasicAgent:
|
| 43 |
|
| 44 |
def __init__(self):
|
| 45 |
+
graph = StateGraph(MessagesState)
|
| 46 |
+
graph.add_node("assistant", assistant)
|
| 47 |
+
graph.add_node("tools", ToolNode(tools))
|
| 48 |
+
graph.add_edge(START, "assistant")
|
| 49 |
+
graph.add_conditional_edges("assistant", tools_condition)
|
| 50 |
+
graph.add_edge("tools", "assistant")
|
| 51 |
+
self.graph = graph.compile()
|
| 52 |
print("BasicAgent initialized.")
|
| 53 |
|
| 54 |
def __call__(self, question: str) -> str:
|
|
|
|
| 61 |
return response
|
| 62 |
|
| 63 |
def _build_graph(self):
|
| 64 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|