Skip to content

Conversation

@github-actions
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

workers-ai-provider@3.0.4

Patch Changes

  • #390 41b92a3 Thanks @mchenco! - fix(workers-ai-provider): extract actual finish reason in streaming instead of hardcoded "stop"

    Previously, the streaming implementation always returned finishReason: "stop" regardless of the actual completion reason. This caused:

    • Tool calling scenarios to incorrectly report "stop" instead of "tool-calls"
    • Multi-turn tool conversations to fail because the AI SDK couldn't detect when tools were requested
    • Length limit scenarios to show "stop" instead of "length"
    • Error scenarios to show "stop" instead of "error"

    The fix extracts the actual finish_reason from streaming chunks and uses the existing mapWorkersAIFinishReason() function to properly map it to the AI SDK's finish reason format. This enables proper multi-turn tool calling and accurate completion status reporting.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 31, 2026

Open in StackBlitz

npx https://pkg.pr.new/cloudflare/ai/ai-gateway-provider@391
npx https://pkg.pr.new/cloudflare/ai/workers-ai-provider@391

commit: 52d2532

@threepointone threepointone merged commit bcc4ee2 into main Jan 31, 2026
3 checks passed
@threepointone threepointone deleted the changeset-release/main branch January 31, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant