Chore: remove response model check and rely on header model for downgrade#12061
Merged
shijie-oai merged 5 commits intomainfrom Feb 18, 2026
Merged
Chore: remove response model check and rely on header model for downgrade#12061shijie-oai merged 5 commits intomainfrom
shijie-oai merged 5 commits intomainfrom
Conversation
shijie-oai
commented
Feb 18, 2026
Comment on lines
+2443
to
+2445
| let server_model_normalized = server_model.to_ascii_lowercase(); | ||
| let requested_model_normalized = requested_model.to_ascii_lowercase(); | ||
| if server_model_normalized == requested_model_normalized { |
Collaborator
Author
There was a problem hiding this comment.
We check lowercase slug value just for extra safety.
shijie-oai
commented
Feb 18, 2026
Comment on lines
198
to
201
Collaborator
Author
There was a problem hiding this comment.
shijie-oai
commented
Feb 18, 2026
Comment on lines
-187
to
-196
| fn extract_server_model(value: &Value) -> Option<String> { | ||
| value | ||
| .get("model") | ||
| .and_then(json_value_as_string) | ||
| .or_else(|| { | ||
| value | ||
| .get("headers") | ||
| .and_then(header_openai_model_value_from_json) | ||
| }) | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
internalize this function.
Collaborator
There was a problem hiding this comment.
nit: can we unnest this?
shijie-oai
commented
Feb 18, 2026
Comment on lines
+190
to
+202
| let response_headers_model = self | ||
| .response | ||
| .as_ref() | ||
| .and_then(|response| response.get("headers")) | ||
| .and_then(header_openai_model_value_from_json); | ||
|
|
||
| match response_headers_model { | ||
| Some(model) => Some(model), | ||
| None => self | ||
| .headers | ||
| .as_ref() | ||
| .and_then(header_openai_model_value_from_json), | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
Not sure if this is what unested here really mean here but this should be cleaner.
Collaborator
dylan-hurd-oai
left a comment
There was a problem hiding this comment.
I don't have enough context on this problem to confidently stamp but the general approach LGTM - if we need to urgently block let me know and we can review together
0ab4d5b to
ab83134
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ensure that we use the model value from the response header only so that we are guaranteed with the correct slug name. We are no longer checking against the model value from response so that we are less likely to have false positive.
There are two different treatments - for SSE we use the header from the response and for websocket we check top-level events.