Skip to content

Conversation

@furionw
Copy link
Contributor

@furionw furionw commented Dec 5, 2025

Overview:

Documented in #4755

When frontend receives an OpenAI request,

  • it does deserialize it correctly so that NvCreateCompletionRequest.inner.stop has it
  • it doesn't implement get_stop

because of this, the Preprocessor is not able to build the request with proper stop field. Therefore the backend cannot honor the OpenAI request stop.

This PR fixes that.

Details:

Update get_stop function to return the values for the (backend) request builder.

Testing

  • added unit test
  • test locally by running frontend and engine

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced stop sequence handling in completion requests to properly process and return configured stop values.
  • Tests

    • Added unit tests for stop sequence handling scenarios, including single, multiple, and no stop configurations.

✏️ Tip: You can customize this high-level summary in your review settings.

@furionw furionw self-assigned this Dec 5, 2025
@furionw furionw requested a review from a team as a code owner December 5, 2025 17:31
@github-actions github-actions bot added the fix label Dec 5, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

The get_stop method in NvCreateCompletionRequest is now implemented to properly map Stop enum variants (String and StringArray) to a Vec output. Previously, it unconditionally returned None. Unit tests validate the mapping across three scenarios: absent stop, single stop value, and multiple stop values.

Changes

Cohort / File(s) Summary
Stop field mapping implementation
lib/llm/src/protocols/openai/completions.rs
Implemented get_stop to handle Stop::String and Stop::StringArray enum variants, converting them to Vec. Added three unit tests: test_get_stop_none, test_get_stop_single, and test_get_stop_multiple.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward enum-to-Vec mapping logic with no complex branching or state management
  • Basic unit tests with clear, predictable assertions
  • Single file modification with cohesive changes

Poem

🐰 A stop field once silent and still,
Now speaks with a voice and a will—
One word or many, the enum does parse,
Into strings within vectors so sparse,
With tests that ensure all is well!

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: enabling the frontend to populate the 'stop' field in OpenAI requests, which aligns with the get_stop implementation fix in the changeset.
Description check ✅ Passed The pull request description follows the template structure with Overview, Details, and Testing sections clearly addressing the fix for the missing stop field implementation.

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.

❤️ Share

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

@furionw furionw closed this Dec 5, 2025
@furionw furionw force-pushed the qiwa/propagate_missing_stop_field_DIS-1139 branch from ea5426c to b8c4a5f Compare December 5, 2025 17:40
@pull-request-size pull-request-size bot added size/XS and removed size/M labels Dec 5, 2025
@furionw furionw reopened this Dec 5, 2025
@pull-request-size pull-request-size bot added size/M and removed size/XS labels Dec 5, 2025
@furionw furionw changed the title fix: have frontend populate field in OpenAI request fix: have frontend populate "stop" field in OpenAI request Dec 5, 2025
@furionw furionw linked an issue Dec 5, 2025 that may be closed by this pull request
@furionw furionw force-pushed the qiwa/propagate_missing_stop_field_DIS-1139 branch from 79f6194 to 881b435 Compare December 5, 2025 18:25
@furionw furionw closed this Dec 5, 2025
@furionw furionw force-pushed the qiwa/propagate_missing_stop_field_DIS-1139 branch from 881b435 to 3dbab3f Compare December 5, 2025 20:33
@pull-request-size pull-request-size bot added size/XS and removed size/M labels Dec 5, 2025
@furionw furionw reopened this Dec 5, 2025
@pull-request-size pull-request-size bot added size/M and removed size/XS labels Dec 5, 2025
@furionw furionw force-pushed the qiwa/propagate_missing_stop_field_DIS-1139 branch from 2f76bea to c388f36 Compare December 5, 2025 21:28
@copy-pr-bot
Copy link

copy-pr-bot bot commented Dec 5, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@furionw furionw requested review from a team as code owners December 5, 2025 23:34
@furionw furionw force-pushed the qiwa/propagate_missing_stop_field_DIS-1139 branch from c18774b to 58a9109 Compare December 5, 2025 23:37
@furionw furionw closed this Dec 6, 2025
@furionw furionw deleted the qiwa/propagate_missing_stop_field_DIS-1139 branch December 6, 2025 02:35
@furionw
Copy link
Contributor Author

furionw commented Dec 6, 2025

creating #4782 to see if I can pass the test ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants