-
Notifications
You must be signed in to change notification settings - Fork 720
fix: include_stop_str_in_output #4688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis PR threads an Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/llm/src/backend.rs (1)
178-185: Missing match arm forVisibleStopSequenceDetected.The
finish_reasonmatch does not handle the newStopTrigger::VisibleStopSequenceDetectedvariant. When a visible stop sequence is detected,finish_reasonwill incorrectly remainNoneinstead of being set toFinishReason::Stop.Apply this diff to handle the new variant:
let finish_reason = match &result.stop_trigger { Some(StopTrigger::MaxTokensLimit) => Some(FinishReason::Length), Some(StopTrigger::HiddenStopTokenDetected(_)) => Some(FinishReason::Stop), Some(StopTrigger::HiddenStopSequenceDetected(_)) => { Some(FinishReason::Stop) } + Some(StopTrigger::VisibleStopSequenceDetected(_)) => { + Some(FinishReason::Stop) + } None => None, };
🧹 Nitpick comments (1)
lib/llm/src/backend.rs (1)
291-293: Consider updating this TODO comment.The
visible_stop_sequencesfeature is now implemented. This comment could be updated to reflect that onlyvisible_stop_idsremains TODO, or removed ifvisible_stop_idsis not planned.-// todo - add visible stop conditions -// visible_stop_ids: HashSet<TokenIdType>, -// visible_stop_sequences: Vec<String>, +// todo - consider adding visible_stop_ids: HashSet<TokenIdType>
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/llm/benches/tokenizer.rs(2 hunks)lib/llm/src/backend.rs(11 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-24T20:59:35.725Z
Learnt from: ishandhanani
Repo: ai-dynamo/dynamo PR: 1626
File: lib/llm/src/preprocessor.rs:238-239
Timestamp: 2025-06-24T20:59:35.725Z
Learning: In lib/llm/src/preprocessor.rs, the `sampling_options` call in the `preprocess_request` method is placed in the common section after the match statement on `request.prompt_input_type()`, meaning it applies to both `PromptInput::Tokens` and `PromptInput::Text` request types.
Applied to files:
lib/llm/src/backend.rs
📚 Learning: 2025-09-10T15:27:42.511Z
Learnt from: ayushag-nv
Repo: ai-dynamo/dynamo PR: 2932
File: lib/llm/src/preprocessor.rs:768-844
Timestamp: 2025-09-10T15:27:42.511Z
Learning: In the tool calling jail implementation in lib/llm/src/preprocessor.rs, the design intentionally emits only the first accumulated choice that contains tool calls during unjailing, dropping other accumulated choices. This is a deliberate design decision, not a bug.
Applied to files:
lib/llm/src/backend.rs
🧬 Code graph analysis (1)
lib/llm/benches/tokenizer.rs (2)
lib/llm/src/backend.rs (1)
new(382-423)components/src/dynamo/sglang/protocol.py (1)
StopConditions(19-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: tests (lib/runtime/examples)
- GitHub Check: tests (launch/dynamo-run)
- GitHub Check: tests (lib/bindings/python)
- GitHub Check: clippy (launch/dynamo-run)
- GitHub Check: tests (.)
- GitHub Check: clippy (.)
- GitHub Check: clippy (lib/bindings/python)
- GitHub Check: Build and Test - dynamo
🔇 Additional comments (7)
lib/llm/benches/tokenizer.rs (1)
57-57: LGTM!The benchmark call sites are correctly updated to pass
falsefor the newinclude_stop_str_in_outputparameter, maintaining the previous default behavior where stop strings are hidden from output.Also applies to: 81-81
lib/llm/src/backend.rs (6)
92-114: LGTM!The
include_stop_str_in_outputparameter is cleanly threaded through thedecodermethod to theDecoder::newconstructor.
132-149: LGTM!The
include_stop_str_in_outputoption is correctly extracted fromsampling_optionswith a safe default offalse, maintaining backward compatibility.
313-316: LGTM!The
visible_stop_sequencesfield is well-documented and follows the same pattern ashidden_stop_sequences.
332-350: LGTM!The
StopTriggerenum is properly extended withVisibleStopSequenceDetected, andshould_hide_textcorrectly returnsfalsefor this variant, ensuring the stop string appears in the output.
395-423: LGTM!The categorization logic correctly routes all stop sequences to either
hidden_stop_sequencesorvisible_stop_sequencesbased on theinclude_stop_str_in_outputflag. Thejail_max_bytescalculation properly accounts for both sets.
488-507: LGTM!The visible stop sequence detection correctly includes the stop string in the output by computing
stop_end = offset + seq.len()and returning text up to that point. The edge case handling for partial matches (whenstop_end <= pre_append) is appropriate.
|
@drnikolaev Can you look at the CI errors? |
Overview:
Details:
Where should the reviewer start?
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
New Features
✏️ Tip: You can customize this high-level summary in your review settings.