feat: add Claude 4.6 models and fix OpenClaw 422 validation errors#39
Closed
bhargav18 wants to merge 1 commit intoRichardAtCT:mainfrom
Closed
feat: add Claude 4.6 models and fix OpenClaw 422 validation errors#39bhargav18 wants to merge 1 commit intoRichardAtCT:mainfrom
bhargav18 wants to merge 1 commit intoRichardAtCT:mainfrom
Conversation
- Add claude-sonnet-4-6 and claude-opus-4-6 to CLAUDE_MODELS - Set claude-sonnet-4-6 as the new DEFAULT_MODEL - Fix 422 errors from OpenClaw by accepting role: 'tool' in messages - Handle null/None message content (assistant messages mid-tool-call) - Loosen ContentPart to accept any content block type (tool_use, tool_result, image, etc.) - Extract text from tool_result content blocks during normalization - Add model_config extra='ignore' to drop unknown fields silently Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
claude-sonnet-4-6andclaude-opus-4-6toCLAUDE_MODELSand setclaude-sonnet-4-6as the newDEFAULT_MODELrole: 'tool'messages,nullcontent, and arbitrary content block typesmodel_config extra='ignore'to silently drop unknown fields (e.g.store,service_tier) sent by OpenClawChanges
src/constants.pyclaude-sonnet-4-6,claude-opus-4-6) at the top ofCLAUDE_MODELSDEFAULT_MODELfromclaude-sonnet-4-5-20250929toclaude-sonnet-4-6src/models.pyMessage.role: added"tool"to allowed roles — OpenClaw sends tool result messages withrole: "tool"Message.content: changed toOptional[Union[str, List[Any]]]to handlenullcontent (assistant messages mid-tool-call) and arbitrary content block arraysContentPart: loosenedtypefromLiteral["text"]tostrand madetextoptional to handle non-text block types (tool_use, tool_result, image, etc.)normalize_content: added null handling and text extraction fromtool_resultcontent blocksmodel_config = {"extra": "ignore"}to bothContentPartandMessageto silently drop unknown fieldsTest plan
poetry run python tests/test_endpoints.py→ 4/4poetry run python tests/test_basic.py→ 4/4poetry run uvicorn src.main:app --reload --port 8000🤖 Generated with Claude Code