Skip to content

Commit da79e98

Browse files
authored
examples: fix gpt-oss-tools-stream for adding toolcalls (#568)
1 parent c8392d6 commit da79e98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/gpt-oss-tools-stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_weather_conditions(city: str) -> str:
5555
# host="https://ollama.com", headers={'Authorization': (os.getenv('OLLAMA_API_KEY'))}
5656
)
5757

58-
model = 'gpt-oss:120b'
58+
model = 'gpt-oss:20b'
5959
# gpt-oss can call tools while "thinking"
6060
# a loop is needed to call the tools and get the results
6161
final = True
@@ -81,7 +81,7 @@ def get_weather_conditions(city: str) -> str:
8181
thinking += chunk.message.thinking
8282
print(chunk.message.thinking, end='', flush=True)
8383

84-
if thinking != '' or content != '':
84+
if thinking != '' or content != '' or len(tool_calls) > 0:
8585
messages.append({'role': 'assistant', 'thinking': thinking, 'content': content, 'tool_calls': tool_calls})
8686

8787
print()

0 commit comments

Comments
 (0)