Sycophant.ResponseValidator
(sycophant v0.4.2)
Copy Markdown
Validates LLM response text against a JSON Schema.
Used by Sycophant.generate_object/3 to parse the response as JSON and
optionally validate it against the provided NormalizedSchema. The validated
(or raw) map is placed in response.object.
When :validate is false, the JSON is parsed but not validated against
the schema, allowing schema-as-hint usage where strict validation isn't needed.
Summary
Functions
Validates and parses LLM response text against an optional schema.
Functions
@spec validate( Sycophant.Response.t(), Sycophant.Schema.NormalizedSchema.t(), boolean() ) :: {:ok, Sycophant.Response.t()} | {:error, Splode.Error.t()}
Validates and parses LLM response text against an optional schema.