Repository navigation
fix: pass embedding providerMetadata to usageHandler - #393
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and concisely describes the main change: passing embedding provider metadata to the usage handler. |
| Description check | ✅ Passed | The description explains the metadata loss, the code and test changes, and the reported verification. It is directly related to the pull request. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
ced1068 to
7a4f06e
Compare
commit: |
6503999 to
7a4f06e
Compare
embedMany called the usage handler with `providerMetadata: undefined`, dropping what the embedding provider reported, such as the call's cost, although the AI SDK result carries it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7a4f06e to
ff998d0
Compare
embedManycallsusageHandlerwithproviderMetadata: undefinedfor embeddings, although the AI SDKembedManyresult carries the provider's metadata. Data the provider reports for the call — for example its cost, which some providers return inproviderMetadata— is lost, so usage tracking for embeddings can only count tokens.This passes
result.providerMetadatathrough, the same way it is already passed for language model steps.src/vercel/client/search.ts:providerMetadata: result.providerMetadatasrc/vercel/client/search.test.ts: a test withMockEmbeddingModelV4that checks the usage handler receives the metadataCHANGELOG.md: entry under UnreleasedVerified with
npm run build,npm run typecheck,npm run lintandnpm test(415 tests).🤖 Generated with Claude Code