Repository navigation
fix(engine): answer after the tool-call limit, and don't stop on a request - #174
Merged
Merged
Conversation
A call past tool_max_calls_per_turn got a reply saying only that it was not run, and the reply the assistant was then asked for without tools was often empty: the assistant had planned more calls and had no answer ready. The refusal now also asks the assistant to answer the user with the results it has. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
… more The early-stop check asked the summary model whether a user message ends the conversation, and a model sometimes said yes to a question, or to a message giving the details the assistant had asked for, so the conversation stopped with that message unanswered. A message holding a question mark now never ends a conversation and needs no model call, and the check's prompt says a message answering the assistant, or giving it the details, a choice or a correction it asked for, does not end it either. Signed-off-by: Yev Meyer <ymeyer@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
None.
What changed and why
Two fixes to the shared conversation loop, both about a turn ending without the answer the user asked for. One concern per commit.
tool_max_calls_per_turngot arole:"tool"reply saying only that it was not run, and the reply the assistant was then asked for without tools was often empty: it had planned more calls and had no answer ready, so the user got a blank turn. The refusal now reads "Not run: this turn reached its limit of N tool calls. Answer the user now with the results you have." (ToolExecutionMixin.after_assistant_turn), for every probe that uses the mixin's tool loop.architecture/probes.mdand the mixin's docstring say so._check_conversation_complete), and the prompt adds that a message answering the assistant's question, or giving it the details, a choice or a correction it asked for, does not end it even when it also thanks the assistant or says that is all it needs. Two test doubles whose scripted user asked a question while their summary model answered yes now script the request without a question mark, so they keep the flow they test.No probe's prompt version changes: both changes are in the shared loop, as with earlier loop changes.
How it was verified
New tests fail on the code before each change and pass after it: the refusal's text for a call past the limit (
test_probes_substrate.py); a question in English, French or Japanese not ending the conversation even when the summary model says yes, with no model call; and the prompt's new clause (test_engine_e2e.py).On every commit's own tree:
make check-all, the pre-commit hooks on the commit's files,pytest --collect-only(5273 and 5277 tests collected) and the engine and probe tests.At the head:
Live, against a custom provider config: the end-to-end health check with the
tool_callingprobe, in English; and the early-stop question, onmain's prompt and on this one, for user messages that ended conversations too soon in earlier runs and two that should end them, asked of the config's summary model and of a second model:Results impact
Conversations that reach the tool-call limit should end the turn with an answer rather than a blank reply, so turns that a judge or scorer marked down for an empty reply change. Fewer conversations stop on a user message that asks for something: one holding a question mark always continues, and a message that answers the assistant continues more often, though a model can still misjudge one without a question mark. Conversations run a turn longer where they used to stop on such a message, and
early_stopcounts move with them. A user's goodbye that also asks a question now continues one more turn.