@@ -70,7 +70,7 @@ def mock_anthropic_completion():
7070 completion = Message (
7171 id = "foo" ,
7272 type = "message" ,
73- model = "claude-3-5 -sonnet-20240620 " ,
73+ model = "claude-3-7 -sonnet-latest " ,
7474 role = "assistant" ,
7575 content = [TextBlockParam (type = "text" , text = "Hello! I'm Claude." )],
7676 stop_reason = "end_turn" ,
@@ -88,7 +88,7 @@ def test_init_default(self, monkeypatch):
8888 monkeypatch .setenv ("ANTHROPIC_API_KEY" , "test-api-key" )
8989 component = AnthropicChatGenerator ()
9090 assert component .client .api_key == "test-api-key"
91- assert component .model == "claude-3-5 -sonnet-20240620 "
91+ assert component .model == "claude-3-7 -sonnet-latest "
9292 assert component .streaming_callback is None
9393 assert not component .generation_kwargs
9494 assert component .tools is None
@@ -121,13 +121,13 @@ def test_init_with_parameters(self, monkeypatch):
121121 monkeypatch .setenv ("OPENAI_MAX_RETRIES" , "10" )
122122 component = AnthropicChatGenerator (
123123 api_key = Secret .from_token ("test-api-key" ),
124- model = "claude-3-5 -sonnet-20240620 " ,
124+ model = "claude-3-7 -sonnet-latest " ,
125125 streaming_callback = print_streaming_chunk ,
126126 generation_kwargs = {"max_tokens" : 10 , "some_test_param" : "test-params" },
127127 tools = [tool ],
128128 )
129129 assert component .client .api_key == "test-api-key"
130- assert component .model == "claude-3-5 -sonnet-20240620 "
130+ assert component .model == "claude-3-7 -sonnet-latest "
131131 assert component .streaming_callback is print_streaming_chunk
132132 assert component .generation_kwargs == {"max_tokens" : 10 , "some_test_param" : "test-params" }
133133 assert component .tools == [tool ]
@@ -139,13 +139,13 @@ def test_init_with_parameters_and_env_vars(self, monkeypatch):
139139 monkeypatch .setenv ("OPENAI_TIMEOUT" , "100" )
140140 monkeypatch .setenv ("OPENAI_MAX_RETRIES" , "10" )
141141 component = AnthropicChatGenerator (
142- model = "claude-3-5 -sonnet-20240620 " ,
142+ model = "claude-3-7 -sonnet-latest " ,
143143 api_key = Secret .from_token ("test-api-key" ),
144144 streaming_callback = print_streaming_chunk ,
145145 generation_kwargs = {"max_tokens" : 10 , "some_test_param" : "test-params" },
146146 )
147147 assert component .client .api_key == "test-api-key"
148- assert component .model == "claude-3-5 -sonnet-20240620 "
148+ assert component .model == "claude-3-7 -sonnet-latest "
149149 assert component .streaming_callback is print_streaming_chunk
150150 assert component .generation_kwargs == {"max_tokens" : 10 , "some_test_param" : "test-params" }
151151
@@ -160,7 +160,7 @@ def test_to_dict_default(self, monkeypatch):
160160 "type" : "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator" ,
161161 "init_parameters" : {
162162 "api_key" : {"env_vars" : ["ANTHROPIC_API_KEY" ], "type" : "env_var" , "strict" : True },
163- "model" : "claude-3-5 -sonnet-20240620 " ,
163+ "model" : "claude-3-7 -sonnet-latest " ,
164164 "streaming_callback" : None ,
165165 "ignore_tools_thinking_messages" : True ,
166166 "generation_kwargs" : {},
@@ -179,7 +179,7 @@ def test_to_dict_with_parameters(self, monkeypatch):
179179 monkeypatch .setenv ("ENV_VAR" , "test-api-key" )
180180 component = AnthropicChatGenerator (
181181 api_key = Secret .from_env_var ("ENV_VAR" ),
182- model = "claude-3-5 -sonnet-20240620 " ,
182+ model = "claude-3-7 -sonnet-latest " ,
183183 streaming_callback = print_streaming_chunk ,
184184 generation_kwargs = {"max_tokens" : 10 , "some_test_param" : "test-params" },
185185 tools = [tool ],
@@ -192,7 +192,7 @@ def test_to_dict_with_parameters(self, monkeypatch):
192192 "type" : "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator" ,
193193 "init_parameters" : {
194194 "api_key" : {"env_vars" : ["ENV_VAR" ], "type" : "env_var" , "strict" : True },
195- "model" : "claude-3-5 -sonnet-20240620 " ,
195+ "model" : "claude-3-7 -sonnet-latest " ,
196196 "streaming_callback" : "haystack.components.generators.utils.print_streaming_chunk" ,
197197 "ignore_tools_thinking_messages" : True ,
198198 "generation_kwargs" : {"max_tokens" : 10 , "some_test_param" : "test-params" },
@@ -236,7 +236,7 @@ def test_from_dict(self, monkeypatch):
236236 "type" : "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator" ,
237237 "init_parameters" : {
238238 "api_key" : {"env_vars" : ["ANTHROPIC_API_KEY" ], "type" : "env_var" , "strict" : True },
239- "model" : "claude-3-5 -sonnet-20240620 " ,
239+ "model" : "claude-3-7 -sonnet-latest " ,
240240 "streaming_callback" : "haystack.components.generators.utils.print_streaming_chunk" ,
241241 "generation_kwargs" : {"max_tokens" : 10 , "some_test_param" : "test-params" },
242242 "tools" : [
@@ -259,7 +259,7 @@ def test_from_dict(self, monkeypatch):
259259 component = AnthropicChatGenerator .from_dict (data )
260260
261261 assert isinstance (component , AnthropicChatGenerator )
262- assert component .model == "claude-3-5 -sonnet-20240620 "
262+ assert component .model == "claude-3-7 -sonnet-latest "
263263 assert component .streaming_callback is print_streaming_chunk
264264 assert component .generation_kwargs == {"max_tokens" : 10 , "some_test_param" : "test-params" }
265265 assert component .api_key == Secret .from_env_var ("ANTHROPIC_API_KEY" )
@@ -276,7 +276,7 @@ def test_from_dict_fail_wo_env_var(self, monkeypatch):
276276 "type" : "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator" ,
277277 "init_parameters" : {
278278 "api_key" : {"env_vars" : ["ANTHROPIC_API_KEY" ], "type" : "env_var" , "strict" : True },
279- "model" : "claude-3-5 -sonnet-20240620 " ,
279+ "model" : "claude-3-7 -sonnet-latest " ,
280280 "streaming_callback" : "haystack.components.generators.utils.print_streaming_chunk" ,
281281 "generation_kwargs" : {"max_tokens" : 10 , "some_test_param" : "test-params" },
282282 },
@@ -316,7 +316,7 @@ def test_run_with_params(self, chat_messages, mock_anthropic_completion):
316316 assert len (response ["replies" ]) == 1
317317 assert isinstance (response ["replies" ][0 ], ChatMessage )
318318 assert "Hello! I'm Claude." in response ["replies" ][0 ].text
319- assert response ["replies" ][0 ].meta ["model" ] == "claude-3-5 -sonnet-20240620 "
319+ assert response ["replies" ][0 ].meta ["model" ] == "claude-3-7 -sonnet-latest "
320320 assert response ["replies" ][0 ].meta ["finish_reason" ] == "end_turn"
321321
322322 def test_check_duplicate_tool_names (self , tools ):
@@ -350,7 +350,7 @@ def test_convert_anthropic_chunk_to_streaming_chunk(self):
350350 "type" : "message" ,
351351 "role" : "assistant" ,
352352 "content" : [],
353- "model" : "claude-3-5 -sonnet-20240620 " ,
353+ "model" : "claude-3-7 -sonnet-latest " ,
354354 "stop_reason" : None ,
355355 "stop_sequence" : None ,
356356 "usage" : {"input_tokens" : 25 , "output_tokens" : 1 },
@@ -371,7 +371,7 @@ def test_convert_anthropic_chunk_to_streaming_chunk(self):
371371 "type" : "message" ,
372372 "role" : "assistant" ,
373373 "content" : [],
374- "model" : "claude-3-5 -sonnet-20240620 " ,
374+ "model" : "claude-3-7 -sonnet-latest " ,
375375 "stop_reason" : None ,
376376 "stop_sequence" : None ,
377377 "usage" : {
@@ -702,7 +702,7 @@ def test_serde_in_pipeline(self):
702702
703703 generator = AnthropicChatGenerator (
704704 api_key = Secret .from_env_var ("ANTHROPIC_API_KEY" , strict = False ),
705- model = "claude-3-5 -sonnet-20240620 " ,
705+ model = "claude-3-7 -sonnet-latest " ,
706706 generation_kwargs = {"temperature" : 0.6 },
707707 tools = [tool ],
708708 )
@@ -722,7 +722,7 @@ def test_serde_in_pipeline(self):
722722 "type" : type_ ,
723723 "init_parameters" : {
724724 "api_key" : {"type" : "env_var" , "env_vars" : ["ANTHROPIC_API_KEY" ], "strict" : False },
725- "model" : "claude-3-5 -sonnet-20240620 " ,
725+ "model" : "claude-3-7 -sonnet-latest " ,
726726 "generation_kwargs" : {"temperature" : 0.6 },
727727 "ignore_tools_thinking_messages" : True ,
728728 "streaming_callback" : None ,
@@ -784,7 +784,7 @@ def test_live_run(self):
784784 assert len (results ["replies" ]) == 1
785785 message : ChatMessage = results ["replies" ][0 ]
786786 assert "Paris" in message .text
787- assert "claude-3-5 -sonnet-20240620 " in message .meta ["model" ]
787+ assert "claude-3-7 -sonnet-latest " in message .meta ["model" ]
788788 assert message .meta ["finish_reason" ] == "end_turn"
789789
790790 @pytest .mark .skipif (
@@ -824,7 +824,7 @@ def __call__(self, chunk: StreamingChunk) -> None:
824824 message : ChatMessage = results ["replies" ][0 ]
825825 assert "Paris" in message .text
826826
827- assert "claude-3-5 -sonnet-20240620 " in message .meta ["model" ]
827+ assert "claude-3-7 -sonnet-latest " in message .meta ["model" ]
828828 assert message .meta ["finish_reason" ] == "end_turn"
829829
830830 assert callback .counter > 1
@@ -1317,7 +1317,7 @@ def test_from_dict_with_prompt_caching(self, monkeypatch):
13171317 "type" : "haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator" ,
13181318 "init_parameters" : {
13191319 "api_key" : {"env_vars" : ["ANTHROPIC_API_KEY" ], "strict" : True , "type" : "env_var" },
1320- "model" : "claude-3-5 -sonnet-20240620 " ,
1320+ "model" : "claude-3-7 -sonnet-latest " ,
13211321 "generation_kwargs" : {"extra_headers" : {"anthropic-beta" : "prompt-caching-2024-07-31" }},
13221322 },
13231323 }
@@ -1364,7 +1364,7 @@ async def mock_anthropic_completion_async(self):
13641364 completion = Message (
13651365 id = "foo" ,
13661366 type = "message" ,
1367- model = "claude-3-5 -sonnet-20240620 " ,
1367+ model = "claude-3-7 -sonnet-latest " ,
13681368 role = "assistant" ,
13691369 content = [TextBlockParam (type = "text" , text = "Hello! I'm Claude." )],
13701370 stop_reason = "end_turn" ,
@@ -1380,7 +1380,7 @@ async def mock_anthropic_completion_async_with_tool(self):
13801380 completion = Message (
13811381 id = "foo" ,
13821382 type = "message" ,
1383- model = "claude-3-5 -sonnet-20240620 " ,
1383+ model = "claude-3-7 -sonnet-latest " ,
13841384 role = "assistant" ,
13851385 content = [
13861386 TextBlockParam (type = "text" , text = "Let me check the weather for you." ),
@@ -1431,7 +1431,7 @@ async def test_run_async_with_params(self, chat_messages, mock_anthropic_complet
14311431 assert len (response ["replies" ]) == 1
14321432 assert isinstance (response ["replies" ][0 ], ChatMessage )
14331433 assert "Hello! I'm Claude." in response ["replies" ][0 ].text
1434- assert response ["replies" ][0 ].meta ["model" ] == "claude-3-5 -sonnet-20240620 "
1434+ assert response ["replies" ][0 ].meta ["model" ] == "claude-3-7 -sonnet-latest "
14351435 assert response ["replies" ][0 ].meta ["finish_reason" ] == "end_turn"
14361436
14371437 @pytest .mark .asyncio
@@ -1449,7 +1449,7 @@ async def test_live_run_async(self):
14491449 assert len (results ["replies" ]) == 1
14501450 message : ChatMessage = results ["replies" ][0 ]
14511451 assert "Paris" in message .text
1452- assert "claude-3-5 -sonnet-20240620 " in message .meta ["model" ]
1452+ assert "claude-3-7 -sonnet-latest " in message .meta ["model" ]
14531453 assert message .meta ["finish_reason" ] == "end_turn"
14541454
14551455 @pytest .mark .asyncio
@@ -1482,7 +1482,7 @@ async def callback(chunk: StreamingChunk) -> None:
14821482 assert len (results ["replies" ]) == 1
14831483 message = results ["replies" ][0 ]
14841484 assert "paris" in message .text .lower ()
1485- assert "claude-3-5 -sonnet-20240620 " in message .meta ["model" ]
1485+ assert "claude-3-7 -sonnet-latest " in message .meta ["model" ]
14861486 assert message .meta ["finish_reason" ] == "end_turn"
14871487
14881488 # Verify streaming behavior
0 commit comments