Extract Structured Data
extract_structured_dataExtract structured JSON from text or files (PDF, image, audio, video) by specifying desired fields in instructions. Optionally constrain output with a JSON schema.
Instructions
Extract structured JSON from text or almost any local file (text/code, PDF, image, audio, video) using Gemini JSON mode. Describe the fields you want in instructions, optionally constrain the output with a json_schema (Gemini/OpenAPI subset). Returns parsed JSON.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instructions | Yes | What to extract, e.g. "invoice number, date, total, and an array of line items". | |
| text | No | The source text to extract from. Provide this or file_path. | |
| file_path | No | Absolute path to a local file to extract from (text/code, PDF, image, audio, video). | |
| json_schema | No | Optional response schema (Gemini OpenAPI subset) to enforce the JSON shape. JSON string or object. | |
| model | No | Model to use (defaults to the configured chat/analysis model). | |
| max_tokens | No | Maximum tokens in response (default 16384). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| success | Yes |