---
title: "Gemini 4 Hydrogen on Pydantic AI - Structured output"
description: "Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 100%; rank 1 of 44."
canonical: https://pydantic.dev/models/list/gemini-4-hydrogen/structured_output/
---

# Gemini 4 Hydrogen on Pydantic AI - Structured output

> Extracting UK company accounts into a nested Pydantic model, checked against the filer's tags. Tool calling 100%; rank 1 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/gemini-4-hydrogen/structured_output/. Index for agents: https://pydantic.dev/models/llms.txt

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://pydantic.dev/models/select.md
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/api/ask?query=<question>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of all but the single model. An `OPTIONS` request to any endpoint returns its schema. The same five are tools of the MCP server at `https://pydantic.dev/models/mcp`. More: https://pydantic.dev/models/usage.md

About the benchmark: https://pydantic.dev/models/benchmarks/structured_output.md. The model on every Pydantic AI benchmark: https://pydantic.dev/models/list/gemini-4-hydrogen/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | ------- |
| Tool calling | 100%  | 10 of 10     | $0.60 | 10       | 10         | 4.1 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`gemini-4-hydrogen` passed 10 of 10 cases in tool-calling mode, each in a single request: one `accounts` call, accepted first time with no check failures or retries. Cost ran from $0.0508 to $0.0816 per case, $0.60 in total. I read each model output and the opening of each prompt, and did not re-check figures against the full accounts text, so comments on unchecked fields are inferences from the expected sets.

#### Where it does well

- **Group against parent**: in all 6 cases asking for both (tiers 3–5), consolidated and company figures were kept apart, including near-identical ones (`other` prior 103090 against 102990 in `tier5-NI037684`).
- **Signs**: deficits and losses were negative, costs and creditors positive, and tax credits negative (`tax` -138000, -571000, -51830) in every case.
- **Units**: the £000 accounts (`tier1-07054261`, `tier1-11022760`, `tier2-SC121467`) were scaled by 1,000.
- **Notes**: creditor lines were mapped to the right category and due date, including `amounts_owed_to_directors` and zero-against-prior lines such as `bank_loans_and_overdrafts` 0 / 5836.
- **Metadata**: `accounts_type` `medium` and a resigned director were both handled correctly.

#### Mistakes it makes

None of these cost a pass; they are in fields the checks did not cover or tolerated.

- **Zero where `null` looks intended** (3 cases): `tier5-12026946` parent `creditors_after_one_year` 0 and `trade_creditors` `prior_amount` 0; `tier2-SC121467` `creditors_after_one_year` 0; `tier5-NI037684` parent prior `investments` 0.
- **Omitted zero line**: `tier4-05840865` left out the group `amounts_owed_to_group` 0/0 line that expected lists.
- **Inconsistent empties**: both tier 5 cases return parent `staff_costs` as an object of nulls but `prior_staff_costs` as `null`.
- **Unverified extras**: `tier1-11022760` returned `turnover`, `cost_of_sales`, `gross_profit` and `operating_profit`, which the expected set does not list.
- **Name casing**: `CUBE LOGIC LIMITED` for `Cube Logic Limited`.

#### Tool calling compared with code mode

Only tool-calling mode was run for this benchmark, so there is no comparison to make.

## Runs

### tier1-07054261

**Tool calling: passed.** One request: a single `accounts` call with company details and both periods' balance sheet and profit and loss, converted from £000 to whole pounds. Passed. ($0.059, 1 requests, 21 s)
- Right: Scaled £000 figures by 1,000 (e.g. `net_assets` -6187000, `turnover` 16382000).
- Right: Signs followed the handbook: deficits negative (`profit_and_loss_reserve` -8457000, `operating_profit` -940000), the prior tax credit as `tax` -138000, costs positive.
- Right: Returned `tax` 0 and prior `interest_receivable` 0 as zero, not null, matching expected.
- Mistake: Returned the name in capitals, `CUBE LOGIC LIMITED`, where expected has `Cube Logic Limited`; the check accepted it.

### tier1-11022760

**Tool calling: passed.** One request: a single `accounts` call with company details, balance sheet and profit and loss for both periods in whole pounds. Passed. ($0.056, 1 requests, 26 s)
- Right: All checked fields matched, including `called_up_share_capital` 0 and `net_current_assets` -36631000.
- Right: Kept prior `total_assets_less_current_liabilities` positive (26107000) while `net_assets` is negative (-20588000).
- Right: `tax` kept positive as a charge (312000, 632000) even in the prior loss year.
- Mistake: Also returned `turnover`, `cost_of_sales`, `gross_profit` and `operating_profit` (e.g. 32402000, 26177000, 6225000, 2351000), which the expected set does not list; they were not checked, so their correctness is unconfirmed.

### tier2-11600506

**Tool calling: passed.** One request: a single `accounts` call with the group balance sheet and profit and loss for both periods. Passed. ($0.051, 1 requests, 19 s)
- Right: Took the consolidated figures, not the parent's (`net_assets` -2896388, `profit_after_tax` 520795).
- Right: Negative `net_current_assets` (-6090208) and `total_assets_less_current_liabilities` (-857995) signed correctly; prior `total_assets_less_current_liabilities` positive (1430307).
- Mistake: Extra fields not in the expected set (`turnover`, `gross_profit`, `operating_profit`, `debtors`, `stocks`, `provisions`, `creditors_after_one_year`) were returned and not checked.

### tier2-SC121467

**Tool calling: passed.** One request: a single `accounts` call with the group balance sheet and profit and loss for both periods, scaled from £000. Passed. ($0.057, 1 requests, 22 s)
- Right: Multiplied £000 figures by 1,000 (`called_up_share_capital` 9559000).
- Right: Prior-year tax credit returned as `tax` -571000 and prior loss as `profit_before_tax` -1678000.
- Right: Picked up `distribution_costs` (1387000, 1725000).
- Mistake: Returned current `creditors_after_one_year` as 0 against 4300000 prior; the expected set has no such field, so it was unchecked and may be a zero where `null` was meant.

### tier3-05959188

**Tool calling: passed.** One request: a single `accounts` call with group and parent balance sheets for both periods. Passed. ($0.063, 1 requests, 20 s)
- Right: Kept group and parent columns apart: `tangible_assets` 379315 group against 9602 parent, `creditors_within_one_year` 2483825 against 3852856.
- Right: Parent-only `investments` (2467, 2446) placed on the parent and `null` on the group.
- Right: Large deficits signed negative (`profit_and_loss_reserve` -25824630 and -27745666).

### tier3-09727592

**Tool calling: passed.** One request: a single `accounts` call with group and parent balance sheets for both periods. Passed. ($0.056, 1 requests, 22 s)
- Right: Handled a sign change between years on the parent: `net_assets` -1632236 current, 783514 prior.
- Right: Prior parent `investments` returned as 0, matching expected.
- Right: Share capital change picked up (252 against 250).
- Mistake: Returned `provisions` 5889 on all four balance sheets; not in the expected set, so unchecked.

### tier4-05840865

**Tool calling: passed.** One request: a single `accounts` call with staff costs and creditors notes for group and parent, both periods. Passed. ($0.056, 1 requests, 24 s)
- Right: All checked creditor lines matched by category and due date, including `bank_loans_and_overdrafts` 0 current against 10251 prior.
- Right: Parent finance leases split correctly: 11658 within one year, 28174 after one year.
- Right: Staff cost totals matched (group 5370606, parent 174680).
- Mistake: Omitted the group `amounts_owed_to_group` within-one-year line, which expected lists as 0/0; the check accepted the omission.
- Mistake: Group after-one-year lines (`finance_leases` 130386, `other` 133857, `creditors_after_one_year` 264243) are not in the expected set and were unchecked.

### tier4-NI626135

**Tool calling: passed.** One request: a single `accounts` call with staff costs and creditors notes for group and parent, both periods. Passed. ($0.057, 1 requests, 23 s)
- Right: All 10 creditor lines per entity matched, including the after-one-year `bank_loans_and_overdrafts` 0 against 5836 prior.
- Right: Group and parent kept apart where they differ sharply (`amounts_owed_to_group` 3668476 group, 10067741 parent).
- Right: Totals matched (`creditors_within_one_year` 15752489 and 17897307).

### tier5-12026946

**Tool calling: passed.** One request: a single `accounts` call with the whole set (company, directors, group and parent balance sheets, group profit and loss, staff costs, creditors). Passed at the highest cost of the run, $0.0816. ($0.082, 1 requests, 39 s)
- Right: Listed all four directors, including Mr R Thompson who resigned on 13 August 2025, as expected.
- Right: Group `tax` signs right: 72816 charge current, -51830 credit prior.
- Right: Parent and group creditors notes separated (parent `amounts_owed_to_group` 6050000; group has none).
- Mistake: Filled blanks with zeros on the parent: `creditors_after_one_year` 0, `finance_leases` after one year `amount` 0, `trade_creditors` `prior_amount` 0. Expected omits these, so the handbook's `null` for a line not shown was probably meant; unchecked.
- Mistake: Inconsistent empties: parent `prior_staff_costs` is `null` while `staff_costs` is an object of four nulls.

### tier5-NI037684

**Tool calling: passed.** One request: a single `accounts` call with the whole set for a medium-sized group. Passed. ($0.066, 1 requests, 30 s)
- Right: Classified `accounts_type` as `medium` rather than `full`.
- Right: Used the `amounts_owed_to_directors` category (18372, 5938) instead of folding it into `other`.
- Right: Left group `fixed_assets` `null` where only tangible assets are shown, matching the expected set, which has no group `fixed_assets`.
- Right: Caught small group/parent differences (`other` prior 103090 against 102990).
- Mistake: Parent prior `investments` returned as 0; expected omits it, so `null` was probably meant; unchecked.
- Mistake: Parent `staff_costs` is an object of nulls while `prior_staff_costs` is `null`.
