(raw)
| 104 | |
| 105 | @staticmethod |
| 106 | def from_raw(raw): |
| 107 | if isinstance(raw, str): |
| 108 | return ToolResult(text=raw) |
| 109 | if isinstance(raw, dict): |
| 110 | return ToolResult( |
| 111 | text=str(raw.get('text', '')), |
| 112 | resources=raw.get('resources', []), |
| 113 | extra={ |
| 114 | k: v |
| 115 | for k, v in raw.items() if k not in ['text', 'resources'] |
| 116 | }) |
| 117 | raise TypeError('tool_call_result must be str or dict') |
no test coverage detected