|
14 | 14 |
|
15 | 15 | from typing_extensions import TypedDict |
16 | 16 |
|
| 17 | +from nutrient_dws.types.extraction_credits import ExtractionCredits |
| 18 | + |
17 | 19 | # ---- Request types -------------------------------------------------------- |
18 | 20 |
|
19 | 21 | ParseMode = Literal["text", "structure", "understand", "agentic"] |
@@ -58,7 +60,14 @@ class ParseInstructions(TypedDict, total=False): |
58 | 60 |
|
59 | 61 |
|
60 | 62 | class ParseBounds(TypedDict): |
61 | | - """Axis-aligned bounding box, in the page's coordinate space.""" |
| 63 | + """Axis-aligned bounding box on the page. |
| 64 | +
|
| 65 | + `(x, y)` is the **top-left corner** of the box. The page's coordinate |
| 66 | + origin is the top-left, with `x` increasing to the right and `y` |
| 67 | + increasing downward. Units are pixels in the same canvas described by |
| 68 | + `ParsePageRef.width` and `ParsePageRef.height` (i.e. element bounds and |
| 69 | + the page dimensions share one coordinate space). |
| 70 | + """ |
62 | 71 |
|
63 | 72 | x: float |
64 | 73 | y: float |
@@ -285,26 +294,18 @@ class ParseConfiguration(TypedDict, total=False): |
285 | 294 | outputFormat: ParseOutputFormat |
286 | 295 |
|
287 | 296 |
|
288 | | -class ParseExtractionCredits(TypedDict, total=False): |
289 | | - """Credit accounting for this request. |
290 | | -
|
291 | | - `cost` is in **extraction credits** (NOT processor API credits) and |
292 | | - `remainingCredits` is the remaining balance in the same bucket. |
293 | | - """ |
294 | | - |
295 | | - cost: float |
296 | | - remainingCredits: float |
297 | | - |
298 | | - |
299 | 297 | class ParseUsage(TypedDict, total=False): |
300 | 298 | """Wraps the extraction-credit accounting under its wire key. |
301 | 299 |
|
302 | 300 | The server uses the snake_case key `data_extraction_credits` here even |
303 | 301 | though every other field in the response is camelCase; the TypedDict |
304 | | - mirrors the wire format verbatim. |
| 302 | + mirrors the wire format verbatim. The inner `ExtractionCredits` type |
| 303 | + lives in `nutrient_dws.types.extraction_credits` because the same |
| 304 | + credit-accounting shape will surface on future endpoints that bill |
| 305 | + against the extraction-credits bucket. |
305 | 306 | """ |
306 | 307 |
|
307 | | - data_extraction_credits: ParseExtractionCredits |
| 308 | + data_extraction_credits: ExtractionCredits |
308 | 309 |
|
309 | 310 |
|
310 | 311 | class ParseFailingPath(TypedDict, total=False): |
|
0 commit comments