Spaces:
Sleeping
Sleeping
Upload agent.py
Browse files- src/agent.py +5 -1
src/agent.py
CHANGED
|
@@ -89,7 +89,11 @@ class Agent:
|
|
| 89 |
"callbacks": self.chat_model.callbacks
|
| 90 |
}
|
| 91 |
)
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
return reply["reasoning"], reply["answer"]
|
| 94 |
|
| 95 |
def __build_graph(self):
|
|
|
|
| 89 |
"callbacks": self.chat_model.callbacks
|
| 90 |
}
|
| 91 |
)
|
| 92 |
+
content: str = final_state["messages"][-1].content
|
| 93 |
+
if content.startwith("```json"):
|
| 94 |
+
# If the reply starts with a code fence, remove it
|
| 95 |
+
content = content[7:-3]
|
| 96 |
+
reply = json.loads(content)
|
| 97 |
return reply["reasoning"], reply["answer"]
|
| 98 |
|
| 99 |
def __build_graph(self):
|