We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 420203b commit 3b4f596Copy full SHA for 3b4f596
ldp/alg/optimizer/ape.py
@@ -194,7 +194,11 @@ def aggregate_trajectory(self, trajectory: Trajectory) -> None:
194
continue
195
# (x: first prompt's user message's content, y: AI response's content)
196
x = next(
197
- cast(str, m.content) for m in result.prompt if m.role == "user"
+ # m is a Message with a result of the LLM. Which completes only strings.
198
+ # and we checked the result exists above.
199
+ cast(str, m.content)
200
+ for m in result.prompt
201
+ if (isinstance(m, Message) and m.role == "user")
202
)
203
y = cast(str, result.messages[0].content)
204
0 commit comments