Skip to content

fix: make streaming delta content optional - #31

Merged
edenreich merged 2 commits into
mainfrom
fix/issue-29-20260606-1249
Jun 6, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/issue-29-20260606-1249

Conversation

@claude

@claude claude Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

ChatCompletionStreamResponseDelta.content was required in the generated models, so calling CreateChatCompletionStreamResponse.model_validate() on the first streaming chunk (which carries only role, no content) raised a ValidationError.

This change:

  • Removes content from the required list of ChatCompletionStreamResponseDelta in openapi.yaml.
  • Regenerates the model field as content: str | None = None.
  • Removes the now-unnecessary try/except ValidationError workaround from examples/chat/main.py and examples/chat/README.md.
  • Adds a regression test (test_stream_response_delta_allows_missing_content).

Cross-repo note

openapi.yaml here is vendored from inference-gateway/schemas (the source of truth). The same change is needed upstream, otherwise the next task generate (which re-downloads the spec) will revert the vendored copy.

Closes #29

ChatCompletionStreamResponseDelta.content was required, so validating the
first streaming chunk (role only, no content) raised a ValidationError.
Drop content from the schema's required list, regenerate the model field
as `content: str | None = None`, drop the example try/except workaround,
and add a regression test.
Comment thread examples/chat/main.py Resolved
@edenreich
edenreich merged commit 1c6c533 into main Jun 6, 2026
@edenreich
edenreich deleted the fix/issue-29-20260606-1249 branch June 6, 2026 13:49
github-actions Bot pushed a commit that referenced this pull request Jun 6, 2026
## [0.7.0](v0.6.3...v0.7.0) (2026-06-06)

### ✨ Features

* add reasoning_format as explicit parameter to create_chat_completion methods ([#34](#34)) ([c2ea888](c2ea888))

### 🐛 Bug Fixes

* correct docker run -e syntax in examples/README.md ([#33](#33)) ([9c756d9](9c756d9)), closes [#27](#27)
* derive __version__ from package metadata to prevent drift ([#30](#30)) ([c150560](c150560))
* make streaming delta content optional ([#31](#31)) ([1c6c533](1c6c533))

### 👷 CI

* centralize claude.yml via reusable workflow ([#13](#13)) ([d0df597](d0df597))
* centralize claude.yml via reusable workflow ([#14](#14)) ([f50da35](f50da35))
* centralize infer.yml + bump infer CLI and sync .infer config ([#17](#17)) ([126c41f](126c41f))
* centralize infer.yml + sync .infer config ([#16](#16)) ([b1166ff](b1166ff))
* centralize infer.yml via reusable workflow ([#15](#15)) ([4c9a38d](4c9a38d))
* **infer:** centralize infer.yml + bump infer CLI and sync .infer config ([#18](#18)) ([7ae73a6](7ae73a6))

### 🔧 Miscellaneous

* **deps:** bump claude-code 2.1.148 -> 2.1.158 ([#20](#20)) ([eeb796b](eeb796b))
* **deps:** bump codex 0.133.0 -> 0.135.0 ([#23](#23)) ([d20f9a2](d20f9a2))
* **deps:** bump infer CLI v0.117.0 -> v0.117.1, infer-action v0.9.1 -> v0.11.1 ([#19](#19)) ([7377902](7377902))
* **deps:** bump infer CLI v0.117.1 -> v0.119.0, infer-action v0.11.2 -> v0.11.4 ([#24](#24)) ([ecc2634](ecc2634))
* **deps:** bump infer-action v0.11.1 -> v0.11.2 ([#22](#22)) ([c348db4](c348db4))
* **flox:** add missing manifest.lock file ([ad15f9f](ad15f9f))
* trim requirements.txt to runtime dependencies only ([#32](#32)) ([0c95d4c](0c95d4c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ChatCompletionStreamResponseDelta.content is required but streaming first chunk has no content

1 participant