Tool call ids and results referencing #97
Merged
+753
−206
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.
This PR enables AI to reference previous tool results in subsequent tool calls using
$tool_call_id`` syntax whentc_refs=True.Changes:
tc_refs=Falseparameter toChat.__init__— when enabled, initializesself.tc_res={}and appends syntax instructions to system prompttc_res_syspconstant — system prompt text explaining the$tool_call_id`` syntax with example_prep_tool_res()— prepends[tool_call_id: ...]text block to tool results so AI can see the ID_resolve_tool_refs()— parses tool arguments and replaces$id`` with actual stored results before calling function_lite_call_funcand_alite_call_func— stores raw results intc_resdict and calls_resolve_tool_refsfor reference resolutionNit
patch_litellmID generation — changed+/translation to__so IDs match Anthropic'ssrvtoolu_[a-zA-Z0-9_]+patternExample:
Fixes #95 and #96
Example test dialog: https://share.solve.it.com/d/72c67213c1cf5345698a8fb010505995