---
title: "DeepSeek V4 Flash 0423 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/deepseek-v4-flash/structured_output/
---

# DeepSeek V4 Flash 0423 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/deepseek-v4-flash/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/deepseek-v4-flash/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | ------- |
| Tool calling | 100%  | 10 of 10     | $0.032 | 12       | 12         | 7.6 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

DeepSeek V4 Flash passed all 10 cases. They were all in tool-calling mode and covered tiers 1 to 5. Nine of the 10 finished in a single request. The whole run cost about $0.032, between $0.0024 and $0.0058 per case.

#### Where it does well

- **Scaling and signs:** It multiplied £000 figures by 1,000 in all 3 cases that needed it (07054261, 11022760, SC121467). It kept brackets negative only on net figures, reserves and tax credits, for example prior tax -571000 and -138000.
- **Group vs parent:** In the 4 cases with both statements (05959188, 09727592, NI626135, NI037684) it never mixed the columns up. That held even where the figures differed only slightly, such as intangibles of 14896091 vs 14896135.
- **Creditor notes:** In the tier 4 and 5 cases every creditor line went to the right category. Zero lines came back as 0 with their prior amounts.
- **Zero vs null:** It mostly told "0" apart from "not shown", e.g. share capital of 0 in 11022760.

#### Mistakes it makes

- **Only case needing retries: tier5-12026946, 3 requests.**

  - The first call put `amount: null` on a creditor line that the note showed as "–". It fixed that correctly by using 0.
  - The second call resent only the `parent_company` subtree, and the tool rejected it with `company` missing.
  - The third call sent the full payload and passed.

- **Small inconsistencies in fields that weren't graded:**

  - Current `creditors_after_one_year` was 0 rather than null in SC121467.
  - Group `fixed_assets` was null in NI037684 even though tangible assets were shown.

  Neither affected the score.

## Runs

### tier1-07054261

**Tool calling: passed.** Got single-company full accounts in £000 (Cube Logic) and returned every figure correctly in one `accounts` call, multiplied by 1,000. Passed. ($0.0031, 1 requests, 43 s)
- Right: Scaled £000 figures by 1,000 throughout, e.g. `intangible_assets` 2640000
- Right: Kept negative signs on net figures (`net_current_assets` -8967000, `profit_and_loss_reserve` -8457000) and the prior-year tax credit (-138000)
- Right: Used `null` for lines the accounts don't show (stocks, provisions, creditors_after_one_year)

### tier1-11022760

**Tool calling: passed.** TaskUs Limited, in £000. Passed in one request with all balance sheet and P&L figures correct, including a share capital of 0. ($0.0028, 1 requests, 55 s)
- Right: Returned `called_up_share_capital` as 0 rather than null
- Right: Got prior `total_assets_less_current_liabilities` positive (26107000) while net assets were negative
- Right: Read the large swing in creditors after one year correctly (104000 vs 46695000)

### tier2-11600506

**Tool calling: passed.** Group accounts in whole pounds. Returned group balance sheet and P&L for both years in one call. Passed. ($0.0024, 1 requests, 26 s)
- Right: Took consolidated figures, not the parent's
- Right: Treated tax as a positive charge and the reserves as negative

### tier2-SC121467

**Tool calling: passed.** Scottish group in £000. All group figures were correct in one call, including a prior-year loss and tax credit. Passed. ($0.0037, 1 requests, 72 s)
- Right: Prior `profit_before_tax` -1678000 and tax credit -571000 signed correctly
- Right: Filled in `distribution_costs` where the accounts show them
- Mistake: Gave current `creditors_after_one_year` as 0 instead of null. The field wasn't graded, so it did no harm

### tier3-05959188

**Tool calling: passed.** Group plus parent balance sheets, both years, in one call. Every graded figure matched. Passed. ($0.0029, 1 requests, 29 s)
- Right: Kept group and parent columns apart, e.g. parent `tangible_assets` 9602 vs group 379315
- Right: Parent prior intangibles 14896091 told apart from group 14896135

### tier3-09727592

**Tool calling: passed.** Group plus parent balance sheets. Returned all of them correctly in one request. Passed. ($0.0025, 1 requests, 32 s)
- Right: Parent `investments` 40275 current vs 0 prior, both correct
- Right: Parent prior net assets positive (783514) while the group's were negative, signed correctly

### tier4-05840865

**Tool calling: passed.** Staff costs and creditor breakdowns for group and parent. Classified every creditor line correctly in one call. Passed. ($0.0026, 1 requests, 40 s)
- Right: Mapped the note lines to categories (`amounts_owed_to_group`, `other_tax_and_social_security`, `finance_leases` within and after one year)
- Right: Gave zero lines as 0 with their prior amounts (bank loans 0 / 10251)

### tier4-NI626135

**Tool calling: passed.** NI group with ten creditor lines per entity. Got all of them right in one request. Passed. ($0.0024, 1 requests, 18 s)
- Right: Bank loans after one year returned as 0 with prior 5836
- Right: Group and parent staff costs and creditors kept separate

### tier5-12026946

**Tool calling: passed.** Full group plus parent extraction. The first `accounts` call failed validation because a creditor `amount` was null. The retry sent only `parent_company` and was rejected with `company` missing. The third call sent the full object and passed. ($0.0058, 3 requests, 75 s)
- Right: Read the first validation error correctly: the note showed '–', so it used 0 rather than inventing a number
- Right: All of the 140-odd graded figures came out correct, directors included
- Mistake: Request 1: put `amount: null` on the parent's finance leases due after one year. A '–' in the note should be 0
- Mistake: Request 2: sent a partial object holding only `parent_company`, which wasted a round trip. The tool needs the full payload every time

### tier5-NI037684

**Tool calling: passed.** Medium-sized group accounts with directors, group and parent statements and creditor notes. Passed in one request. ($0.0033, 1 requests, 63 s)
- Right: Classified `accounts_type` as `medium` correctly
- Right: Parent creditor lines that differ slightly from the group's were kept separate (other tax 151765 vs 152260)
- Mistake: Gave group `fixed_assets` as null although tangible assets of 4122359 were shown. The field wasn't graded, so it did no harm
