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