Accumulate the conversation across multi-step tool-calling steps - #46
Closed
cwurm wants to merge 3 commits into
Closed
Accumulate the conversation across multi-step tool-calling steps#46cwurm wants to merge 3 commits into
cwurm wants to merge 3 commits into
Conversation
create_next_step_options was called with initial_options as the base, so every step's request contained only the original prompt plus the latest step's tool calls and results - the tool exchanges of all earlier steps were dropped. The model could never see two tool results at once: asked for information that requires several tool calls, it kept re-requesting the results it had just lost (e.g. alternating between the same two schema lookups) until max_steps was exhausted, without ever producing an answer. Base the next step on current_options, which carries the accumulated conversation, so each step sees all previous tool calls and results. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The test drives MultiStepCoordinator::execute_multi_step with a scripted generate function (no network) and asserts that the third step's request still contains the tool exchange of the first step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
Closing: this came out of working through pushing some older local changes upstream - the submodule pointer in ClickHouse/ClickHouse is still at ab06ef7, from before this was fixed on main in #40, so the bug was reproduced and fixed independently against the stale base. The remaining useful piece is bumping the submodule pointer in ClickHouse/ClickHouse to current main, which will happen separately. |
Member
Author
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.
create_next_step_optionswas called withinitial_optionsas the base, so every step's request contained only the original prompt plus the latest step's tool calls and results — the tool exchanges of all earlier steps were dropped.The model could therefore never see more than one tool result at a time: asked for something that requires several tool calls, it kept re-requesting the results it had just lost until
max_stepswas exhausted, without producing an answer.Observed in
clickhouse-clientAI SQL generation, where a question needing two table schemas made the model alternate between the same twoget_schema_for_tablecalls until the step limit:Base the next step on
current_options, which carries the accumulated conversation, so each step sees all previous tool calls and results.Added a regression test that drives
MultiStepCoordinator::execute_multi_stepwith a scripted generate function (no network) and asserts that the third step's request still contains the first step's tool exchange.