Datasets:
Unified Tool-Calling Corpus — Canonicalized Output
Publish-ready conversion of two pinned Hugging Face dataset revisions into the single
schema defined in docs/unified_format.md, with repeated
records normalized by an explicit canonicalization rule and every surviving record
kept faithful to its source row.
| Records in (source rows) | 65,000 |
| Records published (canonical survivors) | 64,622 |
| Duplicates collapsed | 378 (343 duplicate groups) |
| Records mutated during canonicalization | 0 |
| Schema / faithfulness validation errors | 0 |
1. Selected source revisions
Both sources are pinned by commit SHA, so the published rows can be re-derived byte-for-byte at any time.
conversation_id prefix |
Source dataset | Revision (pinned) | Source file | Upstream license | Rows in → out |
|---|---|---|---|---|---|
xlam |
Salesforce/xlam-function-calling-60k | 26d14ebfe18b1f7b524bd39b404b50af5dc97866 |
xlam_function_calling_60k.json |
CC BY 4.0 (gated upstream) | 60,000 → 59,622 |
apigen_mt |
Salesforce/APIGen-MT-5k | abc4a517d67c541f85f6470cbd8fd3186b36830e |
apigen-mt_5k.json |
CC BY-NC 4.0 | 5,000 → 5,000 |
The two revisions were chosen because together they cover both shapes the unified format has to support: XLAM contributes single-turn parallel tool calls with a flat parameter mapping (the case called out explicitly in the format description), and APIGen-MT contributes multi-turn trajectories with tool results, a domain system prompt and JSON-Schema tool definitions.
2. Unified schema
Each line of the JSONL files is one record with exactly three keys —
conversation_id, messages, tools:
{
"conversation_id": "xlam_0",
"messages": [
{"role": "user", "content": "Where can I find live giveaways for beta access and games?"},
{"role": "assistant", "content": null, "tool_calls": [
{"id": "tool_call_0", "name": "live_giveaways_by_type", "arguments": {"type": "beta"}},
{"id": "tool_call_1", "name": "live_giveaways_by_type", "arguments": {"type": "game"}}
]}
],
"tools": [
{"name": "live_giveaways_by_type",
"description": "Retrieve live giveaways from the GamerPower API based on the specified type.",
"parameters": {"type": "object",
"properties": {"type": {"type": "string", "description": "The type of giveaways to retrieve (e.g., game, loot, beta).", "default": "game"}},
"required": []}}
]
}
conversation_id={source}_{index}whereindexis the original 0-based row number of the pinned source revision (see §3: ids are never re-numbered).role∈system/user/assistant/tool.- assistant turns that only call tools have
"content": nulland atool_callslist; everyidistool_call_{n}withnincrementing from 0 across the whole conversation. toolturns carry thetool_call_idof the call they answer.tools[*].parametersis always a JSON-Schema object withtype/properties/required.
3. Canonicalization rule (duplicate normalization)
Duplicates are detected after conversion, on record content only:
- Fingerprint.
sha256of the canonical JSON (sort_keys=True, UTF-8, compact separators) of{"messages": <messages, order preserved>, "tools": <tools sorted by (name, canonical JSON)>}.conversation_idis excluded — it carries provenance, not content.- The order of the offered tool list is normalized, because that list is a set of
available tools and its order carries no conversational meaning. Everything else
(message order, message text, tool-call order and arguments, parameter order,
requiredorder, defaults) is compared exactly.
- Survivor selection. In each fingerprint group the record with the smallest source index wins (first occurrence, fully deterministic).
- Survivors are emitted verbatim. They keep their original
conversation_id(no re-indexing, no renumbering) and their original field values, including their original tool ordering — the normalization in step 1 only affects the comparison key. - Every collapse is auditable.
canonicalization/duplicate_groups_*.jsonllists one line per group:fingerprint,canonical_conversation_id,dropped_conversation_ids,group_size.
Result: 378 XLAM rows collapse into 343 canonical rows (largest group: 6 identical rows); APIGen-MT contains no duplicates; there are 0 cross-source duplicate pairs.
Deliberately not collapsed: 1,330 surviving XLAM records share their message content with another record but are offered a different tool list. Those rows differ in the source, so merging them would destroy information; they are reported instead of removed.
4. Faithfulness of surviving records
Preserved exactly (verified programmatically for all 64,622 published records against the pinned sources):
- user / assistant / tool message text, in source order, including empty tool results
(849 empty
think-tool observations stay empty); - tool-call names, argument values, and call order;
- tool names, tool descriptions, parameter names, parameter order, parameter descriptions and default values;
- conversation length — no tool result and no assistant reply was invented. 96
APIGen-MT conversations legitimately end with a
toolmessage, exactly as upstream; - the APIGen-MT system prompts (retail / airline business policies, 2 distinct texts) are kept because they contain domain rules, not a toolset dump. XLAM has no system message at all, so the "drop toolset-only system prompts" rule removes nothing here.
The only representation changes (both required by the unified format, both loss-free):
- Flat parameter mapping → JSON Schema (XLAM). Each source parameter becomes a
propertiesentry. A parameter is optional — and therefore absent fromrequired— iff the source spec has an explicitdefaultkey (any value,nullincluded) or its comma-separatedtypeannotation contains the tokenoptional(case-insensitive). Optionality is decided on the raw annotation before type aliases are normalized and is never inferred from the description prose. All other parameters stay inrequiredin source order (260,944 parameters carry adefault, 9,370 areoptionalwithout a default, 92,168 remain required). Type aliases are then mapped to JSON Schema:str→string,int→integer,float→number,bool→boolean,Dict→object,list/List[X]→array(+items),Tuple[...]→array,set→array+uniqueItems,Union[...]→anyOf,Callable[...]→string(XLAM passes callables as expression strings). All 30 distinct source annotations are covered; 0 fell back to "unmapped". argumentsJSON strings → objects. 5,026 APIGen-MT tool calls encode their argument object as a JSON string; they are parsed back into the identical object so the field type is consistent (json.loadsround-trip, nothing added or dropped). The remaining 216,442 argument payloads were already objects.
5. Files
unified/xlam_function_calling_60k.jsonl 59,622 canonical records (104.1 MB)
unified/apigen_mt_5k.jsonl 5,000 canonical records (122.2 MB)
canonicalization/canonicalization_report.json rule, per-source counts, verification results
canonicalization/duplicate_groups_xlam.jsonl 343 collapsed groups (dropped → canonical id)
canonicalization/duplicate_groups_apigen_mt.jsonl empty: no duplicates found
canonicalization/publish_verification.json post-publish audit of the uploaded files
canonicalization/file_checksums.json size + sha256 of every published artifact
preview/sample_records.json 6 records copied verbatim, pretty-printed
scripts/build_unified_dataset.py end-to-end reproducible build + validation
scripts/publish_to_hub.py the exact upload step used
scripts/verify_published.py re-audits the uploaded files against the sources
docs/unified_format.md the target-format contract used
Post-publish audit
scripts/verify_published.py was run against the uploaded files at revision
f3112b6c6e2fc6d2821f9b700933ef3098443e01 (the commit that introduced the data; later
commits only touch documentation/metadata). It re-downloads every artifact and checks
sha256 + byte size, re-validates all 64,622 records against the schema, re-derives each
record from its pinned source row and requires byte-identical canonical JSON, confirms
that all 378 dropped ids are absent and really share their survivor's fingerprint, and
confirms that no two published records share a fingerprint. Result:
total_errors: 0 — see canonicalization/publish_verification.json.
6. Loading
tool_calls[*].arguments and tools[*].parameters.properties are free-form JSON
objects, so the corpus has no fixed Arrow schema (the same key can hold a string in one
row and a number in the next). The Hub viewer is therefore switched off on purpose —
read the records as plain JSON lines instead:
import json
from huggingface_hub import hf_hub_download
path = hf_hub_download(
"dongbobo/unified-toolcalls-canonical",
"unified/xlam_function_calling_60k.jsonl",
repo_type="dataset",
)
with open(path, encoding="utf-8") as fh:
records = [json.loads(line) for line in fh]
print(records[0]["conversation_id"], len(records))
7. Reproducing
python scripts/build_unified_dataset.py # downloads the pinned revisions, rebuilds,
# re-validates and rewrites every artifact
The script re-derives each published record from its source row and asserts schema
conformance and faithfulness (message text, call payloads, parameter metadata,
required derivation). The published run reports 0 errors.
8. Licensing & attribution
This is a derivative work of two Salesforce datasets and keeps their terms:
- rows with
conversation_idprefixxlamderive fromSalesforce/xlam-function-calling-60k— CC BY 4.0; - rows with prefix
apigen_mtderive fromSalesforce/APIGen-MT-5k— CC BY-NC 4.0.
Because the corpus mixes both, the repository as a whole is published under the more restrictive CC BY-NC 4.0; please cite the original work when you use it. Access to the upstream XLAM revision is gated by Salesforce — request it there before relying on the reproduction script.
@article{liu2024apigen,
title={APIGen: Automated Pipeline for Generating Verifiable and Diverse Function-Calling Datasets},
author={Liu, Zuxin and Hoang, Thai and Zhang, Jianguo and Zhu, Ming and Lan, Tian and Kokane, Shirley and Tan, Juntao and Yao, Weiran and Liu, Zhiwei and Feng, Yihao and others},
journal={arXiv preprint arXiv:2406.18518},
year={2024}
}
@article{prabhakar2025apigenmt,
title={APIGen-MT: Agentic Pipeline for Multi-Turn Data Generation via Simulated Agent-Human Interplay},
author={Prabhakar, Akshara and Liu, Zuxin and Zhu, Ming and Zhang, Jianguo and Awalgaonkar, Tulika and Wang, Shiyu and Liu, Zhiwei and Chen, Haolin and Hoang, Thai and others},
journal={arXiv preprint arXiv:2504.03601},
year={2025}
}
- Downloads last month
- 801