|
31 | 31 | ToolParams = ParamSpec('ToolParams', default=...)
|
32 | 32 | """Retrieval function param spec."""
|
33 | 33 |
|
34 |
| -SystemPromptFunc = Union[ |
| 34 | +SystemPromptFunc: TypeAlias = Union[ |
35 | 35 | Callable[[RunContext[AgentDepsT]], str],
|
36 | 36 | Callable[[RunContext[AgentDepsT]], Awaitable[str]],
|
37 | 37 | Callable[[], str],
|
|
42 | 42 | Usage `SystemPromptFunc[AgentDepsT]`.
|
43 | 43 | """
|
44 | 44 |
|
45 |
| -ToolFuncContext = Callable[Concatenate[RunContext[AgentDepsT], ToolParams], Any] |
| 45 | +ToolFuncContext: TypeAlias = Callable[Concatenate[RunContext[AgentDepsT], ToolParams], Any] |
46 | 46 | """A tool function that takes `RunContext` as the first argument.
|
47 | 47 |
|
48 | 48 | Usage `ToolContextFunc[AgentDepsT, ToolParams]`.
|
49 | 49 | """
|
50 |
| -ToolFuncPlain = Callable[ToolParams, Any] |
| 50 | +ToolFuncPlain: TypeAlias = Callable[ToolParams, Any] |
51 | 51 | """A tool function that does not take `RunContext` as the first argument.
|
52 | 52 |
|
53 | 53 | Usage `ToolPlainFunc[ToolParams]`.
|
54 | 54 | """
|
55 |
| -ToolFuncEither = Union[ToolFuncContext[AgentDepsT, ToolParams], ToolFuncPlain[ToolParams]] |
| 55 | +ToolFuncEither: TypeAlias = Union[ToolFuncContext[AgentDepsT, ToolParams], ToolFuncPlain[ToolParams]] |
56 | 56 | """Either kind of tool function.
|
57 | 57 |
|
58 | 58 | This is just a union of [`ToolFuncContext`][pydantic_ai.tools.ToolFuncContext] and
|
59 | 59 | [`ToolFuncPlain`][pydantic_ai.tools.ToolFuncPlain].
|
60 | 60 |
|
61 | 61 | Usage `ToolFuncEither[AgentDepsT, ToolParams]`.
|
62 | 62 | """
|
63 |
| -ToolPrepareFunc: TypeAlias = 'Callable[[RunContext[AgentDepsT], ToolDefinition], Awaitable[ToolDefinition | None]]' |
| 63 | +ToolPrepareFunc: TypeAlias = Callable[[RunContext[AgentDepsT], 'ToolDefinition'], Awaitable['ToolDefinition | None']] |
64 | 64 | """Definition of a function that can prepare a tool definition at call time.
|
65 | 65 |
|
66 | 66 | See [tool docs](../tools.md#tool-prepare) for more information.
|
@@ -88,9 +88,9 @@ def hitchhiker(ctx: RunContext[int], answer: str) -> str:
|
88 | 88 | Usage `ToolPrepareFunc[AgentDepsT]`.
|
89 | 89 | """
|
90 | 90 |
|
91 |
| -ToolsPrepareFunc: TypeAlias = ( |
92 |
| - 'Callable[[RunContext[AgentDepsT], list[ToolDefinition]], Awaitable[list[ToolDefinition] | None]]' |
93 |
| -) |
| 91 | +ToolsPrepareFunc: TypeAlias = Callable[ |
| 92 | + [RunContext[AgentDepsT], list['ToolDefinition']], Awaitable['list[ToolDefinition] | None'] |
| 93 | +] |
94 | 94 | """Definition of a function that can prepare the tool definition of all tools for each step.
|
95 | 95 | This is useful if you want to customize the definition of multiple tools or you want to register
|
96 | 96 | a subset of tools for a given step.
|
@@ -118,7 +118,7 @@ async def turn_on_strict_if_openai(
|
118 | 118 | Usage `ToolsPrepareFunc[AgentDepsT]`.
|
119 | 119 | """
|
120 | 120 |
|
121 |
| -DocstringFormat = Literal['google', 'numpy', 'sphinx', 'auto'] |
| 121 | +DocstringFormat: TypeAlias = Literal['google', 'numpy', 'sphinx', 'auto'] |
122 | 122 | """Supported docstring formats.
|
123 | 123 |
|
124 | 124 | * `'google'` — [Google-style](https://google.github.io/styleguide/pyguide.html#381-docstrings) docstrings.
|
|
0 commit comments