Skip to main content

Module quality_gate

Module quality_gate 

Source
Expand description

Response quality validation with retry

§Response Quality Gate

QualityGateProvider wraps an inner Box<dyn LlmProvider> and validates each response against a configurable QualityPolicy. If validation fails, the request is retried with feedback appended to help the provider correct its output. After exhausting retries, the last response is returned with finish_reason set to "quality_gate_exhausted".

§Limitations

  • Streaming responses (complete_stream) are passed through without quality checking, since the full content is not available upfront.

Structs§

QualityGateProvider
Wrapper implementing LlmProvider that validates responses and retries on failure.
QualityPolicy
Configurable policy for response quality validation

Enums§

QualityFailure
Reason a response failed quality validation