Skip to content

workers-ai-provider@3.0.4

Choose a tag to compare

@github-actions github-actions released this 31 Jan 01:50
· 258 commits to main since this release
bcc4ee2

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.