Skip to content

Commit

Permalink
Address some minor feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dmontagu committed Feb 6, 2025
1 parent bc681bc commit 17409cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pydantic_ai_slim/pydantic_ai/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ def _set_result_tool_return(self, return_content: str) -> list[_messages.ModelMe
raise LookupError(f'No tool call found with tool name {self.result.tool_name!r}.')

@property
def is_ended(self):
def is_ended(self) -> bool:
return self.graph_run.is_ended

@property
Expand Down
7 changes: 6 additions & 1 deletion pydantic_graph/pydantic_graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def __init__(
self._result: End[RunEndT] | None = None

@property
def is_ended(self):
def is_ended(self) -> bool:
return self._result is not None

@property
Expand All @@ -557,6 +557,11 @@ async def next(
self: GraphRun[StateT, DepsT, T], node: BaseNode[StateT, DepsT, T]
) -> BaseNode[StateT, DepsT, T] | End[T]:
"""Note: this method behaves very similarly to an async generator's `asend` method."""
if not self._started:
raise exceptions.GraphRuntimeError(
'You must enter the GraphRun as a contextmanager before you can call `next` on it.'
)

history = self.history
state = self.state
deps = self.deps
Expand Down

0 comments on commit 17409cc

Please sign in to comment.