Module schema_util

Source
Expand description

Helpers for turning Rust type information into JSON Schema that can be shipped alongside a prompt. The JSON is produced with schemars and can be forwarded to providers that support structured / function-calling responses (e.g. OpenAI’s response_format = json_schema).

The abstraction is intentionally very small: if you need a more sophisticated setup (e.g. inline- vs. $ref-based schemas, custom serialization logic) you can always bypass this helper and build the schema manually.

Functions§

derive_response_schema
Generate a JSON Schema for the given T inline, i.e. without $ref pointers to external definitions.