pub async fn request_structured_output(
provider: &dyn LlmProvider,
structured_request: &StructuredOutputRequest,
) -> Result<Value, RunnerError>Expand description
Request structured JSON output from any provider, with schema validation and retry.
§Flow
- Append schema instructions to the system message
- Call
provider.complete()and extract JSON from the response - Validate against the schema
- On failure, append errors as user feedback and retry up to
max_retries - After exhaustion, return
RunnerError::external_service
§Errors
Returns RunnerError if the provider fails or validation is exhausted.