fix(epp): route completion prompts in Rust EPP#11043
Conversation
|
👋 Hi sttts! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
This comment has been minimized.
This comment has been minimized.
WalkthroughThe Rust EPP router gains support for ChangesEPP RoutingConstraints propagation and completion prompt support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
deploy/inference-gateway/ext-proc/src/epp.rs (1)
529-536: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClamp the deprecated priority alias too.
priorityis clamped, butlatency_sensitivityis returned as-is. A negative deprecated alias can still produce a negativepriority_jump, contradicting the helper contract.🐛 Proposed fix
h.priority - .map(|p| p.max(0) as f64) + .map(|p| p as f64) .or(h.latency_sensitivity) + .map(|p| p.max(0.0))🤖 Prompt for 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. In `@deploy/inference-gateway/ext-proc/src/epp.rs` around lines 529 - 536, The `extract_priority_jump` helper is still allowing negative values through the deprecated `latency_sensitivity` alias, so clamp that fallback the same way `priority` is clamped. Update the `NvExt`/`agent_hints` extraction logic in `extract_priority_jump` so both branches normalize to a non-negative `f64`, preserving the helper’s contract regardless of which hint field is present.
🧹 Nitpick comments (1)
deploy/inference-gateway/ext-proc/src/epp.rs (1)
1218-1267: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd coverage for the actual completion
tokenizebranch.These cases stop at helper-level extraction/normalization. Add a test that calls
Router::tokenizefor raw text, token-ID arrays, and the chosen string-array policy so regressions in completion deserialization orgather_tokensare caught. The PR objective calls for focused coverage of completion token-ID arrays, raw text completion prompts, and the chosen string-array policy.🤖 Prompt for 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. In `@deploy/inference-gateway/ext-proc/src/epp.rs` around lines 1218 - 1267, The current tests only cover helper-level prompt normalization and hint extraction, so add coverage for the actual completion tokenize flow in Router::tokenize. Introduce a test that exercises raw text prompts, token-ID array prompts, and the chosen string-array policy through Router::tokenize so completion deserialization and gather_tokens are validated end to end. Use the existing completion prompt helpers and Router::tokenize as the key symbols to locate the code, and keep the assertions focused on the routed token output for each input form.
🤖 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.
Outside diff comments:
In `@deploy/inference-gateway/ext-proc/src/epp.rs`:
- Around line 529-536: The `extract_priority_jump` helper is still allowing
negative values through the deprecated `latency_sensitivity` alias, so clamp
that fallback the same way `priority` is clamped. Update the
`NvExt`/`agent_hints` extraction logic in `extract_priority_jump` so both
branches normalize to a non-negative `f64`, preserving the helper’s contract
regardless of which hint field is present.
---
Nitpick comments:
In `@deploy/inference-gateway/ext-proc/src/epp.rs`:
- Around line 1218-1267: The current tests only cover helper-level prompt
normalization and hint extraction, so add coverage for the actual completion
tokenize flow in Router::tokenize. Introduce a test that exercises raw text
prompts, token-ID array prompts, and the chosen string-array policy through
Router::tokenize so completion deserialization and gather_tokens are validated
end to end. Use the existing completion prompt helpers and Router::tokenize as
the key symbols to locate the code, and keep the assertions focused on the
routed token output for each input form.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 336e29cd-d18f-4117-bae9-24610017b2da
📒 Files selected for processing (1)
deploy/inference-gateway/ext-proc/src/epp.rs
18fe651 to
ac85af7
Compare
|
Addressed the current non-inline review items:
|
|
/ok to test c0f922e |
Teach the Rust ext-proc EPP tokenizer to handle OpenAI completion requests directly instead of parsing every body as chat JSON. Preserve completion token ID prompts, keep text completions on raw completion tokenization, collapse completion batch prompts to a single routing prompt until batch routing has an explicit policy, and forward nvext priority and routing constraints for both chat and completion requests. Fixes ai-dynamo#11041 Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
c0f922e to
a72aff2
Compare
|
/ok to test a72aff2 |
|
Rebased onto latest |
|
/ok to test a72aff2 |
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
|
/ok to test 8512911 |
1 similar comment
|
/ok to test 8512911 |
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
|
/ok to test 7949c59 |
1 similar comment
|
/ok to test 7949c59 |
|
Rebase and CI follow-ups are done. Current head is |
Overview
Rust ext-proc EPP handled every request body as chat completions. This PR teaches it to route
/v1/completionsbodies through the completion request type so text prompts, token-ID prompts, and nvext routing hints keep their intended semantics.Summary
NvCreateCompletionRequestinstead of forcing chat completion parsing.nvext.token_datafor batch completion prompts and prompt-embedding completions.nvextpriority, strict priority, and routing constraints for chat and completion requests.Details
latency_sensitivitypriority hints are clamped the same way aspriority.Where should the reviewer start?
Start with
deploy/inference-gateway/ext-proc/src/epp.rs, especiallyRouter::tokenize,prepare_completion_prompt_for_routing, and thePickResultconstruction inpick().Validation
git diff --checkcargo/rustfmt; this environment has no Rust toolchain installed.Related Issues
Fixes #11041.
Related to #10872.