feat: add placeholder for image inputs in Anthropic proxy [LET-6449] (#6522)
- 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 <noreply@letta.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user