Skip to content
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

emulated support for tool calls which return images #1058

Merged
merged 12 commits into from
Jan 1, 2025

Conversation

jjallaire
Copy link
Collaborator

Currently, the only provider that we know of that supports returning images from tool calls is Anthropic. This PR implements "emulated" support for tools which return images for other providers:

  1. Model APIs can now declare that they support returning images from tool calls by returning True for the tool_result_images property (Anthropic is the currently the only provider that does this).

  2. For other providers, if an tool call returns an image, text content of "Image content is in the message below." is substituted for the image, and an additional user message is appended that includes the image content.

In addition, we tweak the ToolResult type so it can return a ContentImage directly and improve Inspect View's handling of tool image results (formerly standard tool result truncation was applied, now images are always displayed in full).

@jjallaire jjallaire requested a review from dragonstyle January 1, 2025 15:33
@jjallaire jjallaire merged commit 637f8d5 into main Jan 1, 2025
10 checks passed
@jjallaire jjallaire deleted the feature/tool-result-images branch January 1, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant