Save doc task results to JSON (only for doc task). Supports both single result dict and list of results (from PDF).
(self, result, output_path: str)
| 264 | |
| 265 | # Additional methods for doc task |
| 266 | def save_to_json(self, result, output_path: str): |
| 267 | """Save doc task results to JSON (only for doc task). |
| 268 | Supports both single result dict and list of results (from PDF).""" |
| 269 | if self.task != 'doc': |
| 270 | raise RuntimeError("save_to_json is only available for 'doc' task") |
| 271 | if isinstance(result, list): |
| 272 | for page_result in result: |
| 273 | self.model.save_to_json(page_result, output_path) |
| 274 | else: |
| 275 | return self.model.save_to_json(result, output_path) |
| 276 | |
| 277 | def save_to_markdown(self, result, output_path: str): |
| 278 | """Save doc task results to Markdown (only for doc task). |
no outgoing calls