Skip to content

Commit f702a67

Browse files
authored
fix TestOpenAIServingCompletion fail (#3368)
1 parent d1a92e3 commit f702a67

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/entrypoints/openai/test_serving_completion.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def test_calc_finish_reason_tool_calls(self):
1717
engine_client.reasoning_parser = "ernie_x1"
1818
# 创建一个OpenAIServingCompletion实例
1919
serving_completion = OpenAIServingCompletion(engine_client, "pid", "ips", 360)
20-
# 创建一个模拟的output,并设置finish_reason为"tool_calls"
21-
output = {"finish_reason": "tool_calls"}
20+
# 创建一个模拟的output,并设置finish_reason为"tool_call"
21+
output = {"tool_call": "tool_call"}
2222
# 调用calc_finish_reason方法
23-
result = serving_completion.calc_finish_reason(None, 100, output)
23+
result = serving_completion.calc_finish_reason(None, 100, output, False)
2424
# 断言结果为"tool_calls"
2525
assert result == "tool_calls"
2626

@@ -33,7 +33,7 @@ def test_calc_finish_reason_stop(self):
3333
# 创建一个模拟的output,并设置finish_reason为其他值
3434
output = {"finish_reason": "other_reason"}
3535
# 调用calc_finish_reason方法
36-
result = serving_completion.calc_finish_reason(None, 100, output)
36+
result = serving_completion.calc_finish_reason(None, 100, output, False)
3737
# 断言结果为"stop"
3838
assert result == "stop"
3939

@@ -45,7 +45,7 @@ def test_calc_finish_reason_length(self):
4545
# 创建一个模拟的output
4646
output = {}
4747
# 调用calc_finish_reason方法
48-
result = serving_completion.calc_finish_reason(100, 100, output)
48+
result = serving_completion.calc_finish_reason(100, 100, output, False)
4949
# 断言结果为"length"
5050
assert result == "length"
5151

@@ -95,6 +95,7 @@ def test_request_output_to_completion_response(self):
9595
model_name=model_name,
9696
prompt_batched_token_ids=prompt_batched_token_ids,
9797
completion_batched_token_ids=completion_batched_token_ids,
98+
text_after_process_list=["1", "1"],
9899
)
99100

100101
assert completion_response.id == request_id

0 commit comments

Comments
 (0)