omni-parse-bench 0.1.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 (77) hide show
  1. omni_parse_bench-0.1.0/.github/workflows/release.yml +110 -0
  2. omni_parse_bench-0.1.0/.github/workflows/test.yml +19 -0
  3. omni_parse_bench-0.1.0/.gitignore +8 -0
  4. omni_parse_bench-0.1.0/LICENSE +202 -0
  5. omni_parse_bench-0.1.0/NOTICE +13 -0
  6. omni_parse_bench-0.1.0/PKG-INFO +272 -0
  7. omni_parse_bench-0.1.0/README.md +228 -0
  8. omni_parse_bench-0.1.0/docs/API.md +568 -0
  9. omni_parse_bench-0.1.0/docs/assets/design.svg +56 -0
  10. omni_parse_bench-0.1.0/docs/building-tests.md +239 -0
  11. omni_parse_bench-0.1.0/docs/design.md +320 -0
  12. omni_parse_bench-0.1.0/docs/providers.md +262 -0
  13. omni_parse_bench-0.1.0/docs/tagging.md +86 -0
  14. omni_parse_bench-0.1.0/licenses/README.md +38 -0
  15. omni_parse_bench-0.1.0/licenses/cerfa-LICENSE.txt +14 -0
  16. omni_parse_bench-0.1.0/licenses/docparsingbench-LICENSE.txt +12 -0
  17. omni_parse_bench-0.1.0/licenses/documentcloud-LICENSE.txt +37 -0
  18. omni_parse_bench-0.1.0/licenses/finepdfs-LICENSE.txt +12 -0
  19. omni_parse_bench-0.1.0/licenses/fr-bench-pdf2md-LICENSE.txt +17 -0
  20. omni_parse_bench-0.1.0/licenses/htr-united-LICENSE.txt +50 -0
  21. omni_parse_bench-0.1.0/licenses/loc-catt-papers-LICENSE.txt +10 -0
  22. omni_parse_bench-0.1.0/licenses/nls-marjory-fleming-LICENSE.txt +12 -0
  23. omni_parse_bench-0.1.0/licenses/nta-LICENSE.txt +8 -0
  24. omni_parse_bench-0.1.0/licenses/ohio-dot-LICENSE.txt +15 -0
  25. omni_parse_bench-0.1.0/licenses/olmocr-bench-LICENSE.txt +17 -0
  26. omni_parse_bench-0.1.0/licenses/parsebench-LICENSE.txt +14 -0
  27. omni_parse_bench-0.1.0/licenses/pmc-LICENSE.txt +15 -0
  28. omni_parse_bench-0.1.0/licenses/pmc_articles.csv +482 -0
  29. omni_parse_bench-0.1.0/licenses/realdoc-bench-LICENSE.txt +12 -0
  30. omni_parse_bench-0.1.0/licenses/us-federal-forms-LICENSE.txt +8 -0
  31. omni_parse_bench-0.1.0/omni_parse_bench/__init__.py +24 -0
  32. omni_parse_bench-0.1.0/omni_parse_bench/benchmark.py +670 -0
  33. omni_parse_bench-0.1.0/omni_parse_bench/cli.py +268 -0
  34. omni_parse_bench-0.1.0/omni_parse_bench/equations.py +206 -0
  35. omni_parse_bench-0.1.0/omni_parse_bench/gold.py +340 -0
  36. omni_parse_bench-0.1.0/omni_parse_bench/harness/__init__.py +56 -0
  37. omni_parse_bench-0.1.0/omni_parse_bench/harness/budget.py +75 -0
  38. omni_parse_bench-0.1.0/omni_parse_bench/harness/contract.py +104 -0
  39. omni_parse_bench-0.1.0/omni_parse_bench/harness/errors.py +76 -0
  40. omni_parse_bench-0.1.0/omni_parse_bench/harness/layout.py +50 -0
  41. omni_parse_bench-0.1.0/omni_parse_bench/harness/page.py +175 -0
  42. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/__init__.py +1 -0
  43. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/azure.py +170 -0
  44. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/datalab.py +149 -0
  45. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/extend.py +215 -0
  46. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/llamaparse.py +187 -0
  47. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/llm.py +277 -0
  48. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/mistral.py +123 -0
  49. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/reducto.py +198 -0
  50. omni_parse_bench-0.1.0/omni_parse_bench/harness/providers/tesseract.py +101 -0
  51. omni_parse_bench-0.1.0/omni_parse_bench/harness/raster.py +32 -0
  52. omni_parse_bench-0.1.0/omni_parse_bench/harness/registry.py +94 -0
  53. omni_parse_bench-0.1.0/omni_parse_bench/katex/LICENSE +21 -0
  54. omni_parse_bench-0.1.0/omni_parse_bench/katex/katex.js +19092 -0
  55. omni_parse_bench-0.1.0/omni_parse_bench/markdown.py +88 -0
  56. omni_parse_bench-0.1.0/omni_parse_bench/metric.py +162 -0
  57. omni_parse_bench-0.1.0/omni_parse_bench/normalize.py +211 -0
  58. omni_parse_bench-0.1.0/omni_parse_bench/progress.py +399 -0
  59. omni_parse_bench-0.1.0/omni_parse_bench/runners.py +457 -0
  60. omni_parse_bench-0.1.0/omni_parse_bench/tables.py +276 -0
  61. omni_parse_bench-0.1.0/omni_parse_bench/views.py +196 -0
  62. omni_parse_bench-0.1.0/omni_parse_bench/vocab.py +123 -0
  63. omni_parse_bench-0.1.0/pyproject.toml +63 -0
  64. omni_parse_bench-0.1.0/tests/fixtures/invariants/gold/fx_layout-p1.json +13 -0
  65. omni_parse_bench-0.1.0/tests/fixtures/invariants/gold/fx_table-p1.json +24 -0
  66. omni_parse_bench-0.1.0/tests/fixtures/invariants/gold/fx_text-p1.json +26 -0
  67. omni_parse_bench-0.1.0/tests/test_benchmark.py +569 -0
  68. omni_parse_bench-0.1.0/tests/test_dataset.py +35 -0
  69. omni_parse_bench-0.1.0/tests/test_equations.py +39 -0
  70. omni_parse_bench-0.1.0/tests/test_gold.py +65 -0
  71. omni_parse_bench-0.1.0/tests/test_harness.py +290 -0
  72. omni_parse_bench-0.1.0/tests/test_invariants.py +118 -0
  73. omni_parse_bench-0.1.0/tests/test_metric.py +158 -0
  74. omni_parse_bench-0.1.0/tests/test_package.py +7 -0
  75. omni_parse_bench-0.1.0/tests/test_runners.py +163 -0
  76. omni_parse_bench-0.1.0/tests/test_text.py +202 -0
  77. omni_parse_bench-0.1.0/uv.lock +1084 -0
@@ -0,0 +1,110 @@
1
+ # Publishing to PyPI. Triggered by pushing a version tag, whose version must be the one
2
+ # `pyproject.toml` already declares -- the job refuses the two if they disagree, because a
3
+ # wheel named after the wrong version cannot be taken back off PyPI.
4
+ #
5
+ # No API token: PyPI is configured to trust this repository and this workflow file, and the
6
+ # `id-token` permission below is what lets the action prove it is them.
7
+ name: release
8
+
9
+ # Tag push only. A `release: published` trigger alongside this one would fire a second time
10
+ # for the usual "push the tag, then write the release notes" sequence, and that second upload
11
+ # fails on a filename PyPI already has -- a red run for a release that actually succeeded.
12
+ # `workflow_dispatch` is a DRY RUN: it builds, tests and checks the artifacts but does not
13
+ # publish (see the `if` on the publish job). Use it to see a release go green before the tag
14
+ # exists, because a tag that fails halfway can leave a version burned on PyPI.
15
+ on:
16
+ push:
17
+ tags: ["v*"]
18
+ workflow_dispatch:
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v5
28
+ - uses: astral-sh/setup-uv@v6
29
+
30
+ # Read the declared version from pyproject itself rather than `uv version --short`:
31
+ # that subcommand reports the PROJECT version only on uv >= 0.7, and on older uv the
32
+ # same command prints uv's OWN version instead -- so a drifting toolchain would quietly
33
+ # compare the tag against the wrong number.
34
+ - name: Check the tag against the declared version
35
+ if: startsWith(github.ref, 'refs/tags/')
36
+ run: |
37
+ declared=$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')
38
+ tag=${GITHUB_REF_NAME#v}
39
+ echo "tag=$tag declared=$declared"
40
+ if [ "$declared" != "$tag" ]; then
41
+ echo "::error::tag $GITHUB_REF_NAME does not match version $declared in pyproject.toml. Bump the version, or move the tag." >&2
42
+ exit 1
43
+ fi
44
+
45
+ # The scorer decides published numbers, so a release that cannot pass its own checks is
46
+ # not one to ship. The same checks as test.yml: `dev` brings every extra (the harness and
47
+ # the dataset access) with pytest and ruff, and none of the tests needs network or
48
+ # credentials. `--frozen` installs what uv.lock pins, so a release is tested on the
49
+ # versions it was developed on.
50
+ - name: Install and test
51
+ run: |
52
+ uv sync --frozen --extra dev
53
+ uv run ruff check omni_parse_bench tests
54
+ uv run pytest -q
55
+
56
+ - run: uv build
57
+
58
+ # A source distribution that swept in a dataset or a run is the failure this guards
59
+ # against: PyPI takes nothing over 100 MB, and finding that out mid-upload leaves the
60
+ # wheel published and the sdist not.
61
+ - name: Check the artifacts
62
+ run: |
63
+ uvx twine check dist/*
64
+ if [ -n "$(find dist -size +50M)" ]; then
65
+ echo "::error::an artifact is over 50 MB; check what the sdist swept in" >&2
66
+ ls -lh dist
67
+ exit 1
68
+ fi
69
+
70
+ # The tag matched what pyproject declared; this checks the files that actually built
71
+ # carry that version too, which is what PyPI indexes and nobody can rename afterwards.
72
+ - name: Check the built version
73
+ if: startsWith(github.ref, 'refs/tags/')
74
+ run: |
75
+ tag=${GITHUB_REF_NAME#v}
76
+ ls -l dist
77
+ for f in dist/*; do
78
+ case "$(basename "$f")" in
79
+ *-"$tag"-*.whl|*-"$tag".tar.gz) ;;
80
+ *) echo "::error::$(basename "$f") is not version $tag" >&2; exit 1 ;;
81
+ esac
82
+ done
83
+
84
+ # The distributions only. `uv build` leaves a `.gitignore` in dist/, and while the
85
+ # upload action skips hidden files by default, naming what to carry means the publish
86
+ # job cannot be handed anything that is not a distribution.
87
+ - uses: actions/upload-artifact@v4
88
+ with:
89
+ name: dist
90
+ path: |
91
+ dist/*.whl
92
+ dist/*.tar.gz
93
+
94
+ publish:
95
+ needs: build
96
+ runs-on: ubuntu-latest
97
+ # Only a tag publishes. A manual run stops after `build`, so `workflow_dispatch` is a
98
+ # dry run rather than a way to put whatever is on main onto PyPI without a version check.
99
+ if: startsWith(github.ref, 'refs/tags/')
100
+ # PyPI's trusted-publisher entry may name an environment. If it does, this must be that
101
+ # name; if it leaves the field blank, any environment is accepted and this is free.
102
+ environment: pypi
103
+ permissions:
104
+ id-token: write
105
+ steps:
106
+ - uses: actions/download-artifact@v4
107
+ with:
108
+ name: dist
109
+ path: dist/
110
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ name: test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ python-version: ["3.11", "3.14"]
12
+ steps:
13
+ - uses: actions/checkout@v5
14
+ - uses: astral-sh/setup-uv@v6
15
+ with:
16
+ python-version: ${{ matrix.python-version }}
17
+ - run: uv sync --extra dev
18
+ - run: uv run ruff check omni_parse_bench tests
19
+ - run: uv run pytest -q
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ *.log
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .DS_Store
8
+ runs/
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Datalab
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,13 @@
1
+ Omni Parse Bench
2
+ Copyright 2026 Datalab
3
+
4
+ This product includes software developed by others:
5
+
6
+ - KaTeX 0.16.22 (omni_parse_bench/katex/katex.js), Copyright (c) 2013-2020 Khan Academy and other
7
+ contributors, under the MIT License (omni_parse_bench/katex/LICENSE).
8
+ - omni_parse_bench/tables.py is a rewrite of the HTML table parser of olmOCR-bench (olmOCR,
9
+ https://github.com/allenai/olmocr), Copyright Allen Institute for AI, under the Apache License,
10
+ Version 2.0. The test types present, order and table_cell, and comparing equations by their KaTeX
11
+ rendering, follow olmOCR-bench.
12
+
13
+ Each of the dataset's sources, its license and the credit it requires are in licenses/.
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.5
2
+ Name: omni-parse-bench
3
+ Version: 0.1.0
4
+ Summary: A document-parsing benchmark: yes/no tests on single pages, graded against a provider's outputs.
5
+ Project-URL: Homepage, https://github.com/datalab-to/omni_parse_bench
6
+ Author: Datalab
7
+ License: Apache-2.0
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: beautifulsoup4>=4.12
12
+ Requires-Dist: fuzzysearch>=0.7
13
+ Requires-Dist: mini-racer>=0.12
14
+ Requires-Dist: pylatexenc>=2.10
15
+ Requires-Dist: rapidfuzz>=3.0
16
+ Provides-Extra: benchmark
17
+ Requires-Dist: httpx>=0.27; extra == 'benchmark'
18
+ Requires-Dist: huggingface-hub>=0.23; extra == 'benchmark'
19
+ Requires-Dist: markdown-it-py>=3.0; extra == 'benchmark'
20
+ Requires-Dist: openai>=1.0; extra == 'benchmark'
21
+ Requires-Dist: pillow>=10.0; extra == 'benchmark'
22
+ Requires-Dist: pyarrow>=15.0.0; extra == 'benchmark'
23
+ Requires-Dist: pypdfium2>=4.30; extra == 'benchmark'
24
+ Requires-Dist: rich>=13.0; extra == 'benchmark'
25
+ Provides-Extra: dev
26
+ Requires-Dist: httpx>=0.27; extra == 'dev'
27
+ Requires-Dist: huggingface-hub>=0.23; extra == 'dev'
28
+ Requires-Dist: markdown-it-py>=3.0; extra == 'dev'
29
+ Requires-Dist: openai>=1.0; extra == 'dev'
30
+ Requires-Dist: pillow>=10.0; extra == 'dev'
31
+ Requires-Dist: pyarrow>=15.0.0; extra == 'dev'
32
+ Requires-Dist: pypdfium2>=4.30; extra == 'dev'
33
+ Requires-Dist: pytest>=8.0; extra == 'dev'
34
+ Requires-Dist: rich>=13.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.6; extra == 'dev'
36
+ Provides-Extra: harness
37
+ Requires-Dist: httpx>=0.27; extra == 'harness'
38
+ Requires-Dist: markdown-it-py>=3.0; extra == 'harness'
39
+ Requires-Dist: openai>=1.0; extra == 'harness'
40
+ Requires-Dist: pillow>=10.0; extra == 'harness'
41
+ Requires-Dist: pypdfium2>=4.30; extra == 'harness'
42
+ Requires-Dist: rich>=13.0; extra == 'harness'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # Omni Parse Bench
46
+
47
+ [![test](https://github.com/datalab-to/omni_parse_bench/actions/workflows/test.yml/badge.svg)](https://github.com/datalab-to/omni_parse_bench/actions/workflows/test.yml)
48
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](./pyproject.toml)
49
+ [![Code: Apache 2.0](https://img.shields.io/badge/code-Apache%202.0-blue)](./LICENSE)
50
+ [![Data: per source](https://img.shields.io/badge/data-per%20source-lightgrey)](./licenses)
51
+ [![Dataset on Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20dataset-omni__parse__bench-yellow)](https://huggingface.co/datasets/datalab-to/omni_parse_bench)
52
+
53
+ A document-parsing benchmark. Every test is a yes/no question about one page: is this text in the
54
+ output, in this order, in a table cell under these headings, in a layout block of this kind?
55
+
56
+ This repository contains a way to run our benchmark using our dataset on [HuggingFace](https://huggingface.co/datasets/datalab-to/omni_parse_bench) or your own dataset. It also provides lower-level primitives (score and predict) to run in your own pipelines however you like. The README is split up into the following table of contents.
57
+
58
+
59
+ - [The design](#the-design)
60
+ - [Install](#install)
61
+ - [Run the benchmark](#run-the-benchmark)
62
+ - [Score](#score)
63
+ - [Predict](#predict)
64
+ - [Documentation](#documentation)
65
+ - [License](#license)
66
+ - [Citation](#citation)
67
+
68
+ ## The design
69
+
70
+ ![The benchmark's design: headline, families, tests, args and tags](./docs/assets/design.svg)
71
+
72
+ The headline is the mean of three family scores: text, tables and layout. A family is a group of test
73
+ types:
74
+
75
+ | test type | checks | family |
76
+ |---|---|---|
77
+ | `present` | this text, number or equation appears | text |
78
+ | `order` | text A comes before text B | text |
79
+ | `repeat` | this line appears exactly N times | text |
80
+ | `table_cell` | this cell sits under these headings and beside these neighbors | tables |
81
+ | `layout_kind` | the block holding this line is a heading, text or table | layout |
82
+
83
+ A test checks one or more args, each of which is the content at one place on the page. Each arg is
84
+ tagged:
85
+
86
+ - structure: `table`, `math`, `form` and `multi_column`;
87
+ - rendering: `handwriting`, `tiny`, `rotated` and `degraded`;
88
+ - role: `heading`, `caption`, `footnote`, `list`, `code`, `figure` and `header_footer`;
89
+ - script: ISO 15924 codes (`Latn`, `Hani`, `Deva`, ...); and
90
+ - language: ISO 639-3 codes (`eng`, `fra`, `tha`, ...).
91
+
92
+ A test's tags are the union of its args' tags. Tags never decide whether a test passes or what the
93
+ headline is; they select tests, so any slice of the benchmark can be scored. A test with several tags
94
+ counts in each, so per-tag scores overlap and don't average to the headline.
95
+
96
+ ## Install
97
+
98
+ ```bash
99
+ uv pip install 'omni-parse-bench @ git+https://github.com/datalab-to/omni_parse_bench' # score(): no network, no API keys
100
+ uv pip install 'omni-parse-bench[harness] @ git+https://github.com/datalab-to/omni_parse_bench' # + vendor adapters, to predict
101
+ uv pip install 'omni-parse-bench[benchmark] @ git+https://github.com/datalab-to/omni_parse_bench' # + dataset access, to run the benchmark
102
+ ```
103
+
104
+ ## Run the benchmark
105
+
106
+ With `[benchmark]` installed, run vendors on the dataset (5 pages here):
107
+
108
+ ```bash
109
+ opb benchmark --out runs/ --limit 5 --providers datalab openai/gpt-5.6-sol
110
+ ```
111
+
112
+ It shows the plan and asks before calling any vendor, since calls cost money. Each vendor needs its
113
+ API key in the environment: `DATALAB_API_KEY` for Datalab, `OPENROUTER_API_KEY` for any model by
114
+ its OpenRouter id; [`docs/providers.md`](./docs/providers.md) lists the rest. A run is resumable: stop it, and run the same command again to carry
115
+ on.
116
+
117
+ Each setting of a provider is its own run; here, two:
118
+
119
+ ```bash
120
+ opb benchmark --out runs/ --limit 5 --providers datalab \
121
+ --options '{"datalab": [{"mode": "balanced"}, {"mode": "accurate"}]}'
122
+ ```
123
+
124
+ `--dataset` picks the dataset: a folder, or `hf://datasets/<repo>[@revision]` (ours by default).
125
+ `--suites`, `--sample` and `--pages` choose pages. [`docs/API.md`](./docs/API.md#benchmark) has
126
+ every option, how resuming works and what a run writes. Each run's `scores.jsonl` has one line per
127
+ test; [Asking a question](./docs/API.md#asking-a-question) shows how to compare runs by tag, suite or
128
+ test type.
129
+
130
+ ## Score
131
+
132
+ Here is one page with three tests, written inline with `gold.parse` so the gold
133
+ file's shape is visible (`gold.read("gold/<page_id>.json")` reads a file):
134
+
135
+ ```python
136
+ from omni_parse_bench import gold, score, summarize
137
+
138
+ tests = gold.parse("example-p1", {"tests": [
139
+ {
140
+ "id": "t1",
141
+ "test_type": "present",
142
+ "output_type": "html",
143
+ "derivation": "text_layer",
144
+ "tags": ["Latn", "eng"],
145
+ "args": {"content": {"text": "Quarterly revenue rose 12%", "max_diffs": 1}},
146
+ "settings": {},
147
+ },
148
+ {
149
+ "id": "t2",
150
+ "test_type": "order",
151
+ "output_type": "html",
152
+ "derivation": "text_layer",
153
+ "tags": ["Latn", "eng", "heading"],
154
+ "args": {
155
+ "before": {"text": "Summary", "max_diffs": 0},
156
+ "after": {"text": "Outlook", "max_diffs": 0},
157
+ },
158
+ "settings": {},
159
+ },
160
+ {
161
+ "id": "t3",
162
+ "test_type": "table_cell",
163
+ "output_type": "html",
164
+ "derivation": "publisher_markup",
165
+ "tags": ["table"],
166
+ "args": {
167
+ "cell": {"text": "4.2", "max_diffs": 0},
168
+ "top_heading": {"text": "Q3", "max_diffs": 0},
169
+ },
170
+ "settings": {},
171
+ },
172
+ ]})
173
+
174
+ outputs = {
175
+ "html": (
176
+ "<h2>Summary</h2>"
177
+ "<p>Quarterly revenue rose 12% on the year.</p>"
178
+ "<table>"
179
+ "<tr><th>Q2</th><th>Q3</th></tr>"
180
+ "<tr><td>3.9</td><td>4.1</td></tr>"
181
+ "</table>"
182
+ "<h2>Outlook</h2>"
183
+ ),
184
+ }
185
+ verdicts = score(outputs, tests)
186
+ ```
187
+
188
+ ```python
189
+ >>> verdicts
190
+ [Verdict(id='t1', result='pass', why=''),
191
+ Verdict(id='t2', result='pass', why=''),
192
+ Verdict(id='t3', result='fail', why="no cell matching '4.2' in any table")]
193
+
194
+ >>> s = summarize(verdicts, tests)["html"]
195
+ >>> s["score"], s["per_test_type"], s["per_tag"]["table"]
196
+ (0.6666666666666666, {'present': 1.0, 'order': 1.0, 'table_cell': 0.0}, {'score': 0.0, 'tests': 1, 'pages': 1})
197
+ ```
198
+
199
+ A verdict is `pass`, `fail`, `unsupported` (the provider can't produce that output) or `error`
200
+ (grading raised: a bug in the scorer, not the provider's fault), with `why` saying what went wrong.
201
+ `unsupported` and `error` verdicts are left out of every score.
202
+
203
+ From the command line, with the outputs in a JSON file:
204
+
205
+ ```bash
206
+ opb score --pred outputs.json --gold gold/<page_id>.json
207
+ ```
208
+
209
+ It prints the verdicts. A score is a number over many pages: `summarize` in your code, or
210
+ `summary.json` from `opb benchmark`. To grade your own model on the whole dataset, see
211
+ [The dataset](./docs/API.md#the-dataset).
212
+
213
+ ## Predict
214
+
215
+ With `[harness]` installed, predict with our provider adapters:
216
+
217
+ ```python
218
+ from omni_parse_bench import harness
219
+
220
+ record = harness.predict("datalab", "pages/<page_id>.pdf", {"html", "blocks"}, mode="balanced")
221
+ record["outputs"] # {"html": "...", "blocks": [...]}
222
+ record["errors"] # {output: why} for anything that failed
223
+ record["calls"] # what was sent, cost, wall time
224
+
225
+ score(record["outputs"], gold.read("gold/<page_id>.json"))
226
+ ```
227
+
228
+ From the command line:
229
+
230
+ ```bash
231
+ opb predict --provider openai/gpt-5.6-sol --page pages/<page_id>.pdf --wants html
232
+ opb providers # every provider, and its options
233
+ ```
234
+
235
+ Every provider gets the same timeout per call and its most accurate settings by default. An output a vendor
236
+ can't produce is recorded as unsupported, and its tests are left out of that vendor's scores rather
237
+ than failed.
238
+
239
+ ## Documentation
240
+
241
+ - [`docs/API.md`](./docs/API.md): every function and command, the dataset, and what a run writes;
242
+ - [`docs/design.md`](./docs/design.md): each test type, tag and derivation, and the data layout;
243
+ - [`docs/building-tests.md`](./docs/building-tests.md): how the tests were built, and where each
244
+ one's answer comes from;
245
+ - [`docs/providers.md`](./docs/providers.md): the provider adapters; and
246
+ - [`docs/tagging.md`](./docs/tagging.md): how the tests' tags were made.
247
+
248
+ Found a test that's wrong, or a page you hold rights in? [Open an issue](https://github.com/datalab-to/omni_parse_bench/issues).
249
+
250
+ ## License
251
+
252
+ The code is Apache 2.0: see [`LICENSE`](./LICENSE), and [`NOTICE`](./NOTICE) for the third-party
253
+ code it includes (KaTeX, MIT; a rewrite of olmOCR-bench's table parser, Apache 2.0).
254
+
255
+ The data's licenses are per source. Each source of the pages, its license and the credit it
256
+ requires are in [`licenses/`](./licenses), one file per source. The tests are CC BY 4.0, except
257
+ those converted from olmOCR-bench (ODC-BY 1.0) and fr-bench-pdf2md (MIT), and those quoting
258
+ Wikipedia on three handwriting pages (CC BY-SA 4.0).
259
+
260
+ ## Citation
261
+
262
+ ```bibtex
263
+ @misc{omniparsebench2026,
264
+ title = {Omni Parse Bench: A Document-Parsing Benchmark},
265
+ author = {{Datalab}},
266
+ year = {2026},
267
+ howpublished = {\url{https://github.com/datalab-to/omni_parse_bench}},
268
+ }
269
+ ```
270
+
271
+ Please also cite the upstream datasets whose pages or tests this benchmark uses; they are listed
272
+ in [`licenses/`](./licenses).