(
self,
model: str,
file_path: str,
optional_payload: dict,
page_ranges: Optional[str] = None,
batch_id: Optional[str] = None,
)
| 106 | return extract_job_id(data) |
| 107 | |
| 108 | async def submit_file( |
| 109 | self, |
| 110 | model: str, |
| 111 | file_path: str, |
| 112 | optional_payload: dict, |
| 113 | page_ranges: Optional[str] = None, |
| 114 | batch_id: Optional[str] = None, |
| 115 | ) -> str: |
| 116 | if not os.path.exists(file_path): |
| 117 | raise FileNotFoundError(file_path) |
| 118 | |
| 119 | form = aiohttp.FormData() |
| 120 | form.add_field("model", model) |
| 121 | form.add_field("optionalPayload", json.dumps(optional_payload)) |
| 122 | if page_ranges is not None: |
| 123 | form.add_field("pageRanges", page_ranges) |
| 124 | if batch_id is not None: |
| 125 | form.add_field("batchId", batch_id) |
| 126 | |
| 127 | with open(file_path, "rb") as f: |
| 128 | file_data = f.read() |
| 129 | form.add_field( |
| 130 | "file", |
| 131 | file_data, |
| 132 | filename=os.path.basename(file_path), |
| 133 | ) |
| 134 | |
| 135 | await self._ensure_session() |
| 136 | async with self._session.post(self._jobs_url, data=form) as resp: |
| 137 | await self._raise_for_response(resp) |
| 138 | data = await self._response_data(resp) |
| 139 | return extract_job_id(data) |
| 140 | |
| 141 | async def get_job_status(self, job_id: str) -> Dict[str, Any]: |
| 142 | await self._ensure_session() |
nothing calls this directly
no test coverage detected