Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pydantic_ai_slim/pydantic_ai/profiles/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def transform(self, schema: JsonSchema) -> JsonSchema:
)

schema.pop('title', None)
schema.pop('default', None)
schema.pop('$schema', None)
if (const := schema.pop('const', None)) is not None:
# Gemini doesn't support const, but it does support enum with a single value
Expand Down
32 changes: 24 additions & 8 deletions tests/models/test_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def test_require_response_tool(allow_model_requests: None):

async def test_json_def_replaced(allow_model_requests: None):
class Axis(BaseModel):
label: str
label: str = Field(default='<unlabeled axis>', description='The label of the axis')

class Chart(BaseModel):
x_axis: Axis
Expand All @@ -213,8 +213,14 @@ class Locations(BaseModel):
{
'$defs': {
'Axis': {
'properties': {'label': {'title': 'Label', 'type': 'string'}},
'required': ['label'],
'properties': {
'label': {
'default': '<unlabeled axis>',
'description': 'The label of the axis',
'title': 'Label',
'type': 'string',
}
},
'title': 'Axis',
'type': 'object',
},
Expand Down Expand Up @@ -268,17 +274,27 @@ class Locations(BaseModel):
'items': {
'properties': {
'lat': {'type': 'number'},
'lng': {'type': 'number'},
'lng': {'default': 1.1, 'type': 'number'},
'chart': {
'properties': {
'x_axis': {
'properties': {'label': {'type': 'string'}},
'required': ['label'],
'properties': {
'label': {
'default': '<unlabeled axis>',
'description': 'The label of the axis',
'type': 'string',
}
},
'type': 'object',
},
'y_axis': {
'properties': {'label': {'type': 'string'}},
'required': ['label'],
'properties': {
'label': {
'default': '<unlabeled axis>',
'description': 'The label of the axis',
'type': 'string',
}
},
'type': 'object',
},
},
Expand Down