Skip to content

Commit 9dcc0fa

Browse files
committed
chore: refine usage limit comments
- Updated docstrings in `RunContext`, `RunUsage`, and `UsageLimits` to specify that only successful tool calls are counted and to clarify the meaning of usage limits.
1 parent 0f8ba07 commit 9dcc0fa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pydantic_ai_slim/pydantic_ai/_run_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ class RunContext(Generic[AgentDepsT]):
5050
tool_call_approved: bool = False
5151
"""Whether a tool call that required approval has now been approved."""
5252
usage_limits: UsageLimits | None = None
53-
"""Usage limits for this run, if any."""
53+
"""Usage limits for the run."""
5454

5555
__repr__ = _utils.dataclasses_no_defaults_repr

pydantic_ai_slim/pydantic_ai/usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class RunUsage(UsageBase):
118118
"""Number of requests made to the LLM API."""
119119

120120
tool_calls: int = 0
121-
"""Number of tool calls executed during the run."""
121+
"""Number of successful tool calls executed during the run."""
122122

123123
input_tokens: int = 0
124124
"""Total number of text input/prompt tokens."""
@@ -197,7 +197,7 @@ class UsageLimits:
197197
request_limit: int | None = 50
198198
"""The maximum number of requests allowed to the model."""
199199
tool_calls_limit: int | None = None
200-
"""The maximum number of tool calls allowed to be executed."""
200+
"""The maximum number of successful tool calls allowed to be executed."""
201201
input_tokens_limit: int | None = None
202202
"""The maximum number of input/prompt tokens allowed."""
203203
output_tokens_limit: int | None = None

0 commit comments

Comments
 (0)