Skip to content

Commit

Permalink
fix(pipeline): unintended mutation in tool call IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Oct 3, 2024
1 parent 2904d0d commit 50f0525
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion kani/engines/huggingface/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def build_prompt(
raise NotImplementedError(
"You must pass a prompt_pipeline to the HuggingEngine to use it as a non-abstract class."
)
log.debug(messages) # todo temp
prompt = self.pipeline(messages, functions)
log.debug(f"BUILT PROMPT: {prompt}")
return prompt
Expand Down
4 changes: 2 additions & 2 deletions kani/prompts/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ def execute(self, msgs: list[PipelineMsgT], functions: list[AIFunction]) -> list
# translate the id(s) if needed
if self.id_translator is not None:
if m.tool_calls is not None:
for tc in m.tool_calls:
tc.id = self.id_translator(tc.id)
# copy the tool calls here to prevent unintended mutation
m.tool_calls = [tc.copy_with(id=self.id_translator(tc.id)) for tc in m.tool_calls]
if m.tool_call_id is not None:
m.tool_call_id = self.id_translator(m.tool_call_id)

Expand Down

0 comments on commit 50f0525

Please sign in to comment.