From 0d18ecc2ec8833a23dfeafdeb45b9f4f1c2f2534 Mon Sep 17 00:00:00 2001 From: cthomas Date: Fri, 5 Dec 2025 11:53:43 -0800 Subject: [PATCH] feat: add placeholder for image inputs in Anthropic proxy [LET-6449] (#6522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add [IMAGE] placeholder when extracting user messages with image content blocks - Allows LLM to know images were present in conversation history - LLM can infer context from surrounding text and conversation flow 🐙 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta --- letta/server/rest_api/routers/v1/anthropic.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/letta/server/rest_api/routers/v1/anthropic.py b/letta/server/rest_api/routers/v1/anthropic.py index 4fd003e2..3b08875c 100644 --- a/letta/server/rest_api/routers/v1/anthropic.py +++ b/letta/server/rest_api/routers/v1/anthropic.py @@ -34,8 +34,11 @@ def extract_user_messages(body: bytes) -> list[str]: user_messages.append(content) elif isinstance(content, list): for block in content: - if isinstance(block, dict) and block.get("type") == "text": - user_messages.append(block.get("text", "")) + if isinstance(block, dict): + if block.get("type") == "text": + user_messages.append(block.get("text", "")) + elif block.get("type") == "image": + user_messages.append("[IMAGE]") return user_messages except Exception as e: