Skip to content

Commit 344cc6a

Browse files
authored
Various minor fixes (#834)
1 parent 6c00d1d commit 344cc6a

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

pydantic_ai_slim/pydantic_ai/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ async def main():
282282
result_schema: _result.ResultSchema[RunResultDataT] | None = self._prepare_result_schema(result_type)
283283

284284
# Build the graph
285-
graph = _agent_graph.build_agent_graph(self.name, self._deps_type, result_type or self.result_type)
285+
graph = self._build_graph(result_type)
286286

287287
# Build the initial state
288288
state = _agent_graph.GraphAgentState(

pydantic_graph/pydantic_graph/graph.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,22 @@ async def main():
181181
start=start_node,
182182
)
183183
)
184-
while True:
185-
next_node = await self.next(start_node, history, state=state, deps=deps, infer_name=False)
186-
if isinstance(next_node, End):
187-
history.append(EndStep(result=next_node))
188-
if run_span is not None:
189-
run_span.set_attribute('history', history)
190-
return next_node.data, history
191-
elif isinstance(next_node, BaseNode):
192-
start_node = next_node
193-
else:
194-
if TYPE_CHECKING:
195-
typing_extensions.assert_never(next_node)
196-
else:
197-
raise exceptions.GraphRuntimeError(
198-
f'Invalid node return type: `{type(next_node).__name__}`. Expected `BaseNode` or `End`.'
199-
)
184+
185+
next_node = start_node
186+
while True:
187+
next_node = await self.next(next_node, history, state=state, deps=deps, infer_name=False)
188+
if isinstance(next_node, End):
189+
history.append(EndStep(result=next_node))
190+
if run_span is not None:
191+
run_span.set_attribute('history', history)
192+
return next_node.data, history
193+
elif not isinstance(next_node, BaseNode):
194+
if TYPE_CHECKING:
195+
typing_extensions.assert_never(next_node)
196+
else:
197+
raise exceptions.GraphRuntimeError(
198+
f'Invalid node return type: `{type(next_node).__name__}`. Expected `BaseNode` or `End`.'
199+
)
200200

201201
def run_sync(
202202
self: Graph[StateT, DepsT, T],

0 commit comments

Comments
 (0)