Spaces:
Runtime error
Runtime error
Salvatore Rossitto
commited on
Commit
·
1afdceb
1
Parent(s):
d25663a
added reasoning at max iterations
Browse files- RBotReloaded.py +9 -2
RBotReloaded.py
CHANGED
@@ -339,8 +339,15 @@ AI:
|
|
339 |
|
340 |
print(f"Action Output: {res}")
|
341 |
observations.append(f"Action Output: {res}")
|
342 |
-
prompt = prompt + f"Action: {tool.name}({action_input})\nSYS:{res}
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
else:
|
345 |
final_response = "\n*Reasoning: ".join(observations) + f"\n{output}" if len(observations) > 0 else f"\n{output}"
|
346 |
print(f"Final Anser: {final_response}")
|
|
|
339 |
|
340 |
print(f"Action Output: {res}")
|
341 |
observations.append(f"Action Output: {res}")
|
342 |
+
prompt = prompt + f"Action: {tool.name}({action_input})\nSYS:{res}"
|
343 |
+
if (i+1 == self.max_iterations):
|
344 |
+
print(f"MAX ITERATIONS REACHED. PLEASE PROVIDE A FINAL RESPONSE!")
|
345 |
+
prompt = prompt + "\nMAX ITERATIONS REACHED. PLEASE PROVIDE A FINAL RESPONSE!\nAI:"
|
346 |
+
output = str(self.llm(prompt,stop=["USER:","AI:","SYS:","[INST]","[/INST]"])).strip()
|
347 |
+
final_response = "\n*Reasoning: ".join(observations) + f"\n{output}" if len(observations) > 0 else f"\n{output}"
|
348 |
+
return { "output": final_response }
|
349 |
+
else:
|
350 |
+
prompt = prompt + "\nAI:"
|
351 |
else:
|
352 |
final_response = "\n*Reasoning: ".join(observations) + f"\n{output}" if len(observations) > 0 else f"\n{output}"
|
353 |
print(f"Final Anser: {final_response}")
|