fix(llm): propagate chat completion token details#11027
Open
aishwaryabandapelly-ai wants to merge 2 commits into
Open
fix(llm): propagate chat completion token details#11027aishwaryabandapelly-ai wants to merge 2 commits into
aishwaryabandapelly-ai wants to merge 2 commits into
Conversation
Signed-off-by: aishwaryabandapelly-ai <aishwaryabandapelly@gmail.com>
Signed-off-by: aishwaryabandapelly-ai <aishwaryabandapelly@gmail.com>
Contributor
|
👋 Hi aishwaryabandapelly-ai! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
Contributor
WalkthroughIn Changescompletion_tokens_details propagation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview:
Closes #2941.
Chat Completions responses were not surfacing
completion_tokens_details, which can carryreasoning_tokens, from backend usage metadata into the final responseusagefield.This PR propagates
completion_tokens_detailsin the Chat Completions delta generator, following the existing pattern already used forprompt_tokens_details.Details:
lib/llm/src/protocols/openai/chat_completions/delta.rscompletion_usage.completion_tokens_detailsintoself.usage.completion_tokens_detailsWhere should the reviewer start?
Please start with:
lib/llm/src/protocols/openai/chat_completions/delta.rsThe production change is small and mirrors the existing
prompt_tokens_detailspropagation pattern.Related Issues
🔗 This PR is linked to an issue:
Testing:
Passed locally:
Added unit test:
Attempted locally:
cargo check -p dynamo-llm cargo test -p dynamo-llm test_completion_token_details_are_propagated_from_backend_usage --libBoth commands progressed into the
dynamo-llmcrate but could not complete on macOS because of Linux-specific APIs related to NUMA,fallocate,DiskStorage, andO_DIRECT. This appears to be a local platform limitation rather than an issue caused by this change.Acceptance Criteria
prompt_tokens_detailspropagation pattern