Skip to content

Commit c0165b0

Browse files
committed
refactor: remove unused variable and simplify message processing in _agent_graph.py
- Removed the unused `parts` variable in `UserPromptNode`. - Simplified message processing logic in `_process_message_history` by directly using the processor without casting for async processing.
1 parent a235ee7 commit c0165b0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pydantic_ai_slim/pydantic_ai/_agent_graph.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ async def run( # noqa: C901
229229
# Build the run context after `ctx.deps.prompt` has been updated
230230
run_context = build_run_context(ctx)
231231

232-
parts: list[_messages.ModelRequestPart] = []
233232
if messages:
234233
await self._reevaluate_dynamic_prompts(messages, run_context)
235234

@@ -1152,8 +1151,7 @@ async def _process_message_history(
11521151
if takes_ctx:
11531152
messages = await processor(run_context, messages)
11541153
else:
1155-
async_processor = cast(_HistoryProcessorAsync, processor)
1156-
messages = await async_processor(messages)
1154+
messages = await processor(messages)
11571155
else:
11581156
if takes_ctx:
11591157
sync_processor_with_ctx = cast(_HistoryProcessorSyncWithCtx[DepsT], processor)

0 commit comments

Comments
 (0)