@@ -1509,7 +1509,10 @@ def test_live_run_with_repeated_tool_calls(self, tools, streaming_callback):
15091509 component = OllamaChatGenerator (model = "qwen3:0.6b" , tools = tools , streaming_callback = streaming_callback )
15101510 tool_invoker = ToolInvoker (tools = tools )
15111511
1512- messages = [ChatMessage .from_user ("What is the weather in Paris and London?" )]
1512+ messages = [
1513+ ChatMessage .from_system ("Use the tools to answer the question." ),
1514+ ChatMessage .from_user ("What is the weather in Paris and London?" ),
1515+ ]
15131516 response = component .run (messages )
15141517
15151518 assert len (response ["replies" ]) == 1
@@ -1538,9 +1541,12 @@ def test_live_run_with_tools_and_format(self, tools):
15381541 "required" : ["capital" , "population" ],
15391542 }
15401543 chat_generator = OllamaChatGenerator (model = "qwen3:0.6b" , tools = tools , response_format = response_format )
1541- message = ChatMessage .from_user ("What's the weather in Paris?" )
1544+ messages = [
1545+ ChatMessage .from_system ("Use the tools to answer the question." ),
1546+ ChatMessage .from_user ("What's the weather in Paris?" ),
1547+ ]
15421548
1543- result = chat_generator .run ([ message ] )
1549+ result = chat_generator .run (messages )
15441550
15451551 assert isinstance (result , dict )
15461552 assert isinstance (result ["replies" ], list )
@@ -1569,8 +1575,11 @@ def population(city: Annotated[str, "The city to get the population for"]) -> st
15691575 mixed_tools = [tools [0 ], population_toolset ]
15701576 component = OllamaChatGenerator (model = "qwen3:0.6b" , tools = mixed_tools , streaming_callback = streaming_callback )
15711577
1572- message = ChatMessage .from_user ("What is the weather and population in Paris?" )
1573- response = component .run ([message ])
1578+ messages = [
1579+ ChatMessage .from_system ("Use the tools to answer the question." ),
1580+ ChatMessage .from_user ("What is the weather and population in Paris?" ),
1581+ ]
1582+ response = component .run (messages )
15741583
15751584 assert len (response ["replies" ]) == 1
15761585 message = response ["replies" ][0 ]
@@ -1619,7 +1628,10 @@ async def async_callback(chunk: StreamingChunk) -> None:
16191628 async def test_run_async_with_tools (self , tools ):
16201629 """Test async with tool calls."""
16211630 chat_generator = OllamaChatGenerator (model = "qwen3:0.6b" , tools = tools )
1622- messages = [ChatMessage .from_user ("What's the weather in Paris?" )]
1631+ messages = [
1632+ ChatMessage .from_system ("Use the tools to answer the question." ),
1633+ ChatMessage .from_user ("What's the weather in Paris?" ),
1634+ ]
16231635
16241636 response = await chat_generator .run_async (messages )
16251637
@@ -1652,7 +1664,10 @@ async def callback(_chunk: StreamingChunk) -> None:
16521664 chunks_received = True
16531665
16541666 chat_generator = OllamaChatGenerator (model = "qwen3:0.6b" , tools = tools , streaming_callback = callback )
1655- messages = [ChatMessage .from_user ("What's the weather in Berlin?" )]
1667+ messages = [
1668+ ChatMessage .from_system ("Use the tools to answer the question." ),
1669+ ChatMessage .from_user ("What's the weather in Berlin?" ),
1670+ ]
16561671
16571672 response = await chat_generator .run_async (messages )
16581673
0 commit comments