[PR #23189] [CLOSED] feat: support additional Anthropic tool_result content types #65926

Closed
opened 2026-05-06 11:59:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23189
Author: @Classic298
Created: 3/28/2026
Status: Closed

Base: devHead: anthropic


📝 Commits (4)

  • 4b9443b Update anthropic.py
  • 93186ba Update main.py
  • 5ac3930 fix: strict image source validation, catch all conversion errors as 400
  • 8768a90 fix: validate required image fields, narrow exception catch to preserve 500s for real bugs

📊 Changes

2 files changed (+97 additions, -29 deletions)

View changed files

📝 backend/open_webui/main.py (+5 -1)
📝 backend/open_webui/utils/anthropic.py (+92 -28)

📄 Description

Adds support for images and string content in Anthropic tool_result blocks, and explicit errors for unsupported types (search_result, document).

Images use the existing input_text/input_image multimodal tool message pattern from utils/misc.py, which the middleware already handles for downstream providers.

Also extracts a _convert_anthropic_image_source helper to DRY up image conversion, and adds HTTP 400 error handling for conversion failures.

Based on the work in #23004 by @regulad.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23189 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 3/28/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `anthropic` --- ### 📝 Commits (4) - [`4b9443b`](https://github.com/open-webui/open-webui/commit/4b9443b3f384eabc2abde84e7c0013b4d046b596) Update anthropic.py - [`93186ba`](https://github.com/open-webui/open-webui/commit/93186ba02c46d2dd5c70a6477437ae75ce445831) Update main.py - [`5ac3930`](https://github.com/open-webui/open-webui/commit/5ac3930c987fe87e6831cc94cde5b0b1499bdd40) fix: strict image source validation, catch all conversion errors as 400 - [`8768a90`](https://github.com/open-webui/open-webui/commit/8768a909c09937361f5e6559e022af63eaa13190) fix: validate required image fields, narrow exception catch to preserve 500s for real bugs ### 📊 Changes **2 files changed** (+97 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/main.py` (+5 -1) 📝 `backend/open_webui/utils/anthropic.py` (+92 -28) </details> ### 📄 Description Adds support for images and string content in Anthropic tool_result blocks, and explicit errors for unsupported types (search_result, document). Images use the existing input_text/input_image multimodal tool message pattern from utils/misc.py, which the middleware already handles for downstream providers. Also extracts a _convert_anthropic_image_source helper to DRY up image conversion, and adds HTTP 400 error handling for conversion failures. Based on the work in #23004 by @regulad. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [X] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 11:59:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#65926