Skip to content

Commit

Permalink
chore: deprecate more models
Browse files Browse the repository at this point in the history
- claude-3-sonnet-20240229
- claude-2.1
- claude-2.0
  • Loading branch information
RobertCraigie authored and stainless-app[bot] committed Jan 21, 2025

Verified

This commit was signed with the committer’s verified signature.
1 parent c5fb4fc commit a97bd02
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/anthropic/resources/beta/messages/messages.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

from __future__ import annotations

import warnings
from typing import List, Union, Iterable
from functools import partial
from itertools import chain
@@ -34,6 +35,7 @@
from ....types.beta import message_create_params, message_count_tokens_params
from ...._base_client import make_request_options
from ....lib.streaming import BetaMessageStreamManager, BetaAsyncMessageStreamManager
from ...messages.messages import DEPRECATED_MODELS
from ....types.model_param import ModelParam
from ....types.beta.beta_message import BetaMessage
from ....types.anthropic_beta_param import AnthropicBetaParam
@@ -893,6 +895,14 @@ def create(
) -> BetaMessage | Stream[BetaRawMessageStreamEvent]:
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
timeout = 600

if model in DEPRECATED_MODELS:
warnings.warn(
f"The model '{model}' is deprecated and will reach end-of-life on {DEPRECATED_MODELS[model]}.\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.",
DeprecationWarning,
stacklevel=3,
)

extra_headers = {
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
**(extra_headers or {}),
@@ -2061,6 +2071,14 @@ async def create(
) -> BetaMessage | AsyncStream[BetaRawMessageStreamEvent]:
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
timeout = 600

if model in DEPRECATED_MODELS:
warnings.warn(
f"The model '{model}' is deprecated and will reach end-of-life on {DEPRECATED_MODELS[model]}.\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.",
DeprecationWarning,
stacklevel=3,
)

extra_headers = {
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
**(extra_headers or {}),
3 changes: 3 additions & 0 deletions src/anthropic/resources/messages/messages.py
Original file line number Diff line number Diff line change
@@ -52,6 +52,9 @@
"claude-instant-1.1": "November 6th, 2024",
"claude-instant-1.1-100k": "November 6th, 2024",
"claude-instant-1.2": "November 6th, 2024",
"claude-3-sonnet-20240229": "July 21st, 2025",
"claude-2.1": "July 21st, 2025",
"claude-2.0": "July 21st, 2025",
}


0 comments on commit a97bd02

Please sign in to comment.