Skip to content

Anthropic tool response nested content blocks are stringified (no image response possible?) #1267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
indigoviolet opened this issue Mar 28, 2025 · 4 comments
Open
2 tasks done

Comments

@indigoviolet
Copy link

Initial Checks

Description

Anthropic supports image responses https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview#handling-tool-use-and-tool-result-content-blocks

But we're currently forcing the response to be a str (

content=request_part.model_response_str(),
), which means IIUC there's no way to return an image block?

Example Code

Python, Pydantic AI & LLM client version

3.12
0.0.46
Anthropic
@Wh1isper
Copy link
Contributor

Wh1isper commented Apr 2, 2025

I found this too. I think we might be able to use BinaryContent: #1339

@TheFirstMe
Copy link

I am having the same issue when using Claude from the Bedrock model.

@TheFirstMe
Copy link

I found this too. I think we might be able to use BinaryContent: #1339

#1517 adds support for multi-modal response from tools.

@Wh1isper
Copy link
Contributor

#1517 adds support for multi-modal response from tools.

Seems better, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants