Skip to content

Commit

Permalink
Tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xusenlin committed Nov 7, 2023
1 parent eec8154 commit cf3f92e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions api/generation/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion examples/qwen-7b-chat/get_weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit cf3f92e

Please sign in to comment.