Skip to content

Accept xhigh reasoning_effort and add grok-4.6 to ChatModel - #189

Merged
gyang-xai merged 2 commits into
mainfrom
ming/xhigh-reasoning-effort
Aug 12, 2026
Merged

Accept xhigh reasoning_effort and add grok-4.6 to ChatModel#189
gyang-xai merged 2 commits into
mainfrom
ming/xhigh-reasoning-effort

Conversation

@gyang-xai

@gyang-xai gyang-xai commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The API accepts reasoning_effort=xhigh for models such as grok-4.6, but the SDK still rejects the string:

ValueError: Invalid reasoning effort: invalid. Must be one of: ('none', 'low', 'medium', 'high')

This closes the gap:

  • Add "xhigh" to the ReasoningEffort type literal (types/chat.py).
  • Map "xhigh"EFFORT_XHIGH in _reasoning_effort_to_proto and update the reasoning_effort docstring (chat.py).
  • Vendor regenerated chat_pb2.py / chat_pb2.pyi (v5 + v6) carrying EFFORT_XHIGH = 5, generated with buf generate from Add EFFORT_XHIGH to ReasoningEffort enum xai-proto#70 (which adds the enum value to the public proto).
  • Add grok-4.6 to the ChatModel known-model literal (types/model.py). Purely a typing/autocomplete aid — model params are Union[ChatModel, str], so behavior is unchanged.
  • CHANGELOG entry under [Unreleased] / Added.
  • Extend the aio/sync parametrized reasoning tests with the new string and enum cases, and update the invalid-value error-message assertions.

Test plan

  • uv run pytest -n auto — 767 passed.
  • uv run ruff format --check, uv run ruff check, uv run pyright — clean.
  • Runtime sanity check: chat_pb2.ReasoningEffort.EFFORT_XHIGH == 5 for both v5 and v6 stubs, _reasoning_effort_to_proto("xhigh") returns it, and 'grok-4.6' in typing.get_args(ChatModel).

shawnthapa
shawnthapa previously approved these changes Aug 12, 2026
mark-xai
mark-xai previously approved these changes Aug 12, 2026
@gyang-xai
gyang-xai dismissed stale reviews from mark-xai and shawnthapa via c4261d5 August 12, 2026 21:26
@gyang-xai
gyang-xai merged commit 22a9922 into main Aug 12, 2026
7 checks passed
@gyang-xai
gyang-xai deleted the ming/xhigh-reasoning-effort branch August 12, 2026 22:48
shawnthapa pushed a commit to xai-org/xai-proto that referenced this pull request Aug 12, 2026
# Changes
- Add `EFFORT_XHIGH = 5` to the `ReasoningEffort` enum in `chat.proto`,
matching the value already served by the API (`reasoning_effort=xhigh`,
supported by models such as `grok-4.6`).
- Clarify the `reasoning_effort` field comments: the default varies by
model (e.g. `grok-4.5` and `grok-4.6` default to `EFFORT_HIGH`) rather
than always being `EFFORT_MEDIUM`.

Same shape as #49 (which added `EFFORT_NONE`). Companion SDK change:
xai-org/xai-sdk-python#189 adds the `"xhigh"` literal and regenerated
stubs.
gyang-xai added a commit that referenced this pull request Aug 13, 2026
Bump version from 1.17.1 to 1.18.0 (minor: additive changes only) to
release the current `[Unreleased]` changes, including `xhigh` reasoning
effort support and `grok-4.6` in `ChatModel` (#189).

On merge, the auto-tag workflow will create `v1.18.0`; the Release
workflow can then be dispatched against that tag to publish to PyPI.
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.

3 participants