LLM Error Handling and Retries
Guardrails currently performs automatic retries with exponential backoff when any of the following errors occur when calling the LLM:- openai.error.APIConnectionError
- openai.error.APIError
- openai.error.TryAgain
- openai.error.Timeout
- openai.error.RateLimitError
- openai.error.ServiceUnavailableError
- An incorrect structure was returned from the LLM
Validator OnFailActions
Guardrails provides a number ofOnFailActions for when a validator fails. The OnFailAction specifies the corrective action that should be taken if the quality criteria is not met. The corrective action can be one of the following:
Custom OnFailActions can also be implemented, see the
custom section in the how to use on fail actions guide.
Guidance on dealing with Validator errors
When a validator fails, Guardrails does two things- logs the failure in history (accessible via
guard.history.last.failed_validations) - takes the corrective action specified by the
on_failaction on the validator