From 9e774431dd8b5b45d7a26b6b187266486ed18835 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 6 Nov 2025 17:08:03 -0300 Subject: [PATCH] fix: disable sdk retries because we handle retries ourselves --- providers/anthropic/anthropic.go | 2 ++ providers/openai/openai.go | 1 + 2 files changed, 3 insertions(+) diff --git a/providers/anthropic/anthropic.go b/providers/anthropic/anthropic.go index 04e85dc819046f23dc258c464c9973f993ae429b..86c0e03c96e7a10cac7145620c9e6461c6a035f2 100644 --- a/providers/anthropic/anthropic.go +++ b/providers/anthropic/anthropic.go @@ -122,6 +122,8 @@ func WithHTTPClient(client option.HTTPClient) Option { func (a *provider) LanguageModel(ctx context.Context, modelID string) (fantasy.LanguageModel, error) { clientOptions := make([]option.RequestOption, 0, 5+len(a.options.headers)) + clientOptions = append(clientOptions, option.WithMaxRetries(0)) + if a.options.apiKey != "" && !a.options.useBedrock { clientOptions = append(clientOptions, option.WithAPIKey(a.options.apiKey)) } diff --git a/providers/openai/openai.go b/providers/openai/openai.go index f3f20e2751ed1629afb41b169e3dc483ccb9ae57..7f0e8f14d3d95b57ea91f080af50d8fa364d8a27 100644 --- a/providers/openai/openai.go +++ b/providers/openai/openai.go @@ -134,6 +134,7 @@ func WithUseResponsesAPI() Option { // LanguageModel implements fantasy.Provider. func (o *provider) LanguageModel(_ context.Context, modelID string) (fantasy.LanguageModel, error) { openaiClientOptions := make([]option.RequestOption, 0, 5+len(o.options.headers)+len(o.options.sdkOptions)) + openaiClientOptions = append(openaiClientOptions, option.WithMaxRetries(0)) if o.options.apiKey != "" { openaiClientOptions = append(openaiClientOptions, option.WithAPIKey(o.options.apiKey))