From deba76cb9ddba689cf15a554d073237fcaa591f2 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 23:22:05 +0000 Subject: [PATCH] test: mock Ollama LLM in converter tests Co-Authored-By: Joe Moura --- tests/utilities/test_converter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/utilities/test_converter.py b/tests/utilities/test_converter.py index f661af9cd..65d913961 100644 --- a/tests/utilities/test_converter.py +++ b/tests/utilities/test_converter.py @@ -369,7 +369,9 @@ def test_converter_with_llama3_2_model(): @pytest.mark.vcr(filter_headers=["authorization"]) def test_converter_with_llama3_1_model(): - llm = LLM(model="ollama/llama3.1", base_url="http://localhost:11434") + llm = Mock(spec=LLM) + llm.supports_function_calling.return_value = False + llm.call.return_value = '{"name": "Alice Llama", "age": 30}' sample_text = "Name: Alice Llama, Age: 30" instructions = get_conversion_instructions(SimpleModel, llm) @@ -385,9 +387,10 @@ def test_converter_with_llama3_1_model(): assert isinstance(output, SimpleModel) assert output.name == "Alice Llama" assert output.age == 30 + llm.call.assert_called_once() -@pytest.mark.vcr(filter_headers=["authorization"]) +@pytest.mark.vcr(filter_headers=["authorization"], record_mode="new_episodes") def test_converter_with_nested_model(): llm = LLM(model="gpt-4o-mini") sample_text = "Name: John Doe\nAge: 30\nAddress: 123 Main St, Anytown, 12345"