From 3eb57cfe2d922b2e32236443311ae01d8f71a26b Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 17:37:33 +0200 Subject: [PATCH] gemini: Fix issue with builtin tool schemas (cherry-pick #33917) (#33919) Cherry-picked gemini: Fix issue with builtin tool schemas (#33917) Closes #33894 After #33635 Gemini Integration was broken because we now produce `const` fields for enums, which are not supported. Changing this to `openapi3` fixes the issue. Release Notes: - Fixed an issue where Gemini Models would not work because of incompatible tool schemas Co-authored-by: Bennet Bo Fenner --- crates/assistant_tools/src/schema.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/assistant_tools/src/schema.rs b/crates/assistant_tools/src/schema.rs index 888e11de4e83df853d5d1c252d30cecf84c701a2..10a8bf0acd99131d2c0a80411072f312c9a42f50 100644 --- a/crates/assistant_tools/src/schema.rs +++ b/crates/assistant_tools/src/schema.rs @@ -25,9 +25,7 @@ fn schema_to_json( fn root_schema_for(format: LanguageModelToolSchemaFormat) -> Schema { let mut generator = match format { LanguageModelToolSchemaFormat::JsonSchema => SchemaSettings::draft07().into_generator(), - // TODO: Gemini docs mention using a subset of OpenAPI 3, so this may benefit from using - // `SchemaSettings::openapi3()`. - LanguageModelToolSchemaFormat::JsonSchemaSubset => SchemaSettings::draft07() + LanguageModelToolSchemaFormat::JsonSchemaSubset => SchemaSettings::openapi3() .with(|settings| { settings.meta_schema = None; settings.inline_subschemas = true;