marvin’s @ai_model decorator implements something similar to what I had in mind for extracting structured data from an input to a language model.

They also use a phase that I like and may adopt for this approach to formatting the output of a language model:

Format … data declaratively

In most of the examples, structured data is extracted from unstructured input. The docs don’t discuss the use of schema to add additional context to the provided data. I’m curious see if there are use cases for also defining the inputs or if the extraction and mapping can all be done with just a target schema.