Repository navigation
fix: allow null stop_reason in Messages stream message_start - #179
Conversation
Co-authored-by: Eden Reich <[email protected]>
|
@claude can you verify with the official OpenAI spec if this field should be nullable, if it's can you make the change or file a refactoring to inference-gateway/schemas? |
|
Claude finished @edenreich's task in 50s —— View job Verifying
|
## [0.26.0](v0.25.0...v0.26.0) (2026-11-17) ### ✨ Features * sync schemas v1.14.1 and accept standard OpenAI stream chunks ([#182](#182)) ([d4e2634](d4e2634)), closes [#181](#181) ### 🐛 Bug Fixes * allow null stop_reason in Messages stream message_start ([#179](#179)) ([cb9440e](cb9440e)) * read stream chunks as JSON in chat examples ([#178](#178)) ([fca4630](fca4630)), closes [#172](#172) ### 👷 CI * align Dependabot schedule and grouping ([#169](#169)) ([3f5ad19](3f5ad19)) * set up orchestrators from repos.yaml ([#170](#170)) ([bffe983](bffe983)) ### 📚 Documentation * add audio example for speech, sfx and music ([#176](#176)) ([c1f04d0](c1f04d0)) * add Responses API example and README section ([#180](#180)) ([ec0e02a](ec0e02a)) * sync examples and README with gateway config ([#177](#177)) ([ee0999d](ee0999d)) ### 🔧 Miscellaneous * **deps:** bump flox dependencies to latest ([#167](#167)) ([55f32c5](55f32c5)) * **deps:** bump flox dependencies to latest ([#168](#168)) ([de020e9](de020e9))
|
🎉 This PR is included in version 0.26.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
create_message_streamraisedInferenceGatewayValidationErroron the first Anthropic stream event becausemessage_startcarries"stop_reason": null, andMessagesResponse.stop_reasonwas a required non-nullable literal.Changes
openapi.yaml: markMessagesResponse.stop_reasonasnullable: true(still required).inference_gateway/models.py(generated code):stop_reasonis nowLiteral[...] | None. This matches whatdatamodel-codegen --strict-nullableemits for a required nullable field. The model edit was made by hand because the sandbox could not rundatamodel-codegen. A maintainer may want to rerun the codegen command fromtask generatewithout the download step to confirm there is no diff.tests/test_client.py:test_create_message_streamnow uses the realmessage_startshape (stop_reason: null,stop_sequence: null) and assertsstop_reason is None.Generated code / compatibility
inference-gateway/schemas. Until that lands, runningtask generatewill download the old spec and revert this fix. Follow-up issue: [BUG] MessagesResponse.stop_reason must be nullable for streaming message_start schemas#327.MessagesResponse.stop_reasonis now typed... | None. Code that type-checks against the old non-optional type may need a None check. Runtime behavior for non-streaming responses is unchanged."Request validation failed"wording is still used when a response event fails validation. That message is shared by 5 methods and is out of scope here.Tests
task lint(black, isort, mypy): passingtask test: 53 passed, 1 xfailed (pre-existing)no docs ticket: internal-only refactor - this is a bug fix with no new public behavior. The documented
create_message_streamusage now works as described.Closes #171
Generated with Claude Code