pydantic-ai-slim 0.3.7__tar.gz → 0.4.0__tar.gz

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.

Files changed (83) hide show
  1. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/PKG-INFO +4 -4
  2. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_function_schema.py +1 -1
  3. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_griffe.py +2 -2
  4. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_utils.py +4 -1
  5. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/mcp.py +1 -1
  6. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/messages.py +22 -6
  7. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/anthropic.py +1 -1
  8. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/bedrock.py +9 -6
  9. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/gemini.py +1 -1
  10. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/google.py +1 -1
  11. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/groq.py +1 -1
  12. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/mistral.py +3 -1
  13. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/openai.py +1 -1
  14. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/openai.py +9 -1
  15. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/tools.py +5 -5
  16. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/.gitignore +0 -0
  17. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/LICENSE +0 -0
  18. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/README.md +0 -0
  19. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/__init__.py +0 -0
  20. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/__main__.py +0 -0
  21. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_a2a.py +0 -0
  22. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_agent_graph.py +0 -0
  23. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_cli.py +0 -0
  24. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_mcp.py +0 -0
  25. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_output.py +0 -0
  26. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_parts_manager.py +0 -0
  27. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_run_context.py +0 -0
  28. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_system_prompt.py +0 -0
  29. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/_thinking_part.py +0 -0
  30. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/agent.py +0 -0
  31. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/common_tools/__init__.py +0 -0
  32. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/common_tools/duckduckgo.py +0 -0
  33. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/common_tools/tavily.py +0 -0
  34. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/direct.py +0 -0
  35. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/exceptions.py +0 -0
  36. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/ext/__init__.py +0 -0
  37. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/ext/aci.py +0 -0
  38. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/ext/langchain.py +0 -0
  39. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/format_as_xml.py +0 -0
  40. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/format_prompt.py +0 -0
  41. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/__init__.py +0 -0
  42. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/cohere.py +0 -0
  43. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/fallback.py +0 -0
  44. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/function.py +0 -0
  45. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/instrumented.py +0 -0
  46. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/mcp_sampling.py +0 -0
  47. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/test.py +0 -0
  48. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/models/wrapper.py +0 -0
  49. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/output.py +0 -0
  50. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/__init__.py +0 -0
  51. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/_json_schema.py +0 -0
  52. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/amazon.py +0 -0
  53. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/anthropic.py +0 -0
  54. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/cohere.py +0 -0
  55. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/deepseek.py +0 -0
  56. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/google.py +0 -0
  57. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/grok.py +0 -0
  58. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/meta.py +0 -0
  59. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/mistral.py +0 -0
  60. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/profiles/qwen.py +0 -0
  61. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/__init__.py +0 -0
  62. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/anthropic.py +0 -0
  63. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/azure.py +0 -0
  64. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/bedrock.py +0 -0
  65. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/cohere.py +0 -0
  66. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/deepseek.py +0 -0
  67. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/fireworks.py +0 -0
  68. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/github.py +0 -0
  69. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/google.py +0 -0
  70. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/google_gla.py +0 -0
  71. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/google_vertex.py +0 -0
  72. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/grok.py +0 -0
  73. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/groq.py +0 -0
  74. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/heroku.py +0 -0
  75. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/mistral.py +0 -0
  76. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/openai.py +0 -0
  77. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/openrouter.py +0 -0
  78. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/providers/together.py +0 -0
  79. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/py.typed +0 -0
  80. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/result.py +0 -0
  81. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/settings.py +0 -0
  82. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pydantic_ai/usage.py +0 -0
  83. {pydantic_ai_slim-0.3.7 → pydantic_ai_slim-0.4.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai-slim
3
- Version: 0.3.7
3
+ Version: 0.4.0
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>
6
6
  License-Expression: MIT
@@ -30,11 +30,11 @@ 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.3.7
33
+ Requires-Dist: pydantic-graph==0.4.0
34
34
  Requires-Dist: pydantic>=2.10
35
35
  Requires-Dist: typing-inspection>=0.4.0
36
36
  Provides-Extra: a2a
37
- Requires-Dist: fasta2a==0.3.7; extra == 'a2a'
37
+ Requires-Dist: fasta2a==0.4.0; extra == 'a2a'
38
38
  Provides-Extra: anthropic
39
39
  Requires-Dist: anthropic>=0.52.0; extra == 'anthropic'
40
40
  Provides-Extra: bedrock
@@ -48,7 +48,7 @@ Requires-Dist: cohere>=5.13.11; (platform_system != 'Emscripten') and extra == '
48
48
  Provides-Extra: duckduckgo
49
49
  Requires-Dist: duckduckgo-search>=7.0.0; extra == 'duckduckgo'
50
50
  Provides-Extra: evals
51
- Requires-Dist: pydantic-evals==0.3.7; extra == 'evals'
51
+ Requires-Dist: pydantic-evals==0.4.0; extra == 'evals'
52
52
  Provides-Extra: google
53
53
  Requires-Dist: google-genai>=1.24.0; extra == 'google'
54
54
  Provides-Extra: groq
@@ -35,7 +35,7 @@ class FunctionSchema:
35
35
  """Internal information about a function schema."""
36
36
 
37
37
  function: Callable[..., Any]
38
- description: str
38
+ description: str | None
39
39
  validator: SchemaValidator
40
40
  json_schema: ObjectJsonSchema
41
41
  # if not None, the function takes a single by that name (besides potentially `info`)
@@ -19,7 +19,7 @@ def doc_descriptions(
19
19
  sig: Signature,
20
20
  *,
21
21
  docstring_format: DocstringFormat,
22
- ) -> tuple[str, dict[str, str]]:
22
+ ) -> tuple[str | None, dict[str, str]]:
23
23
  """Extract the function description and parameter descriptions from a function's docstring.
24
24
 
25
25
  The function parses the docstring using the specified format (or infers it if 'auto')
@@ -35,7 +35,7 @@ def doc_descriptions(
35
35
  """
36
36
  doc = func.__doc__
37
37
  if doc is None:
38
- return '', {}
38
+ return None, {}
39
39
 
40
40
  # see https://github.com/mkdocstrings/griffe/issues/293
41
41
  parent = cast(GriffeObject, sig)
@@ -315,8 +315,11 @@ def dataclasses_no_defaults_repr(self: Any) -> str:
315
315
  return f'{self.__class__.__qualname__}({", ".join(kv_pairs)})'
316
316
 
317
317
 
318
+ _datetime_ta = TypeAdapter(datetime)
319
+
320
+
318
321
  def number_to_datetime(x: int | float) -> datetime:
319
- return TypeAdapter(datetime).validate_python(x)
322
+ return _datetime_ta.validate_python(x)
320
323
 
321
324
 
322
325
  AwaitableCallable = Callable[..., Awaitable[T]]
@@ -98,7 +98,7 @@ class MCPServer(ABC):
98
98
  return [
99
99
  tools.ToolDefinition(
100
100
  name=self.get_prefixed_tool_name(tool.name),
101
- description=tool.description or '',
101
+ description=tool.description,
102
102
  parameters_json_schema=tool.inputSchema,
103
103
  )
104
104
  for tool in mcp_tools.tools
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
25
25
  from .models.instrumented import InstrumentationSettings
26
26
 
27
27
 
28
- AudioMediaType: TypeAlias = Literal['audio/wav', 'audio/mpeg']
28
+ AudioMediaType: TypeAlias = Literal['audio/wav', 'audio/mpeg', 'audio/ogg', 'audio/flac', 'audio/aiff', 'audio/aac']
29
29
  ImageMediaType: TypeAlias = Literal['image/jpeg', 'image/png', 'image/gif', 'image/webp']
30
30
  DocumentMediaType: TypeAlias = Literal[
31
31
  'application/pdf',
@@ -48,7 +48,7 @@ VideoMediaType: TypeAlias = Literal[
48
48
  'video/3gpp',
49
49
  ]
50
50
 
51
- AudioFormat: TypeAlias = Literal['wav', 'mp3']
51
+ AudioFormat: TypeAlias = Literal['wav', 'mp3', 'oga', 'flac', 'aiff', 'aac']
52
52
  ImageFormat: TypeAlias = Literal['jpeg', 'png', 'gif', 'webp']
53
53
  DocumentFormat: TypeAlias = Literal['csv', 'doc', 'docx', 'html', 'md', 'pdf', 'txt', 'xls', 'xlsx']
54
54
  VideoFormat: TypeAlias = Literal['mkv', 'mov', 'mp4', 'webm', 'flv', 'mpeg', 'mpg', 'wmv', 'three_gp']
@@ -182,13 +182,25 @@ class AudioUrl(FileUrl):
182
182
 
183
183
  @property
184
184
  def media_type(self) -> AudioMediaType:
185
- """Return the media type of the audio file, based on the url."""
185
+ """Return the media type of the audio file, based on the url.
186
+
187
+ References:
188
+ - Gemini: https://ai.google.dev/gemini-api/docs/audio#supported-formats
189
+ """
186
190
  if self.url.endswith('.mp3'):
187
191
  return 'audio/mpeg'
188
- elif self.url.endswith('.wav'):
192
+ if self.url.endswith('.wav'):
189
193
  return 'audio/wav'
190
- else:
191
- raise ValueError(f'Unknown audio file extension: {self.url}')
194
+ if self.url.endswith('.flac'):
195
+ return 'audio/flac'
196
+ if self.url.endswith('.oga'):
197
+ return 'audio/ogg'
198
+ if self.url.endswith('.aiff'):
199
+ return 'audio/aiff'
200
+ if self.url.endswith('.aac'):
201
+ return 'audio/aac'
202
+
203
+ raise ValueError(f'Unknown audio file extension: {self.url}')
192
204
 
193
205
  @property
194
206
  def format(self) -> AudioFormat:
@@ -358,6 +370,10 @@ _document_format_lookup: dict[str, DocumentFormat] = {
358
370
  _audio_format_lookup: dict[str, AudioFormat] = {
359
371
  'audio/mpeg': 'mp3',
360
372
  'audio/wav': 'wav',
373
+ 'audio/flac': 'flac',
374
+ 'audio/ogg': 'oga',
375
+ 'audio/aiff': 'aiff',
376
+ 'audio/aac': 'aac',
361
377
  }
362
378
  _image_format_lookup: dict[str, ImageFormat] = {
363
379
  'image/jpeg': 'jpeg',
@@ -416,7 +416,7 @@ class AnthropicModel(Model):
416
416
  def _map_tool_definition(f: ToolDefinition) -> BetaToolParam:
417
417
  return {
418
418
  'name': f.name,
419
- 'description': f.description,
419
+ 'description': f.description or '',
420
420
  'input_schema': f.parameters_json_schema,
421
421
  }
422
422
 
@@ -62,6 +62,7 @@ if TYPE_CHECKING:
62
62
  SystemContentBlockTypeDef,
63
63
  ToolChoiceTypeDef,
64
64
  ToolConfigurationTypeDef,
65
+ ToolSpecificationTypeDef,
65
66
  ToolTypeDef,
66
67
  VideoBlockTypeDef,
67
68
  )
@@ -228,14 +229,16 @@ class BedrockConverseModel(Model):
228
229
 
229
230
  @staticmethod
230
231
  def _map_tool_definition(f: ToolDefinition) -> ToolTypeDef:
231
- return {
232
- 'toolSpec': {
233
- 'name': f.name,
234
- 'description': f.description,
235
- 'inputSchema': {'json': f.parameters_json_schema},
236
- }
232
+ tool_spec: ToolSpecificationTypeDef = {
233
+ 'name': f.name,
234
+ 'inputSchema': {'json': f.parameters_json_schema},
237
235
  }
238
236
 
237
+ if f.description: # pragma: no branch
238
+ tool_spec['description'] = f.description
239
+
240
+ return {'toolSpec': tool_spec}
241
+
239
242
  @property
240
243
  def base_url(self) -> str:
241
244
  return str(self.client.meta.endpoint_url)
@@ -773,7 +773,7 @@ class _GeminiFunction(TypedDict):
773
773
 
774
774
  def _function_from_abstract_tool(tool: ToolDefinition) -> _GeminiFunction:
775
775
  json_schema = tool.parameters_json_schema
776
- f = _GeminiFunction(name=tool.name, description=tool.description, parameters=json_schema)
776
+ f = _GeminiFunction(name=tool.name, description=tool.description or '', parameters=json_schema)
777
777
  return f
778
778
 
779
779
 
@@ -534,7 +534,7 @@ def _function_declaration_from_tool(tool: ToolDefinition) -> FunctionDeclaration
534
534
  json_schema = tool.parameters_json_schema
535
535
  f = FunctionDeclarationDict(
536
536
  name=tool.name,
537
- description=tool.description,
537
+ description=tool.description or '',
538
538
  parameters=json_schema, # type: ignore
539
539
  )
540
540
  return f
@@ -333,7 +333,7 @@ class GroqModel(Model):
333
333
  'type': 'function',
334
334
  'function': {
335
335
  'name': f.name,
336
- 'description': f.description,
336
+ 'description': f.description or '',
337
337
  'parameters': f.parameters_json_schema,
338
338
  },
339
339
  }
@@ -306,7 +306,9 @@ class MistralModel(Model):
306
306
  )
307
307
  tools = [
308
308
  MistralTool(
309
- function=MistralFunction(name=r.name, parameters=r.parameters_json_schema, description=r.description)
309
+ function=MistralFunction(
310
+ name=r.name, parameters=r.parameters_json_schema, description=r.description or ''
311
+ )
310
312
  )
311
313
  for r in all_tools
312
314
  ]
@@ -469,7 +469,7 @@ class OpenAIModel(Model):
469
469
  'type': 'function',
470
470
  'function': {
471
471
  'name': f.name,
472
- 'description': f.description,
472
+ 'description': f.description or '',
473
473
  'parameters': f.parameters_json_schema,
474
474
  },
475
475
  }
@@ -93,10 +93,18 @@ class OpenAIJsonSchemaTransformer(JsonSchemaTransformer):
93
93
  def transform(self, schema: JsonSchema) -> JsonSchema: # noqa C901
94
94
  # Remove unnecessary keys
95
95
  schema.pop('title', None)
96
- schema.pop('default', None)
97
96
  schema.pop('$schema', None)
98
97
  schema.pop('discriminator', None)
99
98
 
99
+ default = schema.get('default', _sentinel)
100
+ if default is not _sentinel:
101
+ # the "default" keyword is not allowed in strict mode, but including it makes some Ollama models behave
102
+ # better, so we keep it around when not strict
103
+ if self.strict is True:
104
+ schema.pop('default', None)
105
+ elif self.strict is None: # pragma: no branch
106
+ self.is_strict_compatible = False
107
+
100
108
  if schema_ref := schema.get('$ref'):
101
109
  if schema_ref == self.root_ref:
102
110
  schema['$ref'] = '#'
@@ -161,7 +161,7 @@ class Tool(Generic[AgentDepsT]):
161
161
  takes_ctx: bool
162
162
  max_retries: int | None
163
163
  name: str
164
- description: str
164
+ description: str | None
165
165
  prepare: ToolPrepareFunc[AgentDepsT] | None
166
166
  docstring_format: DocstringFormat
167
167
  require_parameter_descriptions: bool
@@ -269,7 +269,7 @@ class Tool(Generic[AgentDepsT]):
269
269
  cls,
270
270
  function: Callable[..., Any],
271
271
  name: str,
272
- description: str,
272
+ description: str | None,
273
273
  json_schema: JsonSchemaValue,
274
274
  ) -> Self:
275
275
  """Creates a Pydantic tool from a function and a JSON schema.
@@ -440,12 +440,12 @@ class ToolDefinition:
440
440
  name: str
441
441
  """The name of the tool."""
442
442
 
443
- description: str
444
- """The description of the tool."""
445
-
446
443
  parameters_json_schema: ObjectJsonSchema
447
444
  """The JSON schema for the tool's parameters."""
448
445
 
446
+ description: str | None = None
447
+ """The description of the tool."""
448
+
449
449
  outer_typed_dict_key: str | None = None
450
450
  """The key in the outer [TypedDict] that wraps an output tool.
451
451