Support protocol thread configuration

This commit is contained in:
2026-09-12 11:40:28 +02:00
parent 21082e66b3
commit 9177a2660b
6 changed files with 99 additions and 0 deletions
+17
View File
@@ -198,6 +198,23 @@ class OllamaTests(unittest.TestCase):
self.assertFalse(payload["stream"])
self.assertEqual(result.raw_response, raw)
def test_request_omits_num_thread_when_backend_selection_is_requested(self) -> None:
response = Mock()
response.raise_for_status.return_value = None
response.json.return_value = {"response": "# Meeting Protocol"}
with patch.object(ollama.requests, "post", return_value=response) as post:
ollama.generate_once(
"http://localhost:11434",
"qwen3.8:27b",
"prompt",
timeout=30,
num_ctx=32768,
num_predict=8192,
)
payload = post.call_args.kwargs["json"]
self.assertNotIn("num_thread", payload["options"])
def test_malformed_response_failure_without_retry(self) -> None:
response = Mock()
response.raise_for_status.return_value = None