A team is moving from text-only SFT to OpenAI's hosted fine-tuning API for a tool-calling model (e.g. gpt-5.5-class). They have working multi-turn JSONL but the API rejects half their rows once they add tool calls. Specify the extra fields a tool-aware row needs, both on the assistant turn that issues the call and on the tool response that follows, and explain which field links them. What breaks if the linkage is wrong or missing?
The assistant turn carries a tool_calls array with unique id, type, name, and JSON-string arguments. The next turn uses role tool with a matching tool_call_id, the linkage that survives parallel calls.
Picture a busy kitchen where the head chef shouts orders to the prep station. Every order gets its own ticket number stuck to it: order forty-one, two onions diced; order forty-two, one carrot grated. When the prep returns, they staple the chopped food to a matching ticket so the head chef knows what came back from where. If you forget the ticket, or two tickets share a number, the chef ends up putting onions where carrots should go. The hosted fine-tuning API works the same way. Each tool call carries its own ticket, the response carries the same ticket back, and the system uses tickets to keep everything paired even when several orders fly at once.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: assistant turn shape with tool_calls array + the three required keys per call + arguments as a JSON string + tool role and matching tool_call_id + why parallel calls need unique ids + hard versus soft failure modes.
Real products, models, and research that use this idea.
- OpenAI's hosted fine-tuning for gpt-5.5 family enforces this shape exactly and rejects rows at upload when arguments is nested or tool_call_id is missing.
- OpenAI's Python SDK ChatCompletion examples emit ids as call_<uuid> and pass arguments as a JSON string, the same convention training data must follow.
- Anthropic's tool-use API uses a parallel pattern with tool_use and tool_result blocks, where the tool_use_id field plays the same linkage role as tool_call_id.
- Hugging Face's TRL library now ships a chat template for OpenAI-shaped tool-calling JSONL that masks tool turns automatically and validates linkage before training.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does the OpenAI spec keep arguments as a JSON string rather than a nested object?
QHow would you debug a fine-tune where uploads succeed but at inference parallel tool calls grounded on the wrong results?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Passing arguments as a nested JSON object instead of a JSON string. The OpenAI spec is strict here, arguments must be a string, and rows that nest the object are rejected at upload time.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.