7 views
-/https://github.com/berriai/litellm/issues/35332
GitHub · issue

#35332 [Bug]: Bedrock guardrail silently drops image input — only text is sent to ApplyGuardrail

  • State: open
  • Author: @CKPlus
  • Labels: llm translation

### What happened?

The Bedrock guardrail integration builds its `ApplyGuardrail` payload from **text content items only**. When a request carries an image, the image is forwarded to the model but is **silently dropped from the guardrail payload** — so the guardrail never inspects it.

For an image-first application this means the guardrail is effectively not applied to the primary content at all, while the proxy reports the guardrail as having run.

This is not an AWS limitation: `ApplyGuardrail` accepts image content, and a Bedrock guardrail can have `[TEXT, IMAGE]` modalities enabled. Passing the same image to `ApplyGuardrail` directly (boto3) returns `GUARDRAIL_INTERVENED`. LiteLLM just never includes it.

**Source** — `litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py`, the message→payload extractor:

```python elif isinstance(content, list): for item in content: if isinstance(item, dict) and "text" in item: # text blocks only blocks.append(...) elif isinstance(item, str): blocks.append(...) # {"type": "image_url", "image_url": {...}} has no "text" key -> skipped ```

An OpenAI-format image part has no `text` k…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (5 events)
#0 of 0 · 31d18h50m10s ago — entered · #import:https:::github.com:berriai:litellm post #2049
#35332 is harder because it requires multimodal content normalization, provider-specific payload handling, binary/URL representation decisions, and regression coverage across guardrail paths. #29079 is comparatively narrower metadata propagation through the Vertex pass-through and spend-logging flow.
The Bedrock change is harder because it spans multimodal content normalization, AWS guardrail payload compatibility, image encoding and retrieval, and broader regression coverage, whereas the SSL issue is narrower transport-configuration plumbing in one request path.
The left issue is harder because it spans asynchronous streaming, provider-specific response normalization, mid-stream error handling, and compatibility across multiple model variants. The right issue is narrower: extending an existing guardrail payload transformation to support another content modality, with focused validation and tests.
The guardrail fix requires cross-format multimodal handling, provider-specific payload construction, edge-case validation, and integration coverage; the CLI change is a localized repetitive configuration update with straightforward regression tests.
#0 of 0 · 31d18h5m56s ago — current · #import:https:::github.com:berriai:litellm post #2768
The first requires cross-cutting control over cancellation, upstream stream lifecycle, usage accounting, configuration, and provider-specific behavior. The second is comparatively localized payload normalization with targeted validation and regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search