Shorten usage
Browse files101 unmodified lines102103104105105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138107108109110111112101 unmodified lines
## Usage
Load a subset with `datasets`:Download the dataset and run a system with the [ExtractBench evaluation framework](https://github.com/run-llama/ExtractBench#extractbench-pro):
```pythonfrom datasets import load_datasetimport json
ds = load_dataset("llamaindex/ExtractBenchPro", split="charts_inside_documents")case = ds[0]schema = json.loads(case["data_schema"])expected = json.loads(case["expected_output"])```
The rows use the same format as ExtractBench, so the [evaluation framework](https://github.com/run-llama/ExtractBench) scores them unchanged. To rebuild the `<stem>.pdf` + `<stem>.test.json` layout that the framework reads:
```pythonimport json, shutilfrom pathlib import Pathfrom huggingface_hub import snapshot_download
root = Path(snapshot_download("llamaindex/ExtractBenchPro", repo_type="dataset"))out = Path("data/extract_bench_pro")for split in ["document_conventions", "house_vocabulary", "house_counting_rules", "drawn_relations", "charts_inside_documents", "long_chart_sheets"]: for line in (root / f"{split}.jsonl").read_text().splitlines(): row = json.loads(line) stem = Path(row["pdf"]).stem (out / split).mkdir(parents=True, exist_ok=True) shutil.copyfile(root / row["pdf"], out / split / f"{stem}.pdf") sidecar = { "tags": row["tags"], "data_schema": json.loads(row["data_schema"]), "expected_output": json.loads(row["expected_output"]), "_field_rules": json.loads(row["field_rules"]), } (out / split / f"{stem}.test.json").write_text(json.dumps(sidecar))```bashuv run extract-bench download --dataset prouv run extract-bench run llamaextract_agentic --dataset pro```
Scoring follows ExtractBench and is fully deterministic:README.md+4-33