OpenAI strict mode rejects optional properties in nested objects
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start from toJSONValueForOpenAIStrictMode() and toJSONValueForOpenResponsesStrictMode(), which currently apply strict-mode rules only to the root object. Walk the schema recursively so every nested object gets the same treatment: all properties listed in required, and optional property types made nullable. The issue's Contact/Address example and the enum-case note in #322 are the cases to check. Done when nested optional properties pass strict mode in both OpenAI and Open Responses schemas, with tests covering nested and enum cases.
由索引模型根据 Issue 内容生成。
描述
OpenAILanguageModel and OpenResponsesLanguageModel send structured output schemas with strict: true. OpenAI's strict mode requires every property of every object to be in required, with a null type for an optional one. toJSONValueForOpenAIStrictMode() and toJSONValueForOpenResponsesStrictMode() only do this for the root object, so an optional property in a nested object is left out of required.
For example, unit isn't in Address's required here:
@Generable
struct Contact {
var name: String
var address: Address
}
@Generable
struct Address {
var street: String
var unit: String?
}
The same goes for enum cases with optional values, like case note(String?) (#322).
The fix is probably to apply the root's rules to every object in the schema, and make each optional property's type nullable.
- 主要语言
- Swift
- 星标
- 948
- 派生
- 99
- 平均合并
- 19 小时 50 分钟
- 30 天内合并 PR
- 51
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
huggingface/AnyLanguageModel 的其他 Issue
-
OpenAILanguageModel replays tool-call arguments as GeneratedContent's Codable form, not JSON可能已有人在做 @gtokman 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
huggingface/AnyLanguageModel#324 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 18/100
huggingface/AnyLanguageModel#328 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 50/100
huggingface/AnyLanguageModel#326 · 2 条评论 ·
维护者通常 1 天内回复
-
Support the Gemini Interactions API in GeminiLanguageModel可能重新可做 @rizwankce 于 8 天前认领,目前没有进行中的 PR。 未关闭
难度 5/5 一周以上 新手友好度 45/100
huggingface/AnyLanguageModel#302 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
huggingface/AnyLanguageModel#291 · 1 个 reaction ·
维护者通常 1 天内回复
查看 huggingface/AnyLanguageModel 的全部 Issue
相似的 Issue
-
type: cleanup
难度 2/5 1-3 小时 新手友好度 78/100
googleapis/google-cloud-swift#1477 ·
维护者通常 1 天内回复
-
product / auth product / console product / databases product / messaging product / self-hosted product / sites product / storage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
P1 status: first-line-handled status: needs-triage
难度 2/5 1-3 小时 新手友好度 62/100
a2ui-project/a2ui#3282 · 1 条评论 ·
维护者通常 2 天内回复
-
binding:web core docs p3
难度 2/5 1-3 小时 新手友好度 85/100
RunanywhereAI/runanywhere-sdks#1123 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
omacom/try-omarchy#359 ·
维护者通常 1 天内回复