Skip to content

Commit d87aed8

Browse files
Google: Use parameters_json_schema for function declarations
Use parameters_json_schema instead of parameters (with schema_from_param conversion) for FunctionDeclaration. This preserves the full JSON Schema including anyOf types, which Gemini 3+ handles correctly via the REST API. See: google/adk-python#3424
1 parent eac4142 commit d87aed8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/inspect_ai/model/_providers/google.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,12 @@ def _categorize_tool(
783783
FunctionDeclaration(
784784
name=tool.name,
785785
description=tool.description,
786-
parameters=schema_from_param(tool.parameters)
786+
# Use parameters_json_schema to preserve full JSON Schema
787+
# including anyOf types, which Gemini 3+ handles correctly
788+
# but the Schema format (via schema_from_param) loses
789+
parameters_json_schema=tool.parameters.model_dump(
790+
exclude_none=True
791+
)
787792
if len(tool.parameters.properties) > 0
788793
else None,
789794
)

0 commit comments

Comments
 (0)