Skip to content

Commit

Permalink
Added explanatory comment
Browse files Browse the repository at this point in the history
  • Loading branch information
maykcaldas committed Dec 18, 2024
1 parent 31419c8 commit 727ea83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ldp/alg/optimizer/ape.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ def aggregate_trajectory(self, trajectory: Trajectory) -> None:
if result is None or not result.messages or not result.prompt:
continue
# (x: first prompt's user message's content, y: AI response's content)
# m is a Message with a result of the LLM. Which completes only strings.
# and we checked the result exists above.
x = next(
cast(str, m.content)
cast(str, m.content)
for m in result.prompt
if (isinstance(m, Message) and m.role == "user")
)
Expand Down

0 comments on commit 727ea83

Please sign in to comment.