Skip to main content

run_structured

Function run_structured 

Source
pub async fn run_structured(
    provider: &dyn LlmProvider,
    request: ChatRequest,
    config: StructuredConfig,
) -> Result<StructuredOutput, StructuredOutputError>
Expand description

Run a bounded, schema-validated structured-output exchange against provider.

The request’s response_format must be set; on success the returned StructuredOutput::value is guaranteed to satisfy that schema.

§Errors

Returns a StructuredOutputError when the request is missing a response format, the schema is invalid, the provider errors, or the model fails to produce schema-valid output within StructuredConfig::max_retries.