Match tool results' structure to that of prompts - #37
Merged
Conversation
Member
|
Pains me to see the version bump. Oh well. |
Member
Author
|
h/t Florian 😅 |
jspahrsummers
added a commit
that referenced
this pull request
Mar 12, 2025
Document `uv` as a prerequisite for the quickstart
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.
Tool results have suffered from being completely unstructured, which can make it hard for the client to integrate them into an LLM flow (for example—even just understanding whether they should be JSON stringified or treated as raw text).
I think this was not the case when we designed it originally, but now the Anthropic API requires structured tool results that include content blocks (like you would see during sampling).*
It's a bit of nice serendipity that we just aligned prompts with this format, and built in support for embedded resources. I see no reason not to do the same for tools too!
Unfortunately, this is a properly breaking change, so I'm revving the protocol version. However, servers and clients can still set and check the old
toolResultfield, for their own compatibility handling.* OpenAI's API only supports string results AFAICT, but content blocks can be broken down into strings more easily than the reverse.