From cf3f92ea980ac53fcc730658591d7f277ba69185 Mon Sep 17 00:00:00 2001 From: xusenlin Date: Tue, 7 Nov 2023 20:37:44 +0800 Subject: [PATCH] Tiny fix --- api/generation/qwen.py | 3 +-- examples/qwen-7b-chat/get_weather.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/generation/qwen.py b/api/generation/qwen.py index d8eee27..1d0d21c 100644 --- a/api/generation/qwen.py +++ b/api/generation/qwen.py @@ -181,7 +181,6 @@ def process_qwen_messages(messages: List[ChatMessage], functions: Union[dict, Li content = f"Thought: 我可以使用 {f_name} API。" else: content = f"Thought: I can use {f_name}." - content = f"\n{content}\nAction: {f_name}\nAction Input: {f_args}" if messages[-1].role == Role.USER: messages.append( @@ -247,7 +246,7 @@ def parse_response(response): if func_name: function_call = {"name": func_name, "arguments": func_args} - return response[:i], function_call + return response[:k], function_call z = response.rfind("\nFinal Answer: ") if z >= 0: diff --git a/examples/qwen-7b-chat/get_weather.py b/examples/qwen-7b-chat/get_weather.py index 2ba787d..4403ae2 100644 --- a/examples/qwen-7b-chat/get_weather.py +++ b/examples/qwen-7b-chat/get_weather.py @@ -107,7 +107,8 @@ def run_conversation(query: str, stream=False, functions=None, max_retry=5): params["messages"].append( { "role": "assistant", - "content": output + "content": output, + "function_call": function_call, } ) params["messages"].append(