Skip to content

Commit e24929e

Browse files
authored
Ce add bad cases (#3215)
* add repitation early stop cases * add repitation early stop cases * add bad cases * add bad cases
1 parent b01cfd6 commit e24929e

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

test/ce/server/test_DDoS.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# @author DDDivano
4+
# encoding=utf-8 vi:ts=4:sw=4:expandtab:ft=python
5+
6+
"""
7+
分布式拒绝服务
8+
"""

test/ce/server/test_base_chat.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def test_stop_sequence():
104104

105105

106106
def test_stop_sequence1():
107+
"""
108+
不加stop看看是否有影响
109+
"""
107110
data = {
108111
"stream": False,
109112
"messages": [
@@ -122,6 +125,53 @@ def test_stop_sequence1():
122125
assert "第二段" in content
123126

124127

128+
def test_stop_sequence2():
129+
"""
130+
stop token长度测试
131+
"""
132+
data = {
133+
"stream": False,
134+
"stop": ["这是第二段啦啦"],
135+
"messages": [
136+
{
137+
"role": "user",
138+
"content": "你要严格按照我接下来的话输出,输出冒号后面的内容,请输出:这是第一段。果冻这是第二段啦啦啦啦啦。",
139+
},
140+
],
141+
"max_tokens": 50,
142+
"top_p": 0,
143+
}
144+
payload = build_request_payload(TEMPLATE, data)
145+
resp = send_request(URL, payload).json()
146+
content = resp["choices"][0]["message"]["content"]
147+
# token_list = get_token_list(resp)
148+
print("截断输出:", content)
149+
assert "啦啦啦" not in content
150+
151+
152+
# def test_stop_sequence3():
153+
# """
154+
# stop token 数量测试
155+
# """
156+
# data = {
157+
# "stream": False,
158+
# "stop": ["。", "果冻", "果", "冻", "第二", "二"],
159+
# "messages": [
160+
# {
161+
# "role": "user",
162+
# "content": "你要严格按照我接下来的话输出,输出冒号后面的内容,请输出:这是第一段。果冻这是第二段啦啦啦啦啦。",
163+
# },
164+
# ],
165+
# "max_tokens": 50,
166+
# "top_p": 0,
167+
# }
168+
# payload = build_request_payload(TEMPLATE, data)
169+
# resp = send_request(URL, payload).json()
170+
# content = resp["choices"][0]["message"]["content"]
171+
# print("截断输出:", content)
172+
# assert "啦啦啦" not in content
173+
174+
125175
def test_sampling_parameters():
126176
data = {
127177
"stream": False,

test/ce/server/test_evil_cases.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# @author DDDivano
4+
# encoding=utf-8 vi:ts=4:sw=4:expandtab:ft=python
5+
"""
6+
边缘检测 ,攻击性测试
7+
"""

0 commit comments

Comments
 (0)