added 10 as max thinking step limit

This commit is contained in:
tcsenpai 2024-09-17 19:13:37 +02:00
parent e216cf8568
commit 213bd49ce8

View File

@ -37,7 +37,7 @@ def generate_response(prompt, api_handler):
messages.append({"role": "assistant", "content": json.dumps(step_data)}) messages.append({"role": "assistant", "content": json.dumps(step_data)})
print("Next reasoning step: ", step_data["next_action"]) print("Next reasoning step: ", step_data["next_action"])
if step_data["next_action"].lower().strip() == "final_answer": if step_data["next_action"].lower().strip() == "final_answer" or step_count > 10: # Prevents infinite loops in case of errors.
break break
step_count += 1 step_count += 1