fix(ollama): tolerate dict-backed reasoning messages in OpenAI preprocessing#5638
Open
skamenan7 wants to merge 6 commits intoogx-ai:mainfrom
Open
fix(ollama): tolerate dict-backed reasoning messages in OpenAI preprocessing#5638skamenan7 wants to merge 6 commits intoogx-ai:mainfrom
skamenan7 wants to merge 6 commits intoogx-ai:mainfrom
Conversation
…cessing Prevent reasoning providers from failing when they pass provider-specific dict messages through shared image localization, and add a regression test for the dict-shaped message path. Signed-off-by: skamenan7 <skamenan@redhat.com>
…cessing Prevent reasoning providers from failing when they pass provider-specific dict messages through shared image localization, and add a regression test for the dict-shaped message path. Signed-off-by: skamenan7 <skamenan@redhat.com>
dddf764 to
da58e44
Compare
… bug/5636-ollama-dict-bug
…ug/5636-ollama-dict-bug
mattf
requested changes
Apr 28, 2026
| self._validate_model_allowed(provider_model_id) | ||
|
|
||
| messages = params.messages | ||
| messages: list[Any] = params.messages |
Collaborator
There was a problem hiding this comment.
please find a way to fix this bug without undoing our type protections. that's to say, find a way to turn the dict back into the proper type before passing it along.
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.
What does this PR do?
Prevent reasoning providers from failing when they pass provider-specific dict messages through shared image localization.
src/ogx/providers/utils/inference/openai_mixin.py: update_localize_image_url()to handle both Pydantic message models and dict-backed messages via duck-typed field access.tests/unit/providers/utils/inference/test_openai_mixin_models.py: add a regression test for dict-shaped reasoning messages with provider-specific keys likereasoning.Closes #5636
Test Plan
Unit tests:
Static checks:
Integration test (replay mode against recorded
ollama/gpt-oss:20breasoning setup):