pydantic_ai.dependencies
RunContext
dataclass
Information about the current call.
Source code in pydantic_ai_slim/pydantic_ai/dependencies.py
30 31 32 33 34 35 36 37 38 39 |
|
SystemPromptFunc
module-attribute
SystemPromptFunc = Union[
Callable[[RunContext[AgentDeps]], str],
Callable[[RunContext[AgentDeps]], Awaitable[str]],
Callable[[], str],
Callable[[], Awaitable[str]],
]
A function that may or maybe not take RunContext
as an argument, and may or may not be async.
Usage SystemPromptFunc[AgentDeps]
.
ResultValidatorFunc
module-attribute
ResultValidatorFunc = Union[
Callable[
[RunContext[AgentDeps], ResultData], ResultData
],
Callable[
[RunContext[AgentDeps], ResultData],
Awaitable[ResultData],
],
Callable[[ResultData], ResultData],
Callable[[ResultData], Awaitable[ResultData]],
]
A function that always takes ResultData
and returns ResultData
,
but may or maybe not take CallInfo
as a first argument, and may or may not be async.
Usage ResultValidator[AgentDeps, ResultData]
.
JsonData
module-attribute
JsonData: TypeAlias = (
"None | str | int | float | Sequence[JsonData] | Mapping[str, JsonData]"
)
Type representing any JSON data.
ToolReturnValue
module-attribute
Return value of a tool function.
ToolContextFunc
module-attribute
ToolContextFunc = Callable[
Concatenate[RunContext[AgentDeps], ToolParams],
ToolReturnValue,
]
A tool function that takes RunContext
as the first argument.
Usage ToolContextFunc[AgentDeps, ToolParams]
.
ToolPlainFunc
module-attribute
ToolPlainFunc = Callable[ToolParams, ToolReturnValue]
A tool function that does not take RunContext
as the first argument.
Usage ToolPlainFunc[ToolParams]
.