From b8547c034b2578d8c582adc49d8874496825ef37 Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Wed, 20 Aug 2025 16:23:54 -0700 Subject: [PATCH] examples: fix gpt-oss-tools-stream for adding toolcalls --- examples/gpt-oss-tools-stream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gpt-oss-tools-stream.py b/examples/gpt-oss-tools-stream.py index 8d0a27fa..1becdd78 100644 --- a/examples/gpt-oss-tools-stream.py +++ b/examples/gpt-oss-tools-stream.py @@ -55,7 +55,7 @@ def get_weather_conditions(city: str) -> str: # host="https://ollama.com", headers={'Authorization': (os.getenv('OLLAMA_API_KEY'))} ) -model = 'gpt-oss:120b' +model = 'gpt-oss:20b' # gpt-oss can call tools while "thinking" # a loop is needed to call the tools and get the results final = True @@ -81,7 +81,7 @@ def get_weather_conditions(city: str) -> str: thinking += chunk.message.thinking print(chunk.message.thinking, end='', flush=True) - if thinking != '' or content != '': + if thinking != '' or content != '' or len(tool_calls) > 0: messages.append({'role': 'assistant', 'thinking': thinking, 'content': content, 'tool_calls': tool_calls}) print()