Skip to content

Commit

Permalink
fix: 解决role参数错误
Browse files Browse the repository at this point in the history
  • Loading branch information
gaozixiang committed Nov 11, 2024
1 parent e25b072 commit 101a7f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lmdeploy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def messages2prompt(self, messages, sequence_start=True,
ret += f'\n<tool_call>\n{{"name": "{toolCall["name"]}, "arguments": {json.dumps(tools["arguments"])}"\n</toolcall>}}'
if message['role'] == 'tool':
if index == 0 or messages[index - 1]['role'] != 'tool':
ret += f"{box_map[message['role']]}"
ret += f"{self.user}"
ret += f"\n<tool_response>\n{message['content']}\n</tool_response>"
if index == len(messages) - 1 or messages[index + 1]['role'] != 'tool':
ret += f"{self.eoh}"
Expand Down

0 comments on commit 101a7f8

Please sign in to comment.