Skip to content

Commit cf1097b

Browse files
committed
fix(providers): harden Sakana tool-loop error + final-stream tool_choice
- Rethrow tool-loop failures instead of swallowing them, so a failed run surfaces as a ProviderError rather than a partial success (matches LiteLLM). - Force tool_choice: 'none' on the post-tool streaming pass so the model cannot emit fresh tool calls that the text-only stream adapter would drop.
1 parent 8e46915 commit cf1097b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/sim/providers/sakana/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,20 +438,23 @@ export const sakanaProvider: ProviderConfig = {
438438
}
439439
} catch (error) {
440440
logger.error('Error in Sakana request:', { error })
441+
throw error
441442
}
442443

443444
if (request.stream) {
444445
logger.info('Using streaming for final Sakana response after tool processing')
445446

447+
// The tool loop is complete: this final pass only produces the textual answer.
448+
// Force `tool_choice: 'none'` so the model cannot emit fresh tool calls that the
449+
// text-only stream adapter would silently drop.
446450
const streamingPayload: any = {
447451
...payload,
448452
messages: currentMessages,
449-
tool_choice: 'auto',
453+
tool_choice: 'none',
450454
stream: true,
451455
}
452456
if (deferResponseFormat && responseFormatPayload) {
453457
streamingPayload.response_format = responseFormatPayload
454-
streamingPayload.tool_choice = 'none'
455458
streamingPayload.parallel_tool_calls = false
456459
}
457460

0 commit comments

Comments
 (0)