Skip to content

Version Packages - #488

Merged
robert-j-y merged 1 commit into
mainfrom
changeset-release/main
Apr 26, 2026
Merged

Version Packages#488
robert-j-y merged 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish 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

@openrouter/ai-sdk-provider@2.8.1

Patch Changes

  • #487 4588197 Thanks @louisgv! - fix: preserve empty reasoning_details arrays in multi-turn conversations

    Some providers (notably DeepSeek V4 in thinking mode) return reasoning_details: []
    on turns where they produced no visible reasoning tokens. They require this empty array
    to be sent back in subsequent requests to maintain conversation state; omitting it
    causes 4xx errors on follow-up turns.

    src/chat/index.ts:

    • Stream finish event now always sets openrouterMetadata.reasoning_details, even when
      the accumulated array is empty (previously guarded by length > 0).
    • Both reasoning-end emit sites now always include providerMetadata.openrouter.reasoning_details,
      removing the length > 0 ternary that would drop the field entirely.

    src/chat/convert-to-openrouter-chat-messages.ts:

    • candidateReasoningDetails selection now uses Array.isArray(messageReasoningDetails)
      instead of messageReasoningDetails.length > 0 — an explicit [] is now treated as
      "metadata was provided" rather than "metadata was absent", and no longer falls through
      to findFirstReasoningDetails.
    • The top-level if (candidateReasoningDetails) guard no longer requires length > 0;
      an empty candidate array still triggers the dedup/signature-filter block.
    • finalReasoningDetails is now always set to uniqueDetails (the deduplicated array),
      never collapsed to undefined. When all entries were duplicate or signature-stripped,
      the empty array is preserved as a meaningful signal.
    • effectiveReasoning still requires finalReasoningDetails.length > 0 — reasoning
      text is never sent alongside an empty details array.

@robert-j-y
robert-j-y merged commit 310ba3d into main Apr 26, 2026
1 check failed
@robert-j-y
robert-j-y deleted the changeset-release/main branch April 26, 2026 01:50
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