Fix basedpyright warnings in cacheable system blocks

This commit is contained in:
adavyas 2026-03-14 13:24:48 -07:00
parent 482bb6cb16
commit eebcbab170
1 changed files with 5 additions and 4 deletions

View File

@ -108,13 +108,14 @@ def _normalize_cacheable_system_content(content: Any) -> list[dict[str, Any]]:
if isinstance(content, list):
normalized_blocks: list[dict[str, Any]] = []
for block in content:
if not isinstance(block, dict):
for raw_block in cast(list[object], content):
if not isinstance(raw_block, dict):
continue
normalized_block = dict(block)
block = cast(dict[str, Any], raw_block)
normalized_block: dict[str, Any] = {**block}
if normalized_block.get("type") == "text":
normalized_block.setdefault(
normalized_block["cache_control"] = normalized_block.get(
"cache_control", {"type": "ephemeral"}
)
normalized_blocks.append(normalized_block)