2121)
2222
2323_ANTHROPIC_LOCATION = "us-east5"
24- _ANTHROPIC_CLAUDE35_MODEL_NAME = "claude-3-5- sonnet-v2@20241022 "
24+ _ANTHROPIC_CLAUDE_MODEL_NAME = "claude-sonnet-4-5@20250929 "
2525
2626
2727@pytest .mark .extended
@@ -123,9 +123,7 @@ def test_anthropic() -> None:
123123 )
124124 context = SystemMessage (content = raw_context )
125125 message = HumanMessage (content = question )
126- response = model .invoke (
127- [context , message ], model_name = _ANTHROPIC_CLAUDE35_MODEL_NAME
128- )
126+ response = model .invoke ([context , message ], model_name = _ANTHROPIC_CLAUDE_MODEL_NAME )
129127 assert isinstance (response , AIMessage )
130128 assert isinstance (response .content , str )
131129
@@ -142,7 +140,7 @@ def test_anthropic_stream() -> None:
142140 "Hello, could you recommend a good movie for me to watch this evening, please?"
143141 )
144142 message = HumanMessage (content = question )
145- sync_response = model .stream ([message ], model = _ANTHROPIC_CLAUDE35_MODEL_NAME )
143+ sync_response = model .stream ([message ], model = _ANTHROPIC_CLAUDE_MODEL_NAME )
146144 for chunk in sync_response :
147145 assert isinstance (chunk , AIMessageChunk )
148146
@@ -166,7 +164,7 @@ def test_anthropic_thinking_stream() -> None:
166164 "Hello, could you recommend a good movie for me to watch this evening, please?"
167165 )
168166 message = HumanMessage (content = question )
169- sync_response = model .stream ([message ], model = "claude-3-7-sonnet@20250219 " )
167+ sync_response = model .stream ([message ], model = "claude-sonnet-4-5@20250929 " )
170168 for chunk in sync_response :
171169 assert isinstance (chunk , AIMessageChunk )
172170
@@ -189,7 +187,7 @@ async def test_anthropic_async() -> None:
189187 context = SystemMessage (content = raw_context )
190188 message = HumanMessage (content = question )
191189 response = await model .ainvoke (
192- [context , message ], model_name = _ANTHROPIC_CLAUDE35_MODEL_NAME , temperature = 0.2
190+ [context , message ], model_name = _ANTHROPIC_CLAUDE_MODEL_NAME , temperature = 0.2
193191 )
194192 assert isinstance (response , AIMessage )
195193 assert isinstance (response .content , str )
@@ -223,7 +221,7 @@ class MyModel(BaseModel):
223221 # Test .bind_tools with BaseModel
224222 message = HumanMessage (content = "My name is Erick and I am 27 years old" )
225223 model_with_tools = model .bind_tools (
226- [MyModel ], model_name = _ANTHROPIC_CLAUDE35_MODEL_NAME
224+ [MyModel ], model_name = _ANTHROPIC_CLAUDE_MODEL_NAME
227225 )
228226 response = model_with_tools .invoke ([message ])
229227 _check_tool_calls (response , "MyModel" )
@@ -233,7 +231,7 @@ def my_model(name: str, age: int) -> None:
233231 """Invoke this with names and ages."""
234232
235233 model_with_tools = model .bind_tools (
236- [my_model ], model_name = _ANTHROPIC_CLAUDE35_MODEL_NAME
234+ [my_model ], model_name = _ANTHROPIC_CLAUDE_MODEL_NAME
237235 )
238236 response = model_with_tools .invoke ([message ])
239237 _check_tool_calls (response , "my_model" )
@@ -244,7 +242,7 @@ def my_tool(name: str, age: int) -> None:
244242 """Invoke this with names and ages."""
245243
246244 model_with_tools = model .bind_tools (
247- [my_tool ], model_name = _ANTHROPIC_CLAUDE35_MODEL_NAME
245+ [my_tool ], model_name = _ANTHROPIC_CLAUDE_MODEL_NAME
248246 )
249247 response = model_with_tools .invoke ([message ])
250248 _check_tool_calls (response , "my_tool" )
@@ -274,7 +272,7 @@ def test_anthropic_with_structured_output() -> None:
274272 model = ChatAnthropicVertex (
275273 project = project ,
276274 location = location ,
277- model = _ANTHROPIC_CLAUDE35_MODEL_NAME ,
275+ model = _ANTHROPIC_CLAUDE_MODEL_NAME ,
278276 )
279277
280278 class MyModel (BaseModel ):
@@ -303,7 +301,7 @@ def test_anthropic_multiturn_tool_calling() -> None:
303301 model = ChatAnthropicVertex (
304302 project = project ,
305303 location = location ,
306- model = _ANTHROPIC_CLAUDE35_MODEL_NAME ,
304+ model = _ANTHROPIC_CLAUDE_MODEL_NAME ,
307305 )
308306
309307 @tool
@@ -349,7 +347,7 @@ def test_anthropic_tool_error_handling() -> None:
349347 model = ChatAnthropicVertex (
350348 project = project ,
351349 location = location ,
352- model = _ANTHROPIC_CLAUDE35_MODEL_NAME ,
350+ model = _ANTHROPIC_CLAUDE_MODEL_NAME ,
353351 )
354352
355353 @tool
0 commit comments