Repository navigation
docs: handle ValidationError in chat streaming example - #150
Merged
Merged
Conversation
3 tasks
inference-gateway-releaser Bot
added a commit
that referenced
this pull request
Oct 21, 2026
## [0.22.0](v0.21.1...v0.22.0) (2026-10-21) ### ✨ Features * add deprecated include filter to model listing (sync schemas v1.4.1) ([#156](#156)) ([dc61111](dc61111)) * add WebWright provider with schemas v1.5.0 ([7fcdee3](7fcdee3)) * sync generated types with schemas v0.34.4 ([#144](#144)) ([4ac0019](4ac0019)) * sync generated types with schemas v1.2.0 ([#149](#149)) ([78d220f](78d220f)) ### 👷 CI * **deps:** bump actions/create-github-app-token ([#155](#155)) ([cc4787b](cc4787b)) * **deps:** bump actions/setup-node ([#153](#153)) ([4ae5aac](4ae5aac)) ### 📚 Documentation * **agents:** add code readability guidelines ([#141](#141)) ([86dfcb6](86dfcb6)) * **agents:** add code readability guidelines ([#148](#148)) ([839f7af](839f7af)) * handle ValidationError in chat stream example ([#150](#150)) ([d7e10e1](d7e10e1)) ### 🔧 Miscellaneous * **deps:** bump claude-code 2.1.280 -> 2.1.283 ([#142](#142)) ([37993d1](37993d1)) * **deps:** bump claude-code 2.1.283 -> 2.1.285 ([#146](#146)) ([49286f0](49286f0)) * **deps:** bump claude-code 2.1.285 -> 2.1.289 ([#151](#151)) ([57cf945](57cf945)) * **deps:** bump claude-code 2.1.289 -> 2.1.296 ([#157](#157)) ([8cc0acc](8cc0acc)) * **deps:** bump infer CLI v0.208.0 -> v0.218.0 ([#143](#143)) ([f02ecf7](f02ecf7)) * **deps:** bump infer CLI v0.218.0 -> v0.221.1 ([#145](#145)) ([f8ad720](f8ad720)) * **deps:** bump infer CLI v0.221.1 -> v0.226.0 ([#152](#152)) ([22686e1](22686e1)) * **deps:** bump infer CLI v0.226.0 -> v0.231.1 ([#158](#158)) ([ccd8c4e](ccd8c4e)) * sync generated types with schemas v1.2.2 ([#154](#154)) ([ff488ae](ff488ae))
Contributor
|
🎉 This PR is included in version 0.22.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
The chat example's streaming snippet claimed a role-only first chunk "validates fine" and only caught
json.JSONDecodeError. The generated models are strict:ChatCompletionStreamResponseDelta.contenthas no default andChatCompletionStreamChoice.finish_reasondoes not allownull, so such a chunk raises an uncaughtpydantic.ValidationErrorout of the loop (the repo's own xfail testtest_stream_response_delta_allows_missing_contentasserts exactly that).examples/chat/README.md: dropped the "validates fine" claim, replaced it with a note that a delta withoutcontentor a nullfinish_reasonraisesValidationError, and the snippet now catches(json.JSONDecodeError, ValidationError)and skips the chunk - matching the rootREADME.md"Streaming Content" example.examples/chat/main.py: added aValidationErrorhandler sopython main.pyskips rejected chunks instead of crashing.Docs-only change to an example - no SDK behavior or public API change, so no
[DOCS]ticket and no downstream repo impact.Tests run: none -
pip installis not permitted in this sandbox, soblack/isort/mypy/pytestcould not run. The edits are whitespace- and import-ordering-consistent with the surrounding code and no library code changed.Closes #147