Skip to content

Add stop reason - #29

Merged
chrisboulton merged 1 commit into
mainfrom
gen-stop-reason
Jul 27, 2026
Merged

Add stop reason#29
chrisboulton merged 1 commit into
mainfrom
gen-stop-reason

Conversation

@chrisboulton

@chrisboulton chrisboulton commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Right now a stop based on max_tokens does not return the proper stop reason - we just report a gen stop, when we should actually be reporting length.

Summary by CodeRabbit

  • New Features
    • Generation-completion events now optionally report why generation stopped: end of sequence, maximum token limit, stop text, or an unknown reason.
    • Existing integrations remain compatible when no stop reason is provided.
  • Release
    • Updated the package version to 0.5.1.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The protocol adds an optional SeqStopReason to SeqGenFinish, supports known and unknown serialized values, and updates the crate version from 0.5.0 to 0.5.1.

Changes

Sequence stop reason support

Layer / File(s) Summary
Sequence finish stop reason contract
src/protocol.rs
SeqGenFinish gains an optional Serde-compatible stop reason, and SeqStopReason defines Eos, MaxTokens, StopText, and Unknown variants.
Crate version update
Cargo.toml
The package version changes from 0.5.0 to 0.5.1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: zackangelo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding stop-reason handling to generation events.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gen-stop-reason

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/protocol.rs`:
- Around line 140-152: Update SeqStopReason’s serialization/deserialization
handling to use custom string serde instead of #[serde(other)], mapping
recognized snake_case values to Eos, MaxTokens, and StopText and all unknown
values to Unknown. Preserve serialization of known variants and add tests
covering each known value plus an unrecognized value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c42fc778-645b-4fa1-81df-8cca55c5f396

📥 Commits

Reviewing files that changed from the base of the PR and between cf831ce and 812afb5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • src/protocol.rs

Comment thread src/protocol.rs
@chrisboulton
chrisboulton merged commit 977521b into main Jul 27, 2026
16 checks passed
@chrisboulton
chrisboulton deleted the gen-stop-reason branch July 27, 2026 21:40
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.

2 participants