Improve semantic reconciliation retries
This commit is contained in:
@@ -30,5 +30,14 @@ func validateNormalizeRetry(retry *contracts.NormalizeRetry) error {
|
||||
if len(retry.Message) > contracts.MaxNormalizeRetryMessageBytes {
|
||||
return errors.New("normalize retry directive message exceeds maximum length")
|
||||
}
|
||||
if !utf8.ValidString(retry.CorrectionGuidance) {
|
||||
return errors.New("normalize retry directive correction guidance has invalid UTF-8")
|
||||
}
|
||||
if retry.CorrectionGuidance != "" && strings.TrimSpace(retry.CorrectionGuidance) == "" {
|
||||
return errors.New("normalize retry directive correction guidance is blank")
|
||||
}
|
||||
if len(retry.CorrectionGuidance) > contracts.MaxNormalizeRetryCorrectionGuidanceBytes {
|
||||
return errors.New("normalize retry directive correction guidance exceeds maximum length")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user