[codex] 修复工具 schema type 为 null#3146
Open
SchrodingerBarbatos wants to merge 1 commit into
Open
Conversation
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.
关联问题
摘要
type或type为null,自动补成"object"。type缺失和显式type: null两种工具 schema 场景。原因
DeepSeek 对 OpenAI Chat 的
function.parameters校验更严格,当 JSON Schema 中出现type: null时会拒绝请求。Anthropic 工具 schema 可能通过properties、required或additionalProperties表现为 object 形态,因此转换层需要在转发前把这类 schema 规范化。验证
cargo test --manifest-path src-tauri/Cargo.toml test_anthropic_to_openai_fills_missing_or_null_object_schema_type --lib -- --nocapturecargo test --manifest-path src-tauri/Cargo.toml transform --lib -- --nocapture.\node_modules\.bin\tsc.cmd --noEmitnpx --yes pnpm@11.3.0 tauri build --config tauri-no-updater-artifacts.json