MariaFilipkowska commited on
Commit
60ba2a0
·
verified ·
1 Parent(s): 9d0474a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -150,7 +150,7 @@ system_prompt = SystemMessage(
150
  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. \
151
  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.\
152
  If the question refers to an external content and there is no reference file attached, perform a web search and retrieve relevant information from the internet. \
153
- Make sure that each final answer is preceded with 'FINAL ANSWER:' and is short: it should contain a number (without full stop at the end), a string (without full stop at the end) or a comma-separated list (without full stops at the end), nothing else. "
154
  )
155
 
156
  class BasicAgent:
@@ -161,7 +161,7 @@ class BasicAgent:
161
  print(f"Agent received question (first 50 chars): {question[:50]}...")
162
  message = HumanMessage(content=question)
163
  print(message)
164
- answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 10})['messages'][-1].content
165
  answer = "".join(re.findall(r'(FINAL ANSWER.*)', answer, flags=re.M))
166
  answer = answer.replace('FINAL ANSWER:', '')
167
  answer = answer.replace('FINAL ANSWER', '')
 
150
  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. \
151
  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.\
152
  If the question refers to an external content and there is no reference file attached, perform a web search and retrieve relevant information from the internet. \
153
+ Make sure that each final answer is preceded with 'FINAL ANSWER:' and is short: it should contain a number (without full stop at the end), a string (one or two words only, without full stop at the end) or a comma-separated list (without full stops at the end), nothing else. "
154
  )
155
 
156
  class BasicAgent:
 
161
  print(f"Agent received question (first 50 chars): {question[:50]}...")
162
  message = HumanMessage(content=question)
163
  print(message)
164
+ answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 4})['messages'][-1].content
165
  answer = "".join(re.findall(r'(FINAL ANSWER.*)', answer, flags=re.M))
166
  answer = answer.replace('FINAL ANSWER:', '')
167
  answer = answer.replace('FINAL ANSWER', '')