Skip to content

Conversation

@pintonunes
Copy link
Contributor

Summary

Add support for configuring retry behavior through the MaxRetries option in all Claude model implementations (Direct API, Vertex AI, and AWS Bedrock).

Changes

  • Added MaxRetries *int field to the Config struct
  • Updated NewChatModel to apply option.WithMaxRetries() for all three implementations:
    • Direct Anthropic API
    • Google Vertex AI
    • AWS Bedrock
  • Added comprehensive documentation explaining:
    • Default behavior: 2 retries if not specified
    • Set to 0 to disable retries
    • Set to positive integer for custom retry count

Testing

  • All existing tests pass
  • Build successful for all implementations

Usage Example

maxRetries := 3
config := &claude.Config{
    APIKey:     "your-api-key",
    Model:      "claude-3-5-sonnet-20241022",
    MaxTokens:  2000,
    MaxRetries: &maxRetries, // Configure retry behavior
}
model, _ := claude.NewChatModel(ctx, config)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant