Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pydantic_ai_slim/pydantic_ai/_agent_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ async def run(
) -> Union[ModelRequestNode[DepsT, NodeRunEndT], End[result.FinalResult[NodeRunEndT]]]: # noqa UP007
async with self.stream(ctx):
pass

assert (next_node := self._next_node) is not None, 'the stream should set `self._next_node` before it ends'
return next_node
assert self._next_node is not None, 'the stream should set `self._next_node` before it ends'
return self._next_node

@asynccontextmanager
async def stream(
Expand Down
4 changes: 2 additions & 2 deletions pydantic_ai_slim/pydantic_ai/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ async def main():
async for _ in agent_run:
pass

assert (final_result := agent_run.result) is not None, 'The graph run did not finish properly'
return final_result
assert agent_run.result is not None, 'The graph run did not finish properly'
return agent_run.result

@asynccontextmanager
async def iter(
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ include = [
]

[tool.ruff.lint]
extend-select = ["Q", "RUF100", "C90", "UP", "I", "D", "TID251"]
extend-select = [
"Q",
"RUF100",
"RUF018", # https://docs.astral.sh/ruff/rules/assignment-in-assert/
"C90",
"UP",
"I",
"D",
"TID251",
]
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
isort = { combine-as-imports = true, known-first-party = ["pydantic_ai"] }
mccabe = { max-complexity = 15 }
Expand Down