Add retryable normalization fallbacks

This commit is contained in:
2026-07-26 01:20:28 +00:00
parent 26bd59a5a2
commit 8a12c56971
9 changed files with 306 additions and 10 deletions

View File

@@ -0,0 +1,7 @@
package contracts
import "errors"
// ErrInvalidStructuredOutput identifies a provider response that cannot satisfy
// the caller's declared structured-output contract.
var ErrInvalidStructuredOutput = errors.New("invalid structured output")

View File

@@ -90,6 +90,15 @@ type TypedNormalizeRequest[T any] struct {
type TypedNormalizeResult[T any] struct {
Value T
Warnings []Warning
Retry *NormalizeRetry
}
// NormalizeRetry asks the framework to retry normalization while retaining a
// safe candidate for acceptance if the retry budget is exhausted.
type NormalizeRetry struct {
ReasonCode string
Message string
FallbackWarnings []Warning
}
type Normalizer[T any] interface {