feat(bedrock): add GLM-5 reasoning support on AWS Bedrock#28264
Open
lopince wants to merge 14 commits into
Open
feat(bedrock): add GLM-5 reasoning support on AWS Bedrock#28264lopince wants to merge 14 commits into
lopince wants to merge 14 commits into
Conversation
- Add reasoning_config variants (default/low/medium/high) via additionalModelRequestFields for GLM models on Bedrock - Add safety fallback in options() defaulting to reasoning_config "medium" - Add smallOptions() fallback using reasoning_config "low" for title/summary calls that bypass the variant system - Fix normalizeMessages() to coerce GLM tool-call string inputs back to JSON objects (Bedrock Converse rejects string toolUse.input on replay) - Add topP=0.95 for GLM models - Add glm.txt system prompt tailored for GLM-5 on Bedrock - Route GLM/zai_glm model IDs to the new GLM prompt in system.ts
This was referenced May 20, 2026
GLM models only support a binary thinking toggle, not graduated effort levels. Replace the low/medium/high variants with a single "enabled" variant that sends reasoning_config: "high" to Bedrock. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GLM models only support a binary thinking toggle, not graduated effort levels. Expose a single "high" variant (consistent with how Anthropic and Nova on Bedrock use effort-level keys) that sends reasoning_config: "high" to toggle thinking on. No variant = reasoning off. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Issue for this PR
Closes #28168
Type of change
What does this PR do?
Adds reasoning control for ZAI GLM-5 models on AWS Bedrock. Bedrock exposes GLM reasoning via
additionalModelRequestFields.reasoning_config, which is different from the existing Anthropicthinkingand NovareasoningConfigpatterns.GLM models only support a binary thinking toggle (not graduated effort levels), so we expose a single
highvariant — following the same convention as Anthropic and Nova on Bedrock where selecting an effort level enables reasoning. The variant sendsreasoning_config: "high"to Bedrock.Also fixes a tool-call replay bug: GLM streams tool args as partial strings, and Bedrock Converse rejects string
toolUse.inputon history replay. The fix coerces them back to JSON objects.Usage
Set
variant: "high"in your agent config:{ "agent": { "variant": "high" } }Reasoning is disabled by default — only enabled when the variant is explicitly selected. Same pattern as
variant: "high"for Nova orvariant: "max"for Anthropic on Bedrock.How did you verify your code works?
Checklist