Skip to content

Commit

Permalink
Update pydantic_ai_slim/pydantic_ai/agent.py
Browse files Browse the repository at this point in the history
Co-authored-by: Samuel Colvin <[email protected]>
  • Loading branch information
josead and samuelcolvin authored Jan 2, 2025
1 parent 260a610 commit 2a73e13
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pydantic_ai_slim/pydantic_ai/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,7 @@ async def _reevaluate_dynamic_prompts(
for i, part in enumerate(msg.parts):
if isinstance(part, _messages.DynamicSystemPromptPart):
# Look up the runner by its ID (default 0 in case part.ref is None).
matching_runner = runner_map.get(part.ref or 0)
if matching_runner is not None:
if runner := runner_map.get(part.ref):
updated_part_content = await matching_runner.run(run_context)
msg.parts[i] = _messages.DynamicSystemPromptPart(updated_part_content, ref=part.ref)

Expand Down

0 comments on commit 2a73e13

Please sign in to comment.