Spaces:
Sleeping
Sleeping
Upload agent.py
Browse files- src/agent.py +3 -2
src/agent.py
CHANGED
|
@@ -46,7 +46,7 @@ class Agent:
|
|
| 46 |
)
|
| 47 |
self.graph = self.__build_graph()
|
| 48 |
|
| 49 |
-
def __call__(self, question: str) -> str:
|
| 50 |
"""
|
| 51 |
Reply to a question using the agent and return the agents full reply
|
| 52 |
with reasoning included.
|
|
@@ -64,7 +64,8 @@ class Agent:
|
|
| 64 |
"callbacks": self.chat_model.callbacks
|
| 65 |
}
|
| 66 |
)
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
def __build_graph(self):
|
| 70 |
"""
|
|
|
|
| 46 |
)
|
| 47 |
self.graph = self.__build_graph()
|
| 48 |
|
| 49 |
+
def __call__(self, question: str) -> tuple[str, str]:
|
| 50 |
"""
|
| 51 |
Reply to a question using the agent and return the agents full reply
|
| 52 |
with reasoning included.
|
|
|
|
| 64 |
"callbacks": self.chat_model.callbacks
|
| 65 |
}
|
| 66 |
)
|
| 67 |
+
reply = json.loads(final_state["messages"][-1].content)
|
| 68 |
+
return reply["reasoning"], reply["answer"]
|
| 69 |
|
| 70 |
def __build_graph(self):
|
| 71 |
"""
|