Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Oct 15, 2025

fix: Fix metric tracking for v5 responses


Note

Add v5 token usage mapping (inputTokens/outputTokens with precedence) and switch to LanguageModel API; remove @ai-sdk/provider dependency.

  • Server AI Vercel Provider:
    • Metrics: createAIMetrics now supports v5 fields inputTokens/outputTokens (prefers them over v4 promptTokens/completionTokens), with totalTokens and null-safe defaults.
    • API Update: Replace LanguageModelV2 with LanguageModel; update generateText usage and getters accordingly; clean up dynamic imports (remove as any).
  • Tests:
    • Add cases for v5 token fields and precedence over v4 when both present.
  • Dependencies:
    • Remove @ai-sdk/provider from dev and peer dependencies.

Written by Cursor Bugbot for commit d94bbb7. This will update automatically on new commits. Configure here.

fix: Fix metric tracking for v5 responses
@jsonbailey jsonbailey requested a review from a team as a code owner October 15, 2025 18:54
@github-actions
Copy link
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 169118 bytes
Compressed size limit: 200000
Uncompressed size: 789399 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 24988 bytes
Compressed size limit: 26000
Uncompressed size: 122411 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 21721 bytes
Compressed size limit: 25000
Uncompressed size: 74698 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 17636 bytes
Compressed size limit: 20000
Uncompressed size: 90259 bytes

cursor[bot]

This comment was marked as outdated.

@jsonbailey
Copy link
Contributor Author

The build issues should be solved by #963 and once it is merged I will update this branch.

@jsonbailey jsonbailey merged commit e6c42a8 into main Oct 16, 2025
32 checks passed
@jsonbailey jsonbailey deleted the jb/fix-vercel-v5-support branch October 16, 2025 13:37
@github-actions github-actions bot mentioned this pull request Oct 16, 2025
jsonbailey pushed a commit that referenced this pull request Oct 16, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>server-sdk-ai: 0.12.2</summary>

##
[0.12.2](server-sdk-ai-v0.12.1...server-sdk-ai-v0.12.2)
(2025-10-16)


### Bug Fixes

* Reduce dependencies and use peer dependencies when needed
([#963](#963))
([7f3da30](7f3da30))
</details>

<details><summary>server-sdk-ai-langchain: 0.1.2</summary>

##
[0.1.2](server-sdk-ai-langchain-v0.1.1...server-sdk-ai-langchain-v0.1.2)
(2025-10-16)


### Bug Fixes

* Reduce dependencies and use peer dependencies when needed
([#963](#963))
([7f3da30](7f3da30))
</details>

<details><summary>server-sdk-ai-openai: 0.1.1</summary>

##
[0.1.1](server-sdk-ai-openai-v0.1.0...server-sdk-ai-openai-v0.1.1)
(2025-10-16)


### Bug Fixes

* Reduce dependencies and use peer dependencies when needed
([#963](#963))
([7f3da30](7f3da30))
</details>

<details><summary>server-sdk-ai-vercel: 0.1.1</summary>

##
[0.1.1](server-sdk-ai-vercel-v0.1.0...server-sdk-ai-vercel-v0.1.1)
(2025-10-16)


### Bug Fixes

* Fix metric tracking for v5 responses
([e6c42a8](e6c42a8))
* Reduce dependencies and use peer dependencies when needed
([#963](#963))
([7f3da30](7f3da30))
* Support previous v4 of Vercel AI SDK
([#962](#962))
([e6c42a8](e6c42a8))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
ffe7807. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants