[Platform][Generic] Encode request body with JSON_UNESCAPED_SLASHES#2087
Open
chr-hertel wants to merge 1 commit into
Open
[Platform][Generic] Encode request body with JSON_UNESCAPED_SLASHES#2087chr-hertel wants to merge 1 commit into
JSON_UNESCAPED_SLASHES#2087chr-hertel wants to merge 1 commit into
Conversation
The Generic completions and embeddings clients passed the payload via the HttpClient "json" option, whose encoder escapes forward slashes. A namespaced model name like "qwen/qwen3.5-4b" was sent as "qwen\/qwen3.5-4b", which some OpenAI-compatible backends (vLLM, LM Studio) fail to match. Encode the body explicitly with JSON_UNESCAPED_SLASHES while mirroring the remaining flags from Symfony's HttpClientTrait::jsonEncode().
f3df4f9 to
1ce65e3
Compare
Member
Author
|
Not sure about the impact here ... 🤔 |
JSON_UNESCAPED_SLASHES
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Generic completions and embeddings
ModelClientclasses passed the request payload via the HttpClientjsonoption. Symfony'sHttpClientTrait::jsonEncode()encodes withoutJSON_UNESCAPED_SLASHES, so a namespaced model name likeqwen/qwen3.5-4bwas sent on the wire as"model":"qwen\/qwen3.5-4b".That is valid JSON, but several OpenAI-compatible backends (observed with vLLM and LM Studio) do a raw string comparison of the model key during routing and fail to match the escaped form, returning a "model not found" error for any namespaced model name containing
/.Both clients now encode the body explicitly with
JSON_UNESCAPED_SLASHESand pass it asbody. The remaining flags mirrorHttpClientTrait::jsonEncode()so the only intentional deviation is the unescaped slashes.Tests added to both
ModelClientTestclasses asserting forward slashes in model names are not escaped.