anyformat 2.2.0__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {anyformat-2.2.0 → anyformat-2.3.0}/PKG-INFO +1 -1
  2. {anyformat-2.2.0 → anyformat-2.3.0}/pyproject.toml +1 -1
  3. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/results.py +71 -6
  4. {anyformat-2.2.0 → anyformat-2.3.0}/README.md +0 -0
  5. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/__init__.py +0 -0
  6. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/_banner.py +0 -0
  7. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/_http.py +0 -0
  8. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/_source.py +0 -0
  9. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/_viz.py +0 -0
  10. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/builder.py +0 -0
  11. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/cli.py +0 -0
  12. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/client.py +0 -0
  13. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/errors.py +0 -0
  14. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/handles.py +0 -0
  15. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/result.py +0 -0
  16. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/sdk/views.py +0 -0
  17. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/__init__.py +0 -0
  18. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/builder.py +0 -0
  19. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/checks.py +0 -0
  20. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/definition.py +0 -0
  21. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/fields.py +0 -0
  22. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/nodes.py +0 -0
  23. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/schema.py +0 -0
  24. {anyformat-2.2.0 → anyformat-2.3.0}/src/anyformat/workflow/topology.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: anyformat
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Python SDK for the AnyFormat API
5
5
  Project-URL: Homepage, https://anyformat.ai
6
6
  Project-URL: Documentation, https://docs.anyformat.ai
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "anyformat"
3
- version = "2.2.0"
3
+ version = "2.3.0"
4
4
  description = "Python SDK for the AnyFormat API"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -89,11 +89,23 @@ class Evidence(BaseModel):
89
89
  "block of the packet's parse."
90
90
  ),
91
91
  )
92
+ cell_ids: Optional[list[str]] = Field(
93
+ default=None,
94
+ description=(
95
+ "The table cells of `block_id` the value was read from, each as `<block_id>.r<row>c<col>`: the block's "
96
+ "id and a cell id as its `rows` name it. The one cell the value came from when it is known, otherwise "
97
+ "every cell the snippet cites, which can be its whole row. They are the extraction's citation, not "
98
+ "checked against the block's table, and `bbox` can be the box of another row when the cited row did not "
99
+ "hold the value. Absent when the snippet cites no cell, when `block_id` is absent, and for a run saved "
100
+ "before cell ids were kept that named no single cell."
101
+ ),
102
+ examples=[["p3_b0.r1c2"]],
103
+ )
92
104
 
93
105
  @model_serializer(mode="wrap")
94
106
  def _omit_unset_locators(self, handler: SerializerFunctionWrapHandler): # noqa: ANN202 — pydantic reads a return annotation as the serialization schema
95
107
  data = _drop_unset_file_refs(handler(self))
96
- for key in ("bbox", "block_id"):
108
+ for key in ("bbox", "block_id", "cell_ids"):
97
109
  if data.get(key) is None:
98
110
  data.pop(key, None)
99
111
  return data
@@ -439,6 +451,57 @@ class RunParseLayerLink(BaseModel):
439
451
  size_bytes: int = Field(description="The object's size as stored, gzipped.")
440
452
 
441
453
 
454
+ class RunParseTableCell(BaseModel):
455
+ """One table cell as table grounding mapped it onto the page."""
456
+
457
+ id: str = Field(
458
+ description="`r<row>c<col>`, the grid row and column it starts at across its block's tables; unique within its block only."
459
+ )
460
+ text: str = Field(description="The cell's text, as the table's markup gives it.")
461
+ bbox: Optional[dict[str, float]] = Field(
462
+ description=(
463
+ "Normalised bounding box in [0, 1] page coordinates with keys `x0`/`y0`/`x1`/`y1`, as grounding mapped it, "
464
+ "unchecked against the page; `null` when grounding found none."
465
+ ),
466
+ )
467
+ match: Optional[str] = Field(
468
+ description="How grounding placed it, such as `anchor` or `orphan_spatial`; `null` when it matched nothing."
469
+ )
470
+ parse_confidence: Optional[float] = Field(description="0-100, on its block's scale; `null` when nothing scored it.")
471
+
472
+
473
+ class RunParseLink(BaseModel):
474
+ """One link annotation of the page that lies over its block."""
475
+
476
+ uri: str = Field(description="The link's target, as the PDF names it.")
477
+ bbox: dict[str, float] = Field(
478
+ description="The annotation's normalised bounding box in [0, 1] page coordinates with keys `x0`/`y0`/`x1`/`y1`.",
479
+ )
480
+
481
+
482
+ class RunParseV3Block(Block):
483
+ """A block of one parse of a run, with the cells grounding stored for it."""
484
+
485
+ bbox: Optional[dict[str, float]] = Field(
486
+ description=(
487
+ "Normalised bounding box in [0, 1] page coordinates with keys `x0`/`y0`/`x1`/`y1`; `null` for a block "
488
+ "with no page geometry, such as one of a spreadsheet, a CSV or a text file."
489
+ ),
490
+ )
491
+
492
+ cells: list[RunParseTableCell] = Field(
493
+ default_factory=list,
494
+ description="Each cell of a table block, as its packet parse stored it; empty on any other block, and when the parse is read from its files' own parses instead.",
495
+ )
496
+ links: list[RunParseLink] = Field(
497
+ default_factory=list,
498
+ description=(
499
+ "Each link annotation of a PDF page that lies over the block, once, as its packet parse stored it; empty "
500
+ "when the parse is read from its files' own parses instead."
501
+ ),
502
+ )
503
+
504
+
442
505
  class RunParseV3(ParseResult):
443
506
  """One parse of a run: the parse node that read the packet, and what it read, as the anchored markdown and its blocks.
444
507
 
@@ -464,18 +527,20 @@ class RunParseV3(ParseResult):
464
527
  "their node."
465
528
  ),
466
529
  )
467
- is_entry: bool = Field(description="Whether this is the run's entry parse, the one every run starts with.")
468
- read_by_extraction: bool = Field(
469
- description="Whether an extraction of the run read this parse: the nearest parse upstream of its extract node.",
470
- )
471
530
  layers: Optional[dict[str, RunParseLayerAbsence]] = Field(
472
531
  default=None,
473
532
  description=(
474
533
  "Each layer the parse stored without its object, by name, with the reason, and each layer asked for that "
475
- "the read could not serve; any other stored layer is not listed. `null` when the run stored no listing of this node's packet parse, as for a parse stored before "
534
+ "the read could not serve; any other stored layer is not listed. A parse with a file parsed by a tier that "
535
+ "measures neither `sequences` nor `elements` (`lite`) lists both as `not_for_tier`, whatever it stored. "
536
+ "Otherwise `null` when the run stored no listing of this node's packet parse, as for a parse stored before "
476
537
  "listings were."
477
538
  ),
478
539
  )
540
+ blocks: list[RunParseV3Block] = Field(
541
+ default_factory=list,
542
+ description="Each block, in packet page and reading order, with its table cells.",
543
+ )
479
544
  sequences: Optional[list[RunParseSequence]] = Field(
480
545
  default=None,
481
546
  description="Each sequence, in packet page and reading order, when asked for and served; else `null`.",
File without changes