pydantic-ai-slim 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pydantic-ai-slim might be problematic. Click here for more details.

@@ -217,6 +217,9 @@ KnownModelName = TypeAliasType(
217
217
  'heroku:claude-3-7-sonnet',
218
218
  'heroku:claude-4-sonnet',
219
219
  'heroku:claude-3-haiku',
220
+ 'heroku:gpt-oss-120b',
221
+ 'heroku:nova-lite',
222
+ 'heroku:nova-pro',
220
223
  'huggingface:Qwen/QwQ-32B',
221
224
  'huggingface:Qwen/Qwen2.5-72B-Instruct',
222
225
  'huggingface:Qwen/Qwen3-235B-A22B',
@@ -790,12 +793,18 @@ def get_user_agent() -> str:
790
793
  def _customize_tool_def(transformer: type[JsonSchemaTransformer], t: ToolDefinition):
791
794
  schema_transformer = transformer(t.parameters_json_schema, strict=t.strict)
792
795
  parameters_json_schema = schema_transformer.walk()
793
- if t.strict is None:
794
- t = replace(t, strict=schema_transformer.is_strict_compatible)
795
- return replace(t, parameters_json_schema=parameters_json_schema)
796
+ return replace(
797
+ t,
798
+ parameters_json_schema=parameters_json_schema,
799
+ strict=schema_transformer.is_strict_compatible if t.strict is None else t.strict,
800
+ )
796
801
 
797
802
 
798
803
  def _customize_output_object(transformer: type[JsonSchemaTransformer], o: OutputObjectDefinition):
799
- schema_transformer = transformer(o.json_schema, strict=True)
800
- son_schema = schema_transformer.walk()
801
- return replace(o, json_schema=son_schema)
804
+ schema_transformer = transformer(o.json_schema, strict=o.strict)
805
+ json_schema = schema_transformer.walk()
806
+ return replace(
807
+ o,
808
+ json_schema=json_schema,
809
+ strict=schema_transformer.is_strict_compatible if o.strict is None else o.strict,
810
+ )
@@ -59,6 +59,8 @@ if TYPE_CHECKING:
59
59
  MessageUnionTypeDef,
60
60
  PerformanceConfigurationTypeDef,
61
61
  PromptVariableValuesTypeDef,
62
+ ReasoningContentBlockOutputTypeDef,
63
+ ReasoningTextBlockTypeDef,
62
64
  SystemContentBlockTypeDef,
63
65
  ToolChoiceTypeDef,
64
66
  ToolConfigurationTypeDef,
@@ -276,9 +278,10 @@ class BedrockConverseModel(Model):
276
278
  if reasoning_content := item.get('reasoningContent'):
277
279
  reasoning_text = reasoning_content.get('reasoningText')
278
280
  if reasoning_text: # pragma: no branch
279
- thinking_part = ThinkingPart(content=reasoning_text['text'])
280
- if reasoning_signature := reasoning_text.get('signature'):
281
- thinking_part.signature = reasoning_signature
281
+ thinking_part = ThinkingPart(
282
+ content=reasoning_text['text'],
283
+ signature=reasoning_text.get('signature'),
284
+ )
282
285
  items.append(thinking_part)
283
286
  if text := item.get('text'):
284
287
  items.append(TextPart(content=text))
@@ -462,8 +465,19 @@ class BedrockConverseModel(Model):
462
465
  if isinstance(item, TextPart):
463
466
  content.append({'text': item.content})
464
467
  elif isinstance(item, ThinkingPart):
465
- # NOTE: We don't pass the thinking part to Bedrock since it raises an error.
466
- pass
468
+ if BedrockModelProfile.from_profile(self.profile).bedrock_send_back_thinking_parts:
469
+ reasoning_text: ReasoningTextBlockTypeDef = {
470
+ 'text': item.content,
471
+ }
472
+ if item.signature:
473
+ reasoning_text['signature'] = item.signature
474
+ reasoning_content: ReasoningContentBlockOutputTypeDef = {
475
+ 'reasoningText': reasoning_text,
476
+ }
477
+ content.append({'reasoningContent': reasoning_content})
478
+ else:
479
+ # NOTE: We don't pass the thinking part to Bedrock for models other than Claude since it raises an error.
480
+ pass
467
481
  else:
468
482
  assert isinstance(item, ToolCallPart)
469
483
  content.append(self._map_tool_call(item))
@@ -610,7 +624,11 @@ class BedrockStreamedResponse(StreamedResponse):
610
624
  delta = chunk['contentBlockDelta']['delta']
611
625
  if 'reasoningContent' in delta:
612
626
  if text := delta['reasoningContent'].get('text'):
613
- yield self._parts_manager.handle_thinking_delta(vendor_part_id=index, content=text)
627
+ yield self._parts_manager.handle_thinking_delta(
628
+ vendor_part_id=index,
629
+ content=text,
630
+ signature=delta['reasoningContent'].get('signature'),
631
+ )
614
632
  else: # pragma: no cover
615
633
  warnings.warn(
616
634
  f'Only text reasoning content is supported yet, but you got {delta["reasoningContent"]}. '
@@ -7,7 +7,15 @@ from typing import Callable, Union
7
7
  from typing_extensions import Self
8
8
 
9
9
  from ..output import StructuredOutputMode
10
- from ._json_schema import JsonSchemaTransformer
10
+ from ._json_schema import InlineDefsJsonSchemaTransformer, JsonSchemaTransformer
11
+
12
+ __all__ = [
13
+ 'ModelProfile',
14
+ 'ModelProfileSpec',
15
+ 'DEFAULT_PROFILE',
16
+ 'InlineDefsJsonSchemaTransformer',
17
+ 'JsonSchemaTransformer',
18
+ ]
11
19
 
12
20
 
13
21
  @dataclass
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations as _annotations
2
2
 
3
- from . import ModelProfile
4
- from ._json_schema import InlineDefsJsonSchemaTransformer
3
+ from . import InlineDefsJsonSchemaTransformer, ModelProfile
5
4
 
6
5
 
7
6
  def amazon_model_profile(model_name: str) -> ModelProfile | None:
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations as _annotations
2
2
 
3
- from . import ModelProfile
4
- from ._json_schema import InlineDefsJsonSchemaTransformer
3
+ from . import InlineDefsJsonSchemaTransformer, ModelProfile
5
4
 
6
5
 
7
6
  def meta_model_profile(model_name: str) -> ModelProfile | None:
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations as _annotations
2
2
 
3
- from . import ModelProfile
4
- from ._json_schema import InlineDefsJsonSchemaTransformer
3
+ from . import InlineDefsJsonSchemaTransformer, ModelProfile
5
4
 
6
5
 
7
6
  def qwen_model_profile(model_name: str) -> ModelProfile | None:
@@ -36,6 +36,7 @@ class BedrockModelProfile(ModelProfile):
36
36
 
37
37
  bedrock_supports_tool_choice: bool = True
38
38
  bedrock_tool_result_format: Literal['text', 'json'] = 'text'
39
+ bedrock_send_back_thinking_parts: bool = False
39
40
 
40
41
 
41
42
  class BedrockProvider(Provider[BaseClient]):
@@ -55,9 +56,9 @@ class BedrockProvider(Provider[BaseClient]):
55
56
 
56
57
  def model_profile(self, model_name: str) -> ModelProfile | None:
57
58
  provider_to_profile: dict[str, Callable[[str], ModelProfile | None]] = {
58
- 'anthropic': lambda model_name: BedrockModelProfile(bedrock_supports_tool_choice=False).update(
59
- anthropic_model_profile(model_name)
60
- ),
59
+ 'anthropic': lambda model_name: BedrockModelProfile(
60
+ bedrock_supports_tool_choice=False, bedrock_send_back_thinking_parts=True
61
+ ).update(anthropic_model_profile(model_name)),
61
62
  'mistral': lambda model_name: BedrockModelProfile(bedrock_tool_result_format='json').update(
62
63
  mistral_model_profile(model_name)
63
64
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai-slim
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Agent Framework / shim to use Pydantic with LLMs, slim package
5
5
  Author-email: Samuel Colvin <samuel@pydantic.dev>, Marcelo Trylesinski <marcelotryle@gmail.com>, David Montague <david@pydantic.dev>, Alex Hall <alex@pydantic.dev>, Douwe Maan <douwe@pydantic.dev>
6
6
  License-Expression: MIT
@@ -30,7 +30,7 @@ Requires-Dist: exceptiongroup; python_version < '3.11'
30
30
  Requires-Dist: griffe>=1.3.2
31
31
  Requires-Dist: httpx>=0.27
32
32
  Requires-Dist: opentelemetry-api>=1.28.0
33
- Requires-Dist: pydantic-graph==0.6.0
33
+ Requires-Dist: pydantic-graph==0.6.1
34
34
  Requires-Dist: pydantic>=2.10
35
35
  Requires-Dist: typing-inspection>=0.4.0
36
36
  Provides-Extra: a2a
@@ -41,7 +41,7 @@ Requires-Dist: starlette>=0.45.3; extra == 'ag-ui'
41
41
  Provides-Extra: anthropic
42
42
  Requires-Dist: anthropic>=0.61.0; extra == 'anthropic'
43
43
  Provides-Extra: bedrock
44
- Requires-Dist: boto3>=1.37.24; extra == 'bedrock'
44
+ Requires-Dist: boto3>=1.39.0; extra == 'bedrock'
45
45
  Provides-Extra: cli
46
46
  Requires-Dist: argcomplete>=3.5.0; extra == 'cli'
47
47
  Requires-Dist: prompt-toolkit>=3; extra == 'cli'
@@ -51,7 +51,7 @@ Requires-Dist: cohere>=5.16.0; (platform_system != 'Emscripten') and extra == 'c
51
51
  Provides-Extra: duckduckgo
52
52
  Requires-Dist: ddgs>=9.0.0; extra == 'duckduckgo'
53
53
  Provides-Extra: evals
54
- Requires-Dist: pydantic-evals==0.6.0; extra == 'evals'
54
+ Requires-Dist: pydantic-evals==0.6.1; extra == 'evals'
55
55
  Provides-Extra: google
56
56
  Requires-Dist: google-genai>=1.28.0; extra == 'google'
57
57
  Provides-Extra: groq
@@ -33,9 +33,9 @@ pydantic_ai/common_tools/tavily.py,sha256=Q1xxSF5HtXAaZ10Pp-OaDOHXwJf2mco9wScGEQ
33
33
  pydantic_ai/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  pydantic_ai/ext/aci.py,sha256=vUaNIj6pRM52x6RkPW_DohSYxJPm75pPUfOMw2i5Xx0,2515
35
35
  pydantic_ai/ext/langchain.py,sha256=GemxfhpyG1JPxj69PbRiSJANnY8Q5s4hSB7wqt-uTbo,2266
36
- pydantic_ai/models/__init__.py,sha256=Td74RbYGF7bOdG2zJGKAC4rfEQtJunf86xv-s3Ylh3A,30776
36
+ pydantic_ai/models/__init__.py,sha256=LRXVWRpnKt8ZZ_4nud2EAImuJoZWH4ONNTcm0lllUvg,30998
37
37
  pydantic_ai/models/anthropic.py,sha256=WtugATjLkmuNMtOeitKPNDjc6iE5NO_UxBKisHL_JNY,24171
38
- pydantic_ai/models/bedrock.py,sha256=AJqZVU5gsTCcdHx37RhDrQAODKswpTlKzl4pd3Gi5CE,29515
38
+ pydantic_ai/models/bedrock.py,sha256=uQD6ciolrjXTFxvcLZALfaYnggmHMjpAUp6VxJ1bwL4,30450
39
39
  pydantic_ai/models/cohere.py,sha256=DnIbZuUP3LuJ7FS0KYqt3BU3blyG3Xs44XqhSshvhI4,12832
40
40
  pydantic_ai/models/fallback.py,sha256=URaV-dTQWkg99xrlkmknue5lXZWDcEt7cJ1Vsky4oB4,5130
41
41
  pydantic_ai/models/function.py,sha256=iHhG6GYN14XDo3_qbdliv_umY10B7-k11aoDoVF4xP8,13563
@@ -49,23 +49,23 @@ pydantic_ai/models/mistral.py,sha256=rGhIHl2fS2LIJWzXNwYZTw2ZGJviF4Rfr36wS7mlcNc
49
49
  pydantic_ai/models/openai.py,sha256=d7KCXaPl0txvJ3647USvFM-8T-iF5ue1XpXlo-IwHIg,56130
50
50
  pydantic_ai/models/test.py,sha256=lGMblastixKF_f5MhP3TcvLWx7jj94H4ohmL7DMpdGo,18482
51
51
  pydantic_ai/models/wrapper.py,sha256=A5-ncYhPF8c9S_czGoXkd55s2KOQb65p3jbVpwZiFPA,2043
52
- pydantic_ai/profiles/__init__.py,sha256=uC1_64Pb0O1IMt_SwzvU3W7a2_T3pvdoSDcm8_WI7hw,2592
52
+ pydantic_ai/profiles/__init__.py,sha256=Ggk_pbNnRcaGnDWEBppsH3sUk8ajckaaXKfJlkLQWVo,2775
53
53
  pydantic_ai/profiles/_json_schema.py,sha256=CthOGmPSjgEZRRglfvg31zyQ9vjHDdacXoFpmba93dE,7206
54
- pydantic_ai/profiles/amazon.py,sha256=O4ijm1Lpz01vaSiHrkSeGQhbCKV5lyQVtHYqh0pCW_k,339
54
+ pydantic_ai/profiles/amazon.py,sha256=IPa2wydpcbFLLvhDK35-pwwoKo0Pg4vP84823fHx0zc,314
55
55
  pydantic_ai/profiles/anthropic.py,sha256=J9N46G8eOjHdQ5CwZSLiwGdPb0eeIMdsMjwosDpvNhI,275
56
56
  pydantic_ai/profiles/cohere.py,sha256=lcL34Ht1jZopwuqoU6OV9l8vN4zwF-jiPjlsEABbSRo,215
57
57
  pydantic_ai/profiles/deepseek.py,sha256=DS_idprnXpMliKziKF0k1neLDJOwUvpatZ3YLaiYnCM,219
58
58
  pydantic_ai/profiles/google.py,sha256=cd5zwtx0MU1Xwm8c-oqi2_OJ2-PMJ8Vy23mxvSJF7ik,4856
59
59
  pydantic_ai/profiles/grok.py,sha256=nBOxOCYCK9aiLmz2Q-esqYhotNbbBC1boAoOYIk1tVw,211
60
- pydantic_ai/profiles/meta.py,sha256=IAGPoUrLWd-g9ajAgpWp9fIeOrP-7dBlZ2HEFjIhUbY,334
60
+ pydantic_ai/profiles/meta.py,sha256=JdZcpdRWx8PY1pU9Z2i_TYtA0Cpbg23xyFrV7eXnooY,309
61
61
  pydantic_ai/profiles/mistral.py,sha256=ll01PmcK3szwlTfbaJLQmfd0TADN8lqjov9HpPJzCMQ,217
62
62
  pydantic_ai/profiles/moonshotai.py,sha256=LL5RacKHKn6rdvhoKjpGgZ8aVriv5NMeL6HCWEANAiU,223
63
63
  pydantic_ai/profiles/openai.py,sha256=80ffJK9T7YbBRR7mhyRkjDB29pYi2H4dIQOAmIr5Ppc,7530
64
- pydantic_ai/profiles/qwen.py,sha256=u7pL8uomoQTVl45g5wDrHx0P_oFDLaN6ALswuwmkWc0,334
64
+ pydantic_ai/profiles/qwen.py,sha256=zU19r2lVBxU0v0fXyA9G-VvG3XzBZMZJVxCpQutU9k0,309
65
65
  pydantic_ai/providers/__init__.py,sha256=yxPgiTJKFYZbDW18tmVM6mmD2Znol3WwniwnhtlN0Ak,4141
66
66
  pydantic_ai/providers/anthropic.py,sha256=D35UXxCPXv8yIbD0fj9Zg2FvNyoMoJMeDUtVM8Sn78I,3046
67
67
  pydantic_ai/providers/azure.py,sha256=y77IHGiSQ9Ttx9f4SGMgdpin2Daq6eYyzUdM9ET22RQ,5819
68
- pydantic_ai/providers/bedrock.py,sha256=ycdTXnkj_WNqPMA7DNDPeYia0C37FP0_l0CygSQmWYI,5694
68
+ pydantic_ai/providers/bedrock.py,sha256=8jz77ySKv6CzCktN9YbZb1736gZM0d_btcKvXiZSSHI,5784
69
69
  pydantic_ai/providers/cohere.py,sha256=LT6QaLPJBBlFUgYgXQOfKpbM9SXLzorWFxI7jNfOX_4,2892
70
70
  pydantic_ai/providers/deepseek.py,sha256=kUdM8eVp1lse4bS_uy70Gy7wgog94NTZ36GY-vhSB50,3060
71
71
  pydantic_ai/providers/fireworks.py,sha256=TPbqOpNgXG59qovBaHWbbV2vsvROwlHwQ3PvqHUBH-s,3626
@@ -93,8 +93,8 @@ pydantic_ai/toolsets/prefixed.py,sha256=MIStkzUdiU0rk2Y6P19IrTBxspH5pTstGxsqCBt-
93
93
  pydantic_ai/toolsets/prepared.py,sha256=Zjfz6S8In6PBVxoKFN9sKPN984zO6t0awB7Lnq5KODw,1431
94
94
  pydantic_ai/toolsets/renamed.py,sha256=JuLHpi-hYPiSPlaTpN8WiXLiGsywYK0axi2lW2Qs75k,1637
95
95
  pydantic_ai/toolsets/wrapper.py,sha256=WjLoiM1WDuffSJ4mDS6pZrEZGHgZ421fjrqFcB66W94,1205
96
- pydantic_ai_slim-0.6.0.dist-info/METADATA,sha256=81Lw6t1HUv6eaklhJfPDILdK5semxPBQ0h34FgqEFJY,4173
97
- pydantic_ai_slim-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
98
- pydantic_ai_slim-0.6.0.dist-info/entry_points.txt,sha256=kbKxe2VtDCYS06hsI7P3uZGxcVC08-FPt1rxeiMpIps,50
99
- pydantic_ai_slim-0.6.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
100
- pydantic_ai_slim-0.6.0.dist-info/RECORD,,
96
+ pydantic_ai_slim-0.6.1.dist-info/METADATA,sha256=5Y2UZkxTg01RSfy5t9C8xSaHnmcT8M7vcFFA4zCVRR4,4172
97
+ pydantic_ai_slim-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
98
+ pydantic_ai_slim-0.6.1.dist-info/entry_points.txt,sha256=kbKxe2VtDCYS06hsI7P3uZGxcVC08-FPt1rxeiMpIps,50
99
+ pydantic_ai_slim-0.6.1.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
100
+ pydantic_ai_slim-0.6.1.dist-info/RECORD,,