(content: Any)
| 36 | |
| 37 | |
| 38 | def _content_to_text(content: Any) -> str: |
| 39 | if isinstance(content, list): |
| 40 | normalized = [ |
| 41 | part.model_dump_for_context() if isinstance(part, ContentPart) else part |
| 42 | for part in content |
| 43 | ] |
| 44 | return json.dumps(normalized, ensure_ascii=False) |
| 45 | if isinstance(content, ContentPart): |
| 46 | return json.dumps(content.model_dump_for_context(), ensure_ascii=False) |
| 47 | return str(content or "") |
| 48 | |
| 49 | |
| 50 | def _segment_content(seg: RoundSegment) -> Any: |
no test coverage detected