(path: Path)
| 141 | |
| 142 | |
| 143 | def image_part_from_path(path: Path) -> dict[str, Any]: |
| 144 | mime_type, _ = mimetypes.guess_type(str(path)) |
| 145 | encoded = base64.b64encode(path.read_bytes()).decode("ascii") |
| 146 | return { |
| 147 | "type": "input_image", |
| 148 | "image_url": f"data:{mime_type or 'image/png'};base64,{encoded}", |
| 149 | "detail": "high", |
| 150 | } |
| 151 | |
| 152 | |
| 153 | def _safe_int(value: Any) -> int: |
no outgoing calls
no test coverage detected