@@ -312,7 +312,7 @@ func (r *typedRetryModelWrapper[M]) Generate(ctx context.Context, input []M, opt
312312 return r .generateLegacy (ctx , input , opts ... )
313313}
314314
315- func (r * typedRetryModelWrapper [M ]) generateLegacy (ctx context.Context , input []M , opts ... model.Option ) (M , error ) {
315+ func (r * typedRetryModelWrapper [M ]) generateLegacy (ctx context.Context , input []M , opts ... model.Option ) (zero M , _ error ) {
316316 isRetryAble := r .config .IsRetryAble
317317 if isRetryAble == nil {
318318 isRetryAble = defaultIsRetryAble
@@ -330,30 +330,25 @@ func (r *typedRetryModelWrapper[M]) generateLegacy(ctx context.Context, input []
330330 }
331331
332332 if _ , ok := compose .ExtractInterruptInfo (err ); ok {
333- var zero M
334333 return zero , err
335334 }
336335
337336 if errors .Is (err , ErrStreamCanceled ) {
338- var zero M
339337 return zero , err
340338 }
341339
342340 if ! isRetryAble (ctx , err ) {
343- var zero M
344341 return zero , err
345342 }
346343
347344 lastErr = err
348345 if attempt < r .config .MaxRetries {
349346 if err := r .contextAwareSleep (ctx , backoffFunc (ctx , attempt + 1 )); err != nil {
350- var zero M
351347 return zero , err
352348 }
353349 }
354350 }
355351
356- var zero M
357352 return zero , & RetryExhaustedError {LastErr : lastErr , TotalRetries : r .config .MaxRetries }
358353}
359354
@@ -439,7 +434,7 @@ func generateWithShouldRetry(r *typedRetryModelWrapper[*schema.Message], ctx con
439434 break
440435 }
441436
442- applyDecisionForRetry (r , & currentInput , & currentOpts , ctx , decision )
437+ applyDecisionForRetry (& currentInput , & currentOpts , ctx , decision )
443438
444439 delay := decision .Backoff
445440 if delay == 0 {
@@ -576,7 +571,7 @@ func streamWithShouldRetry(r *typedRetryModelWrapper[*schema.Message], ctx conte
576571
577572 lastErr = err
578573 if attempt < r .config .MaxRetries {
579- applyDecisionForRetry (r , & currentInput , & currentOpts , ctx , decision )
574+ applyDecisionForRetry (& currentInput , & currentOpts , ctx , decision )
580575 delay := decision .Backoff
581576 if delay == 0 {
582577 delay = backoffFunc (ctx , attempt + 1 )
@@ -646,7 +641,7 @@ func streamWithShouldRetry(r *typedRetryModelWrapper[*schema.Message], ctx conte
646641 lastErr = verdictErr
647642
648643 if attempt < r .config .MaxRetries {
649- applyDecisionForRetry (r , & currentInput , & currentOpts , ctx , decision )
644+ applyDecisionForRetry (& currentInput , & currentOpts , ctx , decision )
650645 delay := decision .Backoff
651646 if delay == 0 {
652647 delay = backoffFunc (ctx , attempt + 1 )
@@ -660,7 +655,7 @@ func streamWithShouldRetry(r *typedRetryModelWrapper[*schema.Message], ctx conte
660655 return nil , & RetryExhaustedError {LastErr : lastErr , TotalRetries : r .config .MaxRetries }
661656}
662657
663- func applyDecisionForRetry (r * typedRetryModelWrapper [ * schema. Message ], currentInput * []* schema.Message , currentOpts * []model.Option , ctx context.Context , decision * RetryDecision ) {
658+ func applyDecisionForRetry (currentInput * []* schema.Message , currentOpts * []model.Option , ctx context.Context , decision * RetryDecision ) {
664659 if decision .ModifiedInputMessages != nil {
665660 * currentInput = decision .ModifiedInputMessages
666661 if decision .PersistModifiedInputMessages {
0 commit comments