You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mock_response.model_dump_json.return_value='{"model":"qwen3:0.6b","created_at":"2025-05-13T18:07:04.508998134Z","done":true,"done_reason":"stop","total_duration":348924420,"load_duration":14321072,"prompt_eval_count":16,"prompt_eval_duration":16770943,"eval_count":21,"eval_duration":317395459,"message":{"role":"assistant","content":"Hello! How are you? I\'m here to help and smile!","images":null,"tool_calls":null}}'
"content": "Hello! How are you? I'm here to help and smile!",
20
-
"images": None,
21
-
"tool_calls": None,
22
-
}
23
-
}[key]
16
+
mock_response.model_dump_json.return_value='{"model":"qwen3:0.6b","created_at":"2025-05-13T18:07:04.508998134Z","done":true,"done_reason":"stop","total_duration":348924420,"load_duration":14321072,"prompt_eval_count":16,"prompt_eval_duration":16770943,"eval_count":21,"eval_duration":317395459,"message":{"role":"assistant","content":"Hello! How are you? I\'m here to help and smile!", "thinking":"Analyzing your request...","images":null,"tool_calls":null}}'
17
+
18
+
mock_response.message=SimpleNamespace(
19
+
role="assistant",
20
+
content="Hello! How are you? I'm here to help and smile!",
self.assertEqual(response, "Hello! How are you? I'm here to help and smile!")
47
+
self.assertEqual(
48
+
response,
49
+
"<think>Analyzing your request...</think>Hello! How are you? I'm here to help and smile!",
50
+
)
46
51
47
52
deftest_ollama_llm_with_mocked_backend(self):
48
53
"""Test OllamaLLM with mocked backend."""
49
54
mock_chat=MagicMock()
50
55
mock_response=MagicMock()
51
-
mock_response.model_dump_json.return_value='{"model":"qwen3:0.6b","created_at":"2025-05-13T18:07:04.508998134Z","done":true,"done_reason":"stop","total_duration":348924420,"load_duration":14321072,"prompt_eval_count":16,"prompt_eval_duration":16770943,"eval_count":21,"eval_duration":317395459,"message":{"role":"assistant","content":"Hello! How are you? I\'m here to help and smile!","images":null,"tool_calls":null}}'
"content": "Hello! How are you? I'm here to help and smile!",
56
-
"images": None,
57
-
"tool_calls": None,
58
-
}
59
-
}[key]
56
+
mock_response.model_dump_json.return_value='{"model":"qwen3:0.6b","created_at":"2025-05-13T18:07:04.508998134Z","done":true,"done_reason":"stop","total_duration":348924420,"load_duration":14321072,"prompt_eval_count":16,"prompt_eval_duration":16770943,"eval_count":21,"eval_duration":317395459,"message":{"role":"assistant","content":"Hello! How are you? I\'m here to help and smile!","thinking":"Analyzing your request...","images":null,"tool_calls":null}}'
57
+
mock_response.message=SimpleNamespace(
58
+
role="assistant",
59
+
content="Hello! How are you? I'm here to help and smile!",
mock_response.model_dump_json.return_value='{"id":"chatcmpl-BWoqIrvOeWdnFVZQUFzCcdVEpJ166","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Hello! I\'m an AI language model created by OpenAI. I\'m here to help answer questions, provide information, and assist with a wide range of topics. How can I assist you today?","role":"assistant"}}],"created":1747161634,"model":"gpt-4o-2024-08-06","object":"chat.completion"}'
16
16
mock_response.choices[0].message.content="Hello! I'm an AI language model created by OpenAI. I'm here to help answer questions, provide information, and assist with a wide range of topics. How can I assist you today?"# fmt: skip
0 commit comments