You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: before failing react loop ask LLM if it has the answer
With some models (and Ollama for example) we get stuck where
the model has the answer but won't call finalize. Before
failing due to iteration limit, ask the model if it has the
answer and if it responds True then use it.
Note: This is only done at the end of iterations because it is
questionable to penalize other models on each iteration. When
failure is the only option, it seems to be worth a try.
Fixes: #762
Signed-off-by: Mark Sturdevant <mark.sturdevant@ibm.com>
# Check for special case where model already has the answer, but it won't call the finalize tool.
120
+
# Instead of letting this run out of iterations and fail, let's ask.
121
+
# Only do this before we fail on iteration limit as a last resort because it's hard to justify doing it earlier for now.
122
+
elif-1<loop_budget<=turn_numandstep.value:
123
+
# If the turn number has reached the end of loop budget (and budget is not unlimited),
124
+
# then it's time to check if the model is just loopy and already has the answer.
125
+
print("### Done Check")
126
+
print("STEP_TOOL_CALLS:", step.tool_calls)
127
+
print("STEP:", step)
128
+
print("CONTEXT:", context)
129
+
content=mfuncs.chat(
130
+
content=f"Do you know the answer to the user's original query ({goal})? If so, respond with True. If you need to take more actions, then respond False.",
0 commit comments