Skip to content

Commit 7f6c49a

Browse files
waleedlatif1claude
andcommitted
fix(providers/ollama): drop tools from post-tool streaming call
Ollama ignores tool_choice (not in its supported fields), so vLLM/Fireworks' tool_choice:'none' guard is a no-op here. Omit tools from the final streaming payload instead so the summarization turn can't emit dropped tool calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8f9428b commit 7f6c49a

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

apps/sim/providers/ollama/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ describe('ollamaProvider.executeRequest', () => {
336336
expect(result.stream).toBe('OLLAMA_STREAM')
337337
expect(mockExecuteTool).toHaveBeenCalledTimes(1)
338338

339+
const finalCall = mockCreate.mock.calls[2][0]
340+
expect(finalCall.tools).toBeUndefined()
341+
expect(finalCall.tool_choice).toBeUndefined()
342+
339343
streamOnComplete.current?.('final answer', {
340344
prompt_tokens: 2,
341345
completion_tokens: 4,

apps/sim/providers/ollama/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,11 @@ export const ollamaProvider: ProviderConfig = {
482482

483483
const accumulatedCost = calculateCost(request.model, tokens.input, tokens.output)
484484

485+
const { tools: _tools, tool_choice: _toolChoice, ...streamPayload } = payload
486+
485487
const streamingParams: ChatCompletionCreateParamsStreaming = {
486-
...payload,
488+
...streamPayload,
487489
messages: currentMessages,
488-
tool_choice: 'auto',
489490
stream: true,
490491
stream_options: { include_usage: true },
491492
}

0 commit comments

Comments
 (0)