-
Notifications
You must be signed in to change notification settings - Fork 279
Open
Labels
Description
Background
Some LLM APIs, such as Gemini, do not support the additionalProperties constraint in JSON schemas and return errors if it is present. Currently, we work around this by stripping all additional fields after schema generation using a helper in gemini.rs.
To address this more cleanly, introduce a supports_additional_properties: bool field in the ToJsonSchemaOptions struct.
Tasks
- Add a
supports_additional_properties: boolfield to ToJsonSchemaOptions. - Update schema generation logic to only include additionalProperties if this field is true.
- Update all code that constructs ToJsonSchemaOptions to set this field appropriately (e.g., false for Gemini, true for OpenAI).
- Remove the remove_additional_properties function from gemini.rs and any related post-processing.
Context
This addition will make it easier to support new LLMs with different schema requirements and reduce the risk of runtime errors due to schema incompatibility.