Repository navigation
Conversation
getAttributesFromMessage wrote each toolResult block's toolUseId to the message-level tool_call_id and recorded none of its output, so a message with parallel tool results kept only the last id and no tool output. Record each toolResult as its own tool message with its id and its text and JSON output, as the Python instrumentor does since Arize-ai#3787. Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>
This branch has not been deployed
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.
Description
Refs #3786, which #3787 fixed in the Python package. In JS,
getAttributesFromMessage(attribute-helpers.ts:225) writes eachtoolResultblock'stoolUseIdto the message-leveltool_call_idand records none of the tool output. Two parallel tool results leave oneusermessage with the last id and no content:Each
toolResultbecomes its owntoolmessage, in order, as in_converse_attributes.pyand the spec's Tool Results, one id permessage.tool_call_id. Other content stays in the original message. Image and document blocks inside a result are skipped, as in Python. Changeset included.The cost: a message with several tool results takes several indices, so later messages shift and a saved query on
llm.input_messages.Ncan hit a different turn.Verification
Checklist:
hideInputMessagesandhideInputTextcover them.InvokeModel keeps each Anthropic
tool_resulttext, but itstool_call_idis last-wins too (invoke-model-request-attributes.ts:146-152). I'd fix that in a follow-up so this stays a port of #3787. @mikeldking, does that split work for you?