Skip to content

[codex] 修复工具 schema type 为 null#3146

Open
SchrodingerBarbatos wants to merge 1 commit into
farion1231:mainfrom
SchrodingerBarbatos:codex/fix-null-tool-schema-type
Open

[codex] 修复工具 schema type 为 null#3146
SchrodingerBarbatos wants to merge 1 commit into
farion1231:mainfrom
SchrodingerBarbatos:codex/fix-null-tool-schema-type

Conversation

@SchrodingerBarbatos
Copy link
Copy Markdown

@SchrodingerBarbatos SchrodingerBarbatos commented May 25, 2026

关联问题

摘要

  • 在 Anthropic 转 OpenAI Chat 的工具 schema 转换中,如果 object 形态的 schema 缺失 typetypenull,自动补成 "object"
  • 增加回归测试,覆盖 type 缺失和显式 type: null 两种工具 schema 场景。

原因

DeepSeek 对 OpenAI Chat 的 function.parameters 校验更严格,当 JSON Schema 中出现 type: null 时会拒绝请求。Anthropic 工具 schema 可能通过 propertiesrequiredadditionalProperties 表现为 object 形态,因此转换层需要在转发前把这类 schema 规范化。

验证

  • cargo test --manifest-path src-tauri/Cargo.toml test_anthropic_to_openai_fills_missing_or_null_object_schema_type --lib -- --nocapture
  • cargo test --manifest-path src-tauri/Cargo.toml transform --lib -- --nocapture
  • .\node_modules\.bin\tsc.cmd --noEmit
  • npx --yes pnpm@11.3.0 tauri build --config tauri-no-updater-artifacts.json

@SchrodingerBarbatos SchrodingerBarbatos changed the title [codex] fix null tool schema type [codex] 修复工具 schema type 为 null May 25, 2026
@SchrodingerBarbatos SchrodingerBarbatos marked this pull request as ready for review May 25, 2026 15:03
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.

DeepSeek 返回 Invalid schema: got 'type: null' 错误。

1 participant