kostasang commited on
Commit
d43c51f
·
verified ·
1 Parent(s): 3f0af46

Upload agent.py

Browse files
Files changed (1) hide show
  1. src/agent.py +5 -1
src/agent.py CHANGED
@@ -89,7 +89,11 @@ class Agent:
89
  "callbacks": self.chat_model.callbacks
90
  }
91
  )
92
- reply = json.loads(final_state["messages"][-1].content)
 
 
 
 
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):