Skip to content

keep images in tool responses#967

Open
eligotts wants to merge 1 commit intomainfrom
eli/fix-strip-images-from-tool
Open

keep images in tool responses#967
eligotts wants to merge 1 commit intomainfrom
eli/fix-strip-images-from-tool

Conversation

@eligotts
Copy link
Contributor

@eligotts eligotts commented Feb 28, 2026

Description

we were stripping images from tool responses. this fixes that

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes


Note

Medium Risk
Changes how ToolMessage content is serialized for the OpenAI Chat Completions API; if any downstream model/provider expects tool content to be plain text, this could cause request validation or behavior differences.

Overview
Stops coercing ToolMessage content to plain text when building Chat Completions prompts, and instead passes through normalized structured content (e.g., image parts) just like other message roles.

This fixes tool responses losing non-text payloads during prompt serialization in OpenAIChatCompletionsClient.to_native_prompt.

Written by Cursor Bugbot for commit f971ffa. This will update automatically on new commits. Configure here.

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