mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-20 08:30:42 +00:00
refactor: remove references to unsupported model claude-3-sonnet-20240229
(#32281)
Addresses some (but not all) test issues brought about in #32280
This commit is contained in:
@@ -7,14 +7,7 @@ import warnings
|
||||
from collections.abc import AsyncIterator, Iterator, Mapping, Sequence
|
||||
from functools import cached_property
|
||||
from operator import itemgetter
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Literal,
|
||||
Optional,
|
||||
Union,
|
||||
cast,
|
||||
)
|
||||
from typing import Any, Callable, Literal, Optional, Union, cast
|
||||
|
||||
import anthropic
|
||||
from langchain_core._api import beta, deprecated
|
||||
@@ -42,33 +35,16 @@ from langchain_core.messages import (
|
||||
)
|
||||
from langchain_core.messages.ai import InputTokenDetails, UsageMetadata
|
||||
from langchain_core.messages.tool import tool_call_chunk as create_tool_call_chunk
|
||||
from langchain_core.output_parsers import (
|
||||
JsonOutputKeyToolsParser,
|
||||
PydanticToolsParser,
|
||||
)
|
||||
from langchain_core.output_parsers import JsonOutputKeyToolsParser, PydanticToolsParser
|
||||
from langchain_core.output_parsers.base import OutputParserLike
|
||||
from langchain_core.outputs import ChatGeneration, ChatGenerationChunk, ChatResult
|
||||
from langchain_core.runnables import (
|
||||
Runnable,
|
||||
RunnableMap,
|
||||
RunnablePassthrough,
|
||||
)
|
||||
from langchain_core.runnables import Runnable, RunnableMap, RunnablePassthrough
|
||||
from langchain_core.tools import BaseTool
|
||||
from langchain_core.utils import (
|
||||
from_env,
|
||||
get_pydantic_field_names,
|
||||
secret_from_env,
|
||||
)
|
||||
from langchain_core.utils import from_env, get_pydantic_field_names, secret_from_env
|
||||
from langchain_core.utils.function_calling import convert_to_openai_tool
|
||||
from langchain_core.utils.pydantic import is_basemodel_subclass
|
||||
from langchain_core.utils.utils import _build_model_kwargs
|
||||
from pydantic import (
|
||||
BaseModel,
|
||||
ConfigDict,
|
||||
Field,
|
||||
SecretStr,
|
||||
model_validator,
|
||||
)
|
||||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, model_validator
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
from langchain_anthropic._client_utils import (
|
||||
@@ -517,7 +493,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
|
||||
Key init args — completion params:
|
||||
model: str
|
||||
Name of Anthropic model to use. e.g. ``'claude-3-sonnet-20240229'``.
|
||||
Name of Anthropic model to use. e.g. ``'claude-3-7-sonnet-20250219'``.
|
||||
temperature: float
|
||||
Sampling temperature. Ranges from ``0.0`` to ``1.0``.
|
||||
max_tokens: int
|
||||
@@ -543,7 +519,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
from langchain_anthropic import ChatAnthropic
|
||||
|
||||
llm = ChatAnthropic(
|
||||
model="claude-3-sonnet-20240229",
|
||||
model="claude-3-7-sonnet-20250219",
|
||||
temperature=0,
|
||||
max_tokens=1024,
|
||||
timeout=None,
|
||||
@@ -583,7 +559,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AIMessage(content="J'aime la programmation.", response_metadata={'id': 'msg_01Trik66aiQ9Z1higrD5XFx3', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 25, 'output_tokens': 11}}, id='run-5886ac5f-3c2e-49f5-8a44-b1e92808c929-0', usage_metadata={'input_tokens': 25, 'output_tokens': 11, 'total_tokens': 36})
|
||||
AIMessage(content="J'aime la programmation.", response_metadata={'id': 'msg_01Trik66aiQ9Z1higrD5XFx3', 'model': 'claude-3-7-sonnet-20250219', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 25, 'output_tokens': 11}}, id='run-5886ac5f-3c2e-49f5-8a44-b1e92808c929-0', usage_metadata={'input_tokens': 25, 'output_tokens': 11, 'total_tokens': 36})
|
||||
|
||||
Stream:
|
||||
.. code-block:: python
|
||||
@@ -627,7 +603,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AIMessage(content="J'aime la programmation.", response_metadata={'id': 'msg_01Trik66aiQ9Z1higrD5XFx3', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 25, 'output_tokens': 11}}, id='run-5886ac5f-3c2e-49f5-8a44-b1e92808c929-0', usage_metadata={'input_tokens': 25, 'output_tokens': 11, 'total_tokens': 36})
|
||||
AIMessage(content="J'aime la programmation.", response_metadata={'id': 'msg_01Trik66aiQ9Z1higrD5XFx3', 'model': 'claude-3-7-sonnet-20250219', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 25, 'output_tokens': 11}}, id='run-5886ac5f-3c2e-49f5-8a44-b1e92808c929-0', usage_metadata={'input_tokens': 25, 'output_tokens': 11, 'total_tokens': 36})
|
||||
|
||||
Tool calling:
|
||||
.. code-block:: python
|
||||
@@ -1156,7 +1132,7 @@ class ChatAnthropic(BaseChatModel):
|
||||
.. code-block:: python
|
||||
|
||||
{'id': 'msg_013xU6FHEGEq76aP4RgFerVT',
|
||||
'model': 'claude-3-sonnet-20240229',
|
||||
'model': 'claude-3-7-sonnet-20250219',
|
||||
'stop_reason': 'end_turn',
|
||||
'stop_sequence': None,
|
||||
'usage': {'input_tokens': 25, 'output_tokens': 11}}
|
||||
|
Reference in New Issue
Block a user