Migrate Claude 2.1 Requests to Claude 3.5 Sonnet via Adapter
Background
Anthropic is deprecating older Claude model versions, including Claude 2.1. To ensure continued functionality and leverage the improvements of newer models, we need to migrate away from Claude 2.1. However, to maintain backward compatibility for existing clients potentially still requesting claude-2.1, we are implementing an adapter in AI Gateway.
Proposed change
This change introduces an adapter in the AI Gateway to handle requests specifically targeting the deprecated claude-2.1 model. Instead of removing claude-2.1 entirely, the adapter transparently redirects these requests to claude-3-5-sonnet-20241022. This ensures that:
- Existing clients requesting
claude-2.1will continue to receive responses, preventing breakage. - Users will benefit from the improved performance and capabilities of Claude 3.5 Sonnet without requiring immediate client-side changes.
The adapter logic will be implemented in models/container.py within the anthropic_claude provider.
Impact
No user-facing impact: Existing integrations relying on claude-2.1 will continue to function seamlessly.
Improved model usage: Requests will now be routed to the more performant and up-to-date claude-3-5-sonnet-20241022 model.
Simplified codebase (future): This change is a step towards eventually removing the deprecated AnthropicModel class entirely in future iterations.