Skip to content

Commit c0e0a2e

Browse files
conradleeclaude
andcommitted
Simplify comments and reference upstream genai issue
Reference the underlying issue in googleapis/python-genai instead of repeating the detailed explanation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f886ed6 commit c0e0a2e

File tree

1 file changed

+1
-8
lines changed
  • pydantic_ai_slim/pydantic_ai/profiles

1 file changed

+1
-8
lines changed

pydantic_ai_slim/pydantic_ai/profiles/google.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ class GoogleJsonSchemaTransformer(JsonSchemaTransformer):
3636
"""Transforms the JSON Schema from Pydantic to be suitable for Gemini.
3737
3838
Gemini supports [a subset of OpenAPI v3.0.3](https://ai.google.dev/gemini-api/docs/function-calling#function_declarations).
39-
40-
Note: Gemini's tool calling system treats 'title' fields as callable function names,
41-
causing MALFORMED_FUNCTION_CALL errors. This fixes issue #3483 where nested Pydantic models were
42-
treated as tool calls instead of structured output schema. We remove 'title' from all schemas
43-
since the function declaration name is set separately in the ToolDefinition.
4439
"""
4540

4641
def transform(self, schema: JsonSchema) -> JsonSchema:
@@ -52,9 +47,7 @@ def transform(self, schema: JsonSchema) -> JsonSchema:
5247
schema.pop('discriminator', None)
5348
schema.pop('examples', None)
5449

55-
# Remove 'title' - Gemini treats these as callable function names in tool calling mode,
56-
# causing MALFORMED_FUNCTION_CALL errors. The title for the function declaration itself
57-
# is set separately in the ToolDefinition, so we don't need it in the schema.
50+
# Remove 'title' due to https://github.com/googleapis/python-genai/issues/1732
5851
schema.pop('title', None)
5952

6053
type_ = schema.get('type')

0 commit comments

Comments
 (0)