Normalize OpenAI SDK BaseModel choices/messages to avoid Pydantic serializer warnings - #18972
Merged
2 commits merged intoJan 13, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
CI note: the failing mock-tests job shows missing deps (openapi_core) and a missing enterprise module (litellm_enterprise.proxy.common_utils.check_responses_cost). I pushed a follow-up commit to add openapi-core to test deps (Makefile + CI workflow) and add init.py under enterprise proxy/common_utils so the module is importable. There are additional unrelated test failures in the CI log (embedding header assertion, HF 401) that may still need attention if they persist. |
hummat
force-pushed
the
fix/normalize-basemodel-choices-message
branch
from
January 13, 2026 10:24
48a0d88 to
f1acb7c
Compare
ghost
merged commit Jan 13, 2026
9adc19d
into
BerriAI:litellm_staging_01_13_2026
6 of 7 checks passed
2 tasks
This was referenced Mar 16, 2026
Amir-R25
added a commit
to RailtownAI/railtracks
that referenced
this pull request
Mar 16, 2026
## What does this add? Closes #220. LiteLLM merged a fix for the pydantic warnings and therefore there is no a longer a need for filtering warnings: BerriAI/litellm#18972 ## Type of changes Please check the type of change your PR introduces: - [ ] 🐛 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 📚 Documentation update (improvements or corrections to documentation) - [ ] 🎨 Code style/formatting (changes that do not affect the meaning of the code) - [x] ♻️ Refactoring (code change that neither fixes a bug nor adds a feature) - [ ] ⚡ Performance improvement (code change that improves performance) - [ ] ✅ Test update (adding missing tests or correcting existing tests) - [ ] 🔧 Build/CI changes (changes to build process or continuous integration) - [ ] 🗑️ Chore (other changes that don't modify src or test files)
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…ializer warnings (BerriAI#18972) * Normalize BaseModel choices + suppress serializer warnings * Fix ModelResponse normalization and test deps
This pull request was closed.
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.
Fixes noisy Pydantic v2 "serializer warnings" seen downstream (e.g. when serializing LiteLLM ModelResponse objects).
Changes:
messageobjects passed intoChoices(...)into LiteLLM'sMessage.choiceobjects passed intoModelResponse(choices=[...])into LiteLLM'sChoices.ModelResponseBase.model_dump()to default toexclude_unset=Trueunless the caller explicitly setsexclude_unset/exclude_none.This prevents PydanticSerializationUnexpectedValue warnings caused by OpenAIObject-derived types that omit unset fields.
tests/test_litellm/test_model_response_normalization.py.Related: #11759, #11914.