Skip to content

Commit

Permalink
Merge pull request #877 from WolframResearch/876-the-syntax-for-disca…
Browse files Browse the repository at this point in the history
…rding-bad-tool-calls-can-be-incorrectly-parsed-as-a-tool-call

Bugfix: Fixed a regression leading to internal failures when parsing discarded tool calls
  • Loading branch information
rhennigan authored Nov 1, 2024
2 parents a8bbb49 + 2c6f479 commit 8e68bdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Chatbook/Formatting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ $textDataFormatRules = {
Longest @ StringExpression[
(("```" ~~ Except[ "\n" ]... ~~ (" "...) ~~ "\n"))|"",
tool: $$simpleToolCall
] :> inlineToolCallCell @ tool
] /; ! StringStartsQ[ tool, $$ws ~~ "/retry" ~~ $$eol ] :> inlineToolCallCell @ tool
,
StartOfLine ~~ "/retry" ~~ (WhitespaceCharacter|EndOfString) :> $discardPreviousToolCall
,
Expand Down Expand Up @@ -1356,7 +1356,7 @@ parsePartialToolCallString // beginDefinition;
(* TODO: define a `parsePartialSimpleToolCallString` that can also be used in `simpleToolRequestParser` *)

parsePartialToolCallString[ string_String ] /; $simpleToolMethod := Enclose[
Module[ { command, argString, tool, name, paramNames, argStrings, padded, params, result },
Module[ { command, argString, tool, name, paramNames, params, result },
command = ConfirmBy[
StringReplace[
string,
Expand Down

0 comments on commit 8e68bdb

Please sign in to comment.