Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent/bedrock_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def _convert_content_to_converse(content) -> List[Dict]:
blocks.append({"text": text if text else " "})
elif part_type == "image_url":
image_url = part.get("image_url", {})
url = image_url.get("url", "") if isinstance(image_url, dict) else ""
url = (image_url.get("url") or "") if isinstance(image_url, dict) else ""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This coalesces None, but truthy non-string values remain unchanged: {"url": 123} still reaches url.startswith(...) below and raises AttributeError. #55686 explicitly includes non-string URLs; normalize by type before the prefix check and add that regression case.

if url.startswith("data:"):
# data:image/jpeg;base64,/9j/4AAQ...
header, _, data = url.partition(",")
Expand Down Expand Up @@ -1145,7 +1145,7 @@ def discover_bedrock_models(

# Only include active, streaming-capable, text-output models
lifecycle = summary.get("modelLifecycle", {})
if lifecycle.get("status", "").upper() != "ACTIVE":
if (lifecycle.get("status") or "").upper() != "ACTIVE":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This protects a null status, but not a present modelLifecycle=None: the assignment above leaves lifecycle as None and .get(...) still raises. If this extra hardening remains, normalize the containing lifecycle value as well and add a regression test.

continue
if not summary.get("responseStreamingSupported", False):
continue
Expand Down