Gemini batch structured output per request vs Sume per-item schema

Gemini batch requests can each carry a JSON schema. A Sume bulk item is a full run body, so each item can bind its own output_schema; read output on each child.

5 min readSume
All posts

Yes: Gemini's Batch API supports structured outputs, with a JSON schema and response format specified per individual request. Sume's bulk runs work the same way at the item level: each entry in items is the same body as a single run, so every item can bind its own output_schema. What differs is where the typed result lands, because on Sume it appears on each child run's receipt, not in one results file.

Gemini's side is from its Batch API page; Sume's is from Bulk runs and Structured output.

How does Gemini handle schemas inside a batch?

The page says structured outputs are fully supported within batch requests, and that you can specify the schema and response format per request. Inline requests are capped at 20 MB in total and input files at 2 GB, and context caching works at standard caching rates on a cache hit. The turnaround target is 24 hours and results are stored for 6 weeks.

How does a Sume bulk item carry a schema?

Each item is an ordinary create body, so output_schema goes inside the item, next to instruction and input. The queue envelope stays two keys. Items in one queue may use different schemas, but pick one shape per queue unless you need otherwise, because your reader then branches on less. This minimal schema asks only for a title string, which any Format can fill from its closing text.

{
  "concurrency": 2,
  "items": [
    {
      "instruction": "Make a 6 second teaser",
      "input": { "product": "travel mug" },
      "output_schema": {
        "name": "teaser_v1",
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "required": ["title"],
          "properties": { "title": { "type": ["string", "null"] } }
        }
      }
    }
  ]
}

A schema that demands media is also possible; see the structured output page for the built-in media reference. The docs add a URL gate: every URL in output is checked against the media the run really produced.

What changes in the schema rules?

Gemini's page does not list a keyword subset in the text we read, so do not assume a Gemini schema passes on Sume. Sume's schemas must satisfy the OpenAI strict-mode subset: every object has additionalProperties: false, the root is exactly object, oneOf and allOf are rejected, and nullable: true becomes a ["string", "null"] union. A bad item fails the whole bulk create with 400 invalid_request and details.index before any queue exists, so a schema problem on item 40 stops items 1 to 100.

Where do I read each item's typed result?

Not on the queue. The queue item gives index, status, run_id and a generic error. Take the run_id and read GET /v1/format-runs/{run_id}, then check output_error before output, and filled_by to see whether the run wrote the object or a projection rebuilt it.

The projection never sees your input, so an identifier you sent in an item will not round-trip into output on that path. Keep your own row ids beside the queue index, and join on run_id.

Sources

Related posts

More in Formats

All Formats posts

Written by Sume