Skip to content

feat: sync SDK to schemas v0.6.2 (zai provider + Responses API) - #77

Merged
edenreich merged 3 commits into
mainfrom
feat/issue-76-20260718-1850
Jul 18, 2026
Merged

edenreich merged 3 commits into
mainfrom
feat/issue-76-20260718-1850

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Summary

Syncs the SDK to inference-gateway/schemas v0.6.2 (the current latest tag; the only difference from the v0.6.1 requested in the issue is an internal schema rename ResponseReasoningSummary -> ResponseReasoningSummaryPart, and task generate always pulls the latest tag).

  • openapi.yaml regenerated to v0.6.2.
  • Provider enum gains zai (after nvidia).
  • Endpoints gains the optional responses field.
  • Full OpenAI-compatible Responses API model set added to models.py: CreateResponseRequest, Response, ResponseStreamEvent, and the ~25 supporting schemas (inputs, tools, tool-choice, reasoning, text config, outputs, usage).
  • client.py exposes create_response (POST /responses) and the streaming variant create_response_stream (yields SSEvent, same contract as chat streaming).
  • New public models exported from inference_gateway/__init__.py.
  • Tests: zai provider value, create_response (parse + default-omission + structured input/tools), and create_response_stream.

Note for reviewers

The CI sandbox this was authored in has no datamodel-codegen/pydantic and blocks pip install, so models.py was hand-applied to match codegen output (the exact deltas were verified by diffing the committed spec against v0.6.2) and syntax-checked with py_compile. The new model classes are appended at the end of models.py rather than interleaved in spec-declaration order, and two anonymous inline objects are named descriptively (Format, ResponseToolChoiceFunction). These are semantically correct and valid Pydantic v2, but a follow-up task generate in a full toolchain environment is recommended to normalize class ordering/naming so the tree is byte-clean against the generator.

Downstream impact

  • Docs: the Responses API is new user-facing behavior - a [DOCS] tracking issue will be opened in inference-gateway/docs.

Closes #76

@edenreich

Copy link
Copy Markdown
Contributor

@claude CI is failing, can you fix this?

Please also create a follow-up feature request to add pre-commit hook that catches such errors of code changes before they are pushed.

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 19m 5s —— View job


Done - CI is green ✅

CI was failing for two reasons; the first masked the second, since black runs before pytest in the same job.

1. black --check . formatting - commit 05d9033
Two hand-authored spots deviated from black 26.3.1:

  • models.py ResponseStatus - over-nested class base, collapsed to the 3-line form (matching FinishReason at models.py:475).
  • tests/test_client.py - a single-element list assert black collapses onto one line.

2. Real bug in the PR: test_create_response_stream failed - commit 22ac4f5
With black passing, pytest ran and surfaced a genuine bug:

pydantic_core.ValidationError: 1 validation error for SSEvent
event
  Input should be 'message-start', ... or 'stream-end'  [input_value='response.created']

create_response_stream reuses the shared _process_stream_response, which builds SSEvent(event=<raw name>). But SSEvent.event was a Literal of chat-only event names, so Responses API events (response.created, response.output_text.delta, ...) failed validation and every response stream raised.

Fix: widened SSEvent.event from the chat-only Literal to str. An SSE event: field is inherently an arbitrary string, and SSEvent is now shared across both streaming APIs. Backward-compatible (old enum values remain valid strings); no existing test changed.

Note

openapi.yaml is kept as the faithful v0.6.2 snapshot (this PR's purpose), so models.py's SSEvent.event now deliberately deviates from the generated enum. Editing openapi.yaml wouldn't help - task generate re-downloads it from upstream. The durable fix is to widen SSEvent.event to a plain string in inference-gateway/schemas, so it survives the next sync. Recommend doing that before the next task generate.

Follow-up feature request

Opened #78 - "add pre-push pre-commit gate to catch formatting before CI". The repo already ships .pre-commit-config.yaml (black 26.3.1) plus a ci: block for pre-commit.ci, but the hooks are opt-in and were bypassed here (authored in a sandbox where they couldn't be installed). The issue proposes a pre-push gate + enabling pre-commit.ci so formatting is caught before it reaches CI, regardless of local setup.

Note

This CI environment blocks pip/network, so I couldn't run black/pytest locally - the black fixes were matched against the repo's existing black-compliant output and the streaming fix traced against _process_stream_response. The green CI run above is the confirmation.
· branch feat/issue-76-20260718-1850

@edenreich
edenreich merged commit 3660d1d into main Jul 18, 2026
1 check passed
@edenreich
edenreich deleted the feat/issue-76-20260718-1850 branch July 18, 2026 20:01
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 18, 2026
## [0.8.0](v0.7.1...v0.8.0) (2026-07-18)

### ✨ Features

* add llamacpp provider to Provider enum ([#75](#75)) ([bb7bc9c](bb7bc9c))
* add minimax to the provider enum ([#43](#43)) ([c28e450](c28e450))
* add nvidia provider to Provider enum ([#60](#60)) ([5cf8954](5cf8954)), closes [#59](#59)
* regenerate SDK with OpenAI-compatible chat params (schemas[#71](#71)) ([#50](#50)) ([61aa10b](61aa10b)), closes [#29](#29)
* sync SDK to schemas v0.6.2 (zai provider + Responses API) ([#77](#77)) ([3660d1d](3660d1d))

### 👷 CI

* centralize claude.yml via reusable workflow ([#41](#41)) ([1e620cb](1e620cb))
* **claude:** centralize claude.yml via reusable workflow ([#71](#71)) ([9b7481e](9b7481e))
* **deps:** bump actions/setup-node in the github-actions group ([#79](#79)) ([ab6a229](ab6a229))
* **deps:** bump the github-actions group with 2 updates ([#37](#37)) ([e7ecffe](e7ecffe))
* **deps:** bump the github-actions group with 2 updates ([#44](#44)) ([c050d02](c050d02))
* **deps:** bump the github-actions group with 2 updates ([#53](#53)) ([11bc31f](11bc31f))
* **deps:** bump the github-actions group with 2 updates ([#58](#58)) ([4c713e6](4c713e6))
* **deps:** bump the github-actions group with 3 updates ([#55](#55)) ([8429e7e](8429e7e))
* **deps:** upgrade actions/checkout from v6.0.3 to v7.0.0 across workflows ([8aecc57](8aecc57))
* **infer:** centralize infer.yml + sync .infer config ([#52](#52)) ([0c811d7](0c811d7))
* **infer:** centralize infer.yml via reusable workflow ([#68](#68)) ([7f43f8a](7f43f8a))
* **infer:** centralize infer.yml via reusable workflow ([#69](#69)) ([ffb5088](ffb5088))
* **release:** update semantic release and plugins to latest versions with local installation ([cbd1fbf](cbd1fbf))
* restrict default workflow token permissions to contents: read ([#67](#67)) ([f0e051a](f0e051a))

### 🔧 Miscellaneous

* **deps:** bump claude-code 2.1.158 -> 2.1.161 ([#38](#38)) ([8a9ebdf](8a9ebdf))
* **deps:** bump claude-code 2.1.161 -> 2.1.170 ([#45](#45)) ([7432928](7432928))
* **deps:** bump claude-code 2.1.170 -> 2.1.177, claude-code-action v1.0.142 -> v1.0.150 ([#47](#47)) ([1da5c4b](1da5c4b))
* **deps:** bump claude-code 2.1.177 -> 2.1.197, claude-code-action v1.0.164 -> v1.0.165 ([#61](#61)) ([bec7ff2](bec7ff2))
* **deps:** bump claude-code 2.1.197 -> 2.1.201 ([#62](#62)) ([b5e4b72](b5e4b72))
* **deps:** bump claude-code-action v1.0.150 -> v1.0.152 ([#51](#51)) ([3e482ec](3e482ec))
* **deps:** bump claude-code-action v1.0.165 -> v1.0.169 ([#70](#70)) ([d75f954](d75f954))
* **deps:** bump infer CLI v0.119.0 -> v0.120.0, infer-action v0.11.4 -> v0.11.6 ([#35](#35)) ([bed8d56](bed8d56))
* **deps:** bump infer CLI v0.120.0 -> v0.120.1, infer-action v0.11.6 -> v0.11.7 ([#36](#36)) ([6fab732](6fab732))
* **deps:** bump infer CLI v0.120.1 -> v0.121.0 ([#39](#39)) ([73d774c](73d774c))
* **deps:** bump infer CLI v0.121.0 -> v0.121.1, infer-action v0.12.1 -> v0.13.1 ([#46](#46)) ([fec4ec3](fec4ec3))
* **deps:** bump infer CLI v0.121.1 -> v0.122.2, infer-action v0.15.1 -> v0.15.4 ([#54](#54)) ([500f248](500f248))
* **deps:** bump infer CLI v0.122.2 -> v0.125.0, infer-action v0.19.0 -> v0.19.1 ([#56](#56)) ([81aabbe](81aabbe))
* **deps:** bump infer CLI v0.125.0 -> v0.130.1, infer-action v0.19.1 -> v0.23.1 ([#57](#57)) ([55dd93c](55dd93c))
* **deps:** bump infer CLI v0.130.1 -> v0.133.0, infer-action v0.23.7 -> v0.26.0 ([#63](#63)) ([1857793](1857793))
* **deps:** bump infer CLI v0.133.0 -> v0.133.1, infer-action v0.26.0 -> v0.27.1 ([#64](#64)) ([e5782d7](e5782d7))
* **deps:** bump infer CLI v0.133.1 -> v0.137.0, infer-action v0.27.1 -> v0.29.0 ([#65](#65)) ([096a508](096a508))
* **deps:** bump infer CLI v0.137.0 -> v0.138.0, infer-action v0.29.0 -> v0.30.1 ([#66](#66)) ([3278c1d](3278c1d))
* **deps:** bump infer CLI v0.138.0 -> v0.141.0 ([#72](#72)) ([228b82d](228b82d))
* **deps:** bump infer CLI v0.141.0 -> v0.147.1 ([#73](#73)) ([ab5ead3](ab5ead3))
* **deps:** bump infer-action v0.11.7 -> v0.12.1 ([#40](#40)) ([77db342](77db342))
* **deps:** bump infer-action v0.13.1 -> v0.15.1 ([#48](#48)) ([5db7965](5db7965))
* **deps:** update manifest files to schema version 1.13.0 and bump codex version to ^0.139.0 ([8a1f3ae](8a1f3ae))
* **release:** update GitHub App credentials to use RELEASER_APP_ID and RELEASER_APP_PRIVATE_KEY ([07c185f](07c185f))
* remove deprecated configuration and shortcut files ([e0ffeec](e0ffeec))
* replace pip pre-commit with .githooks hook ([#80](#80)) ([f89d568](f89d568))
* update CI workflow to include permissions ([59987f0](59987f0))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] sync SDK to schemas v0.6.1: zai provider + Responses API

1 participant