Types
alloy.types ¶
to_json_schema ¶
to_json_schema(tp)
Best-effort JSON Schema generator for output types.
Supports primitives, dataclasses (with postponed annotations), and nested lists/dicts. Falls back to None for complex generics/Unions so callers can avoid forcing a schema when not strictly necessary.
parse_output ¶
parse_output(tp, raw)
Parse model output into the requested type.
Attempts JSON decoding first, then recursively coerces to the requested type.