From b16578fbce477899a60802be03088b9061970240 Mon Sep 17 00:00:00 2001 From: "open-swe[bot]" Date: Wed, 6 Aug 2025 16:51:41 +0000 Subject: [PATCH] Apply patch [skip ci] --- .../tests/unit_tests/test_chat_models_gpt_oss.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/partners/ollama/tests/unit_tests/test_chat_models_gpt_oss.py b/libs/partners/ollama/tests/unit_tests/test_chat_models_gpt_oss.py index b1f1e5ed345..a575442e2ad 100644 --- a/libs/partners/ollama/tests/unit_tests/test_chat_models_gpt_oss.py +++ b/libs/partners/ollama/tests/unit_tests/test_chat_models_gpt_oss.py @@ -376,11 +376,19 @@ class TestChatParamsWithGptOss: def test_chat_params_with_harmony_tools(self) -> None: """Test that _chat_params correctly formats tools for gpt-oss.""" llm = ChatOllama(model="gpt-oss:20b") + + # Bind tools - this adds tools to kwargs llm_with_tools = llm.bind_tools([get_weather]) - # Get chat params + # Get chat params - tools are passed through kwargs messages = [HumanMessage(content="What's the weather?")] - params = llm_with_tools._chat_params(messages) + + # The tools are in the bound model's kwargs + assert hasattr(llm_with_tools, "kwargs") + assert "tools" in llm_with_tools.kwargs + + # When _chat_params is called, it should include the tools from kwargs + params = llm_with_tools._chat_params(messages, **llm_with_tools.kwargs) # Check that tools are included and in Harmony format assert "tools" in params @@ -406,3 +414,4 @@ class TestChatParamsWithGptOss: +