Repository navigation
feat: validate Responses capabilities per model - #512
Conversation
Signed-off-by: zitian.zhao <[email protected]>
|
One gap this doesn't cover: |
maralbahari
left a comment
There was a problem hiding this comment.
Thanks for working on this. I agree with the goal in #330 of keeping per-model validation configurable, so Astra restrictions don't become global restrictions on vLLM models. But the PR adds a second capability type, a second config table and a second validation function next to ones we already have. I'd like it built on the existing pieces.
Where validation is today
Request validation lives on the request types in types/, not in executor modules:
- The request is decoded at ingress into the typed
RequestPayload, so shape errors (wrong types, unknown enum values such asprompt_cache_retention) are rejected there. - Parameters the gateway can't honour are rejected by
RequestPayload::ensure_supported_parameters()(types/request_response/unsupported.rs), with a typedUnsupportedParameterErrorwhoseparam()andcode()produce OpenAI's error envelope. It runs at admission inrehydrate.rs. - Upstream capability is checked by
RequestPayload::validate_prompt_cache_options(supported)(types/request_response/prompt_cache.rs), at the same admission point plus the summary request incompaction.rsand the WebSocket handler before a continuation takes its checkpoint. Its input is the deployment-wideresponses.prompt_cache_options_supported. - Model-input rules, such as how reasoning is lowered for vLLM, are in
ResponsesInput::normalized_model_input(types/io/input/conversions.rs). - Per-model capabilities are configured in
[models.<id>](ModelFileConfig) and resolved byModelCapabilities(ModelOverride { input_modalities, supported_reasoning_levels }). Today they feed the/v1/modelsand Codex catalogs, not admission.
The inline comments show how each new piece can extend these instead: one place to configure a model, one typed value per setting, and one check.
#330 is about preserving prompt-cache controls and service tiers across execution paths; this PR adds rejection, not preservation, so it shouldn't close the issue. Please change "Closes #330" to "Part of #330". The branch also conflicts with main now.
| pub logprobs_supported: Option<bool>, | ||
| /// Accepted explicit reasoning efforts, using the upstream's vocabulary. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub reasoning_efforts: Option<Vec<String>>, |
There was a problem hiding this comment.
supported_reasoning_levels (SupportedReasoningLevels(Vec<ReasoningEffortLevel>)) already models this and rejects empty lists and duplicates. As plain strings, a typo such as "hgih" is accepted silently, and an empty list rejects every effort. Please validate against supported_reasoning_levels, so what the catalog advertises and what the gateway accepts can't disagree, and type the request's reasoning.effort as the same ReasoningEffortLevel (moved into core) instead of comparing strings.
There was a problem hiding this comment.
The request and configuration now share ReasoningEffortLevel, including none and minimal. Explicit supported_reasoning_levels lists govern admission; catalog defaults don't. Empty lists and duplicate entries are rejected.
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub prompt_cache_options_supported: Option<bool>, | ||
| #[serde(skip_serializing_if = "BTreeMap::is_empty")] | ||
| pub models: BTreeMap<String, ResponsesModelPolicy>, |
There was a problem hiding this comment.
This adds [responses.models.<id>] beside the existing [models.<id>] (ModelFileConfig, with supported_reasoning_levels a few lines above). Operators would configure the same model in two places with no link between them. These fields belong in ModelFileConfig.
There was a problem hiding this comment.
Moved these settings into ModelFileConfig under [models.<id>] and removed [responses.models]. Updated the examples and startup validation.
|
@maralbahari Thanks for the review. I plan to address this in the current PR:
Only explicitly configured reasoning levels would restrict requests; the catalog’s fallback levels would remain display defaults. Existing explicit lists would therefore govern both the catalog and admission. One compatibility detail I’d like to confirm: strict typing moves unknown effort/tier values and malformed I’ll also cover direct Rust construction through |
|
Proposed flow for the changes in my previous comment: flowchart TD
A["[models] configuration"] --> B["ModelFileConfig"]
B --> C["ModelOverride / ModelCapabilities in core"]
C --> D["Codex model catalog"]
C --> E["Explicit overrides for the requested model"]
F["Deployment-wide cache-options fallback"] --> G["RequestPayload::ensure_supported_parameters()"]
E --> G
G -->|Accepted| H["Continue execution"]
G -->|Rejected| I["Typed parameter error"]
Catalog display defaults do not become admission limits. The same validation is called at core admission, WebSocket preflight before acquiring a parent checkpoint, and summary inference. |
Merge upstream main, share typed model configuration between catalog and admission, and preserve request parameter forwarding and WebSocket error semantics. Signed-off-by: zitian.zhao <[email protected]>
|
@maralbahari I've addressed your feedback, and CI is passing. Could you take another look when you have a chance? Thanks! |
maralbahari
left a comment
There was a problem hiding this comment.
@skyloevil Thanks for the work and providing the diagram helping the review.
Bring in model capability validation (vllm-project#512), unknown conversation id rejection (vllm-project#531), persisted-turn documentation (vllm-project#533), and the shared input-item test helper (vllm-project#545). Signed-off-by: LeaderOnePro <[email protected]>
…salt vllm-project#512 typed service_tier as a Copy ServiceTier, so summary_settings() copies it instead of cloning; this branch's cache_salt line stays. Signed-off-by: Sohom Chakraborty <[email protected]>
Summary
Use the existing
[models]configuration and shared core capability resolver for both the Codex catalog and Responses admission. Fold cache and model checks intoRequestPayload::ensure_supported_parameters()with typed errors at core admission, WebSocket preflight, and summary inference.Type reasoning effort, service tier, and
top_logprobs. Preserve omitted/null/integertop_logprobsupstream, reject same-name Rustextraentries, and keep actual response tiers and stored response reasoning strings compatible. Share the immutable capability table across cloned transport state.Explicit reasoning lists now also constrain requests; catalog fallback levels do not. Unknown effort/tier values and malformed logprobs fail decoding for every model. WebSocket decode errors retain existing checkpoint cleanup, while typed admission rejections preserve the parent for retry.
Merged current main and updated configuration/API documentation.
Part of #330. The agreed compaction
cache_saltfix remains separate; this PR does not close the issue.Test Plan
a3f1239. No new failures.conversation_items.rs.