-
-
Notifications
You must be signed in to change notification settings - Fork 512
Open
Description
Summary
When using Schema.optional for tool parameters with @effect/ai-openai, OpenAI rejects the request with:
Invalid schema for function 'search': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'limit'.
Root Cause
OpenAiLanguageModel.ts:1306hardcodesstrict: truefor all tools- OpenAI strict mode requires ALL properties to be in the
requiredarray Schema.optionalexcludes the property fromrequired(correct JSON Schema behavior)- OpenAI rejects schemas where properties exist but aren't in
required
Workaround
Use Schema.NullOr instead of Schema.optional and transform null -> undefined at decode time. Additionally, override the JSON schema annotation to use type: [originalType, "null"].
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels