giulia-fontanella commited on
Commit
e1488ab
·
verified ·
1 Parent(s): c043b2b

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +3 -12
agent.py CHANGED
@@ -57,23 +57,14 @@ class BasicAgent():
57
  You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
58
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
59
  """)
60
- print("Calling assistant with state: ", state["messages"])
61
- response = self.chat_with_tools.invoke(state["messages"])
62
-
63
- # updated_messages = [self.chat_with_tools.invoke([sys_msg] + state["messages"])]
64
 
65
  # Ensure the response is not None
66
  if response is None:
67
  raise RuntimeError("chat_with_tools.invoke returned None")
68
-
69
- # Ensure response is a list if expected
70
- if isinstance(response, list):
71
- updated_messages = response
72
- else:
73
- updated_messages = [response]
74
-
75
  return {
76
- "messages": updated_messages,
77
  }
78
 
79
 
 
57
  You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
58
  YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
59
  """)
60
+ response = self.chat_with_tools.invoke([sys_msg] + state["messages"])
 
 
 
61
 
62
  # Ensure the response is not None
63
  if response is None:
64
  raise RuntimeError("chat_with_tools.invoke returned None")
65
+
 
 
 
 
 
 
66
  return {
67
+ "messages": response,
68
  }
69
 
70