From 0f057391e62cc52a4100aa61a8d054418a4f48f0 Mon Sep 17 00:00:00 2001 From: gaozixiang Date: Thu, 14 Nov 2024 10:52:58 +0800 Subject: [PATCH] fix: Add '\n' between each tool --- lmdeploy/model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lmdeploy/model.py b/lmdeploy/model.py index 57466fd79c..83023d378f 100644 --- a/lmdeploy/model.py +++ b/lmdeploy/model.py @@ -950,7 +950,7 @@ def __init__( assistant='<|im_start|>assistant\n', eoa='<|im_end|>', separator='\n', - tools="""\n#Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n\n""", + tools="""\n#Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n""", eotools="""\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{"name": , "arguments": }\n""", stop_words=['<|im_end|>'], **kwargs): @@ -990,6 +990,7 @@ def messages2prompt(self, tool_prompt = '' if tools is not None: for tool in tools: + tool_prompt += '\n' tool_prompt += json.dumps(tool, ensure_ascii=False) if len(messages) and messages[0]['role'] == 'system': ret += f"{self.system}{messages[0]['content']}{self.tools}{tool_prompt}{self.eotools}{self.eosys}"