Add retryable normalization fallbacks
This commit is contained in:
7
internal/framework/contracts/errors.go
Normal file
7
internal/framework/contracts/errors.go
Normal 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")
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user