mirror of
https://github.com/ollama/ollama-python.git
synced 2026-02-03 18:08:43 -06:00
examples: make gpt-oss resilient for failed tool calls (#569)
This commit is contained in:
parent
da79e987f0
commit
9f41447f20
@ -98,6 +98,7 @@ while True:
|
||||
messages.append(result_message)
|
||||
else:
|
||||
print(f'Tool {tool_call.function.name} not found')
|
||||
messages.append({'role': 'tool', 'content': f'Tool {tool_call.function.name} not found', 'tool_name': tool_call.function.name})
|
||||
|
||||
else:
|
||||
# no more tool calls, we can stop the loop
|
||||
|
||||
@ -78,7 +78,7 @@ while True:
|
||||
messages.append({'role': 'tool', 'content': result, 'tool_name': tool_call.function.name})
|
||||
else:
|
||||
print(f'Tool {tool_call.function.name} not found')
|
||||
|
||||
messages.append({'role': 'tool', 'content': f'Tool {tool_call.function.name} not found', 'tool_name': tool_call.function.name})
|
||||
else:
|
||||
# no more tool calls, we can stop the loop
|
||||
break
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user