Define the schema, pass the input, get a validated object back.
Use a fast, low-cost model like gemini-3.5-flash for high-volume extraction.
The hard part is getting missing fields back as null instead of a hallucinated value. Spell it out in the instructions: “If a field is missing, leave it null. Do not guess.”
Nested objects
Lists of sub-objects work the same way. Define the inner model and reference it.
Pass output_schema=Meeting and the agent returns a Meeting with a populated action_items list.
Per-field confidence
When downstream needs to route uncertain fields to a human, wrap each value in a confidence carrier.
Define the levels in the instructions. Without a rubric the model has nothing to anchor high against medium, and the confidence values come back arbitrary.
OpenAI strict structured output rejects a description on a field whose type is itself a referenced model. Keep Field(..., description=...) off fields typed as a sub-model; put the explanation in a comment or the instructions instead.
Any modality, same pattern
The input argument changes per modality. Use a model that supports both that modality and structured output. See Multimodal inputs for the input arguments.
image_extraction_to_vectordb extends extraction with an embed-and-store step: describe each image into a typed object, flatten it to a searchable string, embed it, and store it in LanceDb for similarity search. See the cookbook.
This recipe needs LanceDb on top of the Google provider:
Next steps
Developer Resources