You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: bool field 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.
The text was updated successfully, but these errors were encountered:
par4m
changed the title
[FEATURE] Configurable additionalProperties in JSON Schema via ToJsonSchemaOptions
[FEATURE] Configurable additionalProperties in JSON Schema
Apr 21, 2025
Uh oh!
There was an error while loading. Please reload this page.
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 ingemini.rs
.To address this more cleanly, introduce a
supports_additional_properties: bool
field in theToJsonSchemaOptions
struct.Tasks
supports_additional_properties: bool
field to ToJsonSchemaOptions.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.
The text was updated successfully, but these errors were encountered: