fix: disable sdk retries because we handle retries ourselves

Andrey Nering created

Change summary

providers/anthropic/anthropic.go | 2 ++
providers/openai/openai.go       | 1 +
2 files changed, 3 insertions(+)

Detailed changes

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))
 	}

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))