Detailed changes
@@ -291,13 +291,12 @@ func (a *anthropicClient) send(ctx context.Context, messages []message.Message,
)
// If there is an error we are going to see if we can retry the call
if err != nil {
- slog.Error("Anthropic API error", "error", err.Error(), "attempt", attempts, "max_retries", maxRetries)
retry, after, retryErr := a.shouldRetry(attempts, err)
if retryErr != nil {
return nil, retryErr
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
return nil, ctx.Err()
@@ -446,7 +445,7 @@ func (a *anthropicClient) stream(ctx context.Context, messages []message.Message
return
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
// context cancelled
@@ -216,7 +216,7 @@ func (g *geminiClient) send(ctx context.Context, messages []message.Message, too
return nil, retryErr
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
return nil, ctx.Err()
@@ -327,7 +327,7 @@ func (g *geminiClient) stream(ctx context.Context, messages []message.Message, t
return
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
if ctx.Err() != nil {
@@ -282,7 +282,7 @@ func (o *openaiClient) send(ctx context.Context, messages []message.Message, too
return nil, retryErr
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
return nil, ctx.Err()
@@ -463,7 +463,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
return
}
if retry {
- slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries)
+ slog.Warn("Retrying due to rate limit", "attempt", attempts, "max_retries", maxRetries, "error", err)
select {
case <-ctx.Done():
// context cancelled