(message: dict[str, Any])
| 476 | |
| 477 | |
| 478 | def _message_text(message: dict[str, Any]) -> str: |
| 479 | content = message.get("content") |
| 480 | if isinstance(content, str): |
| 481 | return content |
| 482 | if isinstance(content, list): |
| 483 | parts: list[str] = [] |
| 484 | for item in content: |
| 485 | if isinstance(item, dict) and item.get("type") in {"text", "input_text"}: |
| 486 | parts.append(str(item.get("text", ""))) |
| 487 | return "\n".join(part for part in parts if part) |
| 488 | return str(content or "") |
| 489 | |
| 490 | |
| 491 | def _as_int(value: Any) -> int: |
no test coverage detected