@@ -42,7 +42,7 @@ def test_anthropic_llm_missing_dependency(mock_import: Mock) -> None:
4242
4343def test_anthropic_invoke_happy_path (mock_anthropic : Mock ) -> None :
4444 mock_anthropic .Anthropic .return_value .messages .create .return_value = MagicMock (
45- content = "generated text"
45+ content = [ MagicMock ( text = "generated text" )]
4646 )
4747 model_params = {"temperature" : 0.3 }
4848 llm = AnthropicLLM ("claude-3-opus-20240229" , model_params = model_params )
@@ -59,7 +59,7 @@ def test_anthropic_invoke_happy_path(mock_anthropic: Mock) -> None:
5959
6060def test_anthropic_invoke_with_message_history_happy_path (mock_anthropic : Mock ) -> None :
6161 mock_anthropic .Anthropic .return_value .messages .create .return_value = MagicMock (
62- content = "generated text"
62+ content = [ MagicMock ( text = "generated text" )]
6363 )
6464 model_params = {"temperature" : 0.3 }
6565 llm = AnthropicLLM (
@@ -87,7 +87,7 @@ def test_anthropic_invoke_with_system_instruction(
8787 mock_anthropic : Mock ,
8888) -> None :
8989 mock_anthropic .Anthropic .return_value .messages .create .return_value = MagicMock (
90- content = "generated text"
90+ content = [ MagicMock ( text = "generated text" )]
9191 )
9292 model_params = {"temperature" : 0.3 }
9393 system_instruction = "You are a helpful assistant."
@@ -115,7 +115,7 @@ def test_anthropic_invoke_with_message_history_and_system_instruction(
115115 mock_anthropic : Mock ,
116116) -> None :
117117 mock_anthropic .Anthropic .return_value .messages .create .return_value = MagicMock (
118- content = "generated text"
118+ content = [ MagicMock ( text = "generated text" )]
119119 )
120120 model_params = {"temperature" : 0.3 }
121121 system_instruction = "You are a helpful assistant."
@@ -147,7 +147,7 @@ def test_anthropic_invoke_with_message_history_validation_error(
147147 mock_anthropic : Mock ,
148148) -> None :
149149 mock_anthropic .Anthropic .return_value .messages .create .return_value = MagicMock (
150- content = "generated text"
150+ content = [ MagicMock ( text = "generated text" )]
151151 )
152152 model_params = {"temperature" : 0.3 }
153153 system_instruction = "You are a helpful assistant."
@@ -170,7 +170,7 @@ def test_anthropic_invoke_with_message_history_validation_error(
170170@pytest .mark .asyncio
171171async def test_anthropic_ainvoke_happy_path (mock_anthropic : Mock ) -> None :
172172 mock_response = AsyncMock ()
173- mock_response .content = "Return text"
173+ mock_response .content = [ MagicMock ( text = "Return text" )]
174174 mock_model = mock_anthropic .AsyncAnthropic .return_value
175175 mock_model .messages .create = AsyncMock (return_value = mock_response )
176176 model_params = {"temperature" : 0.3 }
0 commit comments