Skip to content

Commit 04a9b3b

Browse files
committed
update tests to use new transformer
1 parent b26f93b commit 04a9b3b

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

docs/models/anthropic.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Anthropic offers [Structured Outputs](https://docs.claude.com/en/docs/build-with
154154

155155
```python {test="skip"}
156156
from pydantic import BaseModel
157+
157158
from pydantic_ai import Agent, NativeOutput
158159
from pydantic_ai.models.anthropic import AnthropicModel
159160

tests/models/test_anthropic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,13 @@ def tool_two() -> str: # pragma: no cover
461461
'name': 'tool_one',
462462
'description': '',
463463
'input_schema': {'additionalProperties': False, 'properties': {}, 'type': 'object'},
464+
'strict': True,
464465
},
465466
{
466467
'name': 'tool_two',
467468
'description': '',
468469
'input_schema': {'additionalProperties': False, 'properties': {}, 'type': 'object'},
470+
'strict': True,
469471
'cache_control': {'type': 'ephemeral'},
470472
},
471473
]
@@ -540,6 +542,7 @@ def my_tool(value: str) -> str: # pragma: no cover
540542
'required': ['value'],
541543
'type': 'object',
542544
},
545+
'strict': True,
543546
'cache_control': {'type': 'ephemeral'},
544547
}
545548
]

tests/providers/test_openrouter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pydantic_ai.agent import Agent
1010
from pydantic_ai.exceptions import UserError
1111
from pydantic_ai.profiles.amazon import amazon_model_profile
12-
from pydantic_ai.profiles.anthropic import anthropic_model_profile
12+
from pydantic_ai.profiles.anthropic import AnthropicJsonSchemaTransformer, anthropic_model_profile
1313
from pydantic_ai.profiles.cohere import cohere_model_profile
1414
from pydantic_ai.profiles.deepseek import deepseek_model_profile
1515
from pydantic_ai.profiles.google import GoogleJsonSchemaTransformer, google_model_profile
@@ -114,7 +114,7 @@ def test_openrouter_provider_model_profile(mocker: MockerFixture):
114114
anthropic_profile = provider.model_profile('anthropic/claude-3.5-sonnet')
115115
anthropic_model_profile_mock.assert_called_with('claude-3.5-sonnet')
116116
assert anthropic_profile is not None
117-
assert anthropic_profile.json_schema_transformer == OpenAIJsonSchemaTransformer
117+
assert anthropic_profile.json_schema_transformer == AnthropicJsonSchemaTransformer
118118

119119
mistral_profile = provider.model_profile('mistralai/mistral-large-2407')
120120
mistral_model_profile_mock.assert_called_with('mistral-large-2407')

tests/providers/test_vercel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pydantic_ai._json_schema import InlineDefsJsonSchemaTransformer
88
from pydantic_ai.exceptions import UserError
99
from pydantic_ai.profiles.amazon import amazon_model_profile
10-
from pydantic_ai.profiles.anthropic import anthropic_model_profile
10+
from pydantic_ai.profiles.anthropic import AnthropicJsonSchemaTransformer, anthropic_model_profile
1111
from pydantic_ai.profiles.cohere import cohere_model_profile
1212
from pydantic_ai.profiles.deepseek import deepseek_model_profile
1313
from pydantic_ai.profiles.google import GoogleJsonSchemaTransformer, google_model_profile
@@ -82,7 +82,7 @@ def test_vercel_provider_model_profile(mocker: MockerFixture):
8282
profile = provider.model_profile('anthropic/claude-sonnet-4-5')
8383
anthropic_mock.assert_called_with('claude-sonnet-4-5')
8484
assert profile is not None
85-
assert profile.json_schema_transformer == OpenAIJsonSchemaTransformer
85+
assert profile.json_schema_transformer == AnthropicJsonSchemaTransformer
8686

8787
# Test bedrock provider
8888
profile = provider.model_profile('bedrock/anthropic.claude-sonnet-4-5')

0 commit comments

Comments
 (0)