MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / test_stop_sequence

Function test_stop_sequence

tests/ce/server/test_base_chat.py:77–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76
77def test_stop_sequence():
78 data = {
79 "stream": False,
80 "stop": ["。"],
81 "messages": [
82 {
83 "role": "user",
84 "content": "你要严格按照我接下来的话输出,输出冒号后面的内容,请输出:这是第一段。果冻这是第二段啦啦啦啦啦。",
85 },
86 ],
87 "max_tokens": 20,
88 "top_p": 0,
89 }
90 payload = build_request_payload(TEMPLATE, data)
91 resp = send_request(URL, payload).json()
92 content = resp["choices"][0]["message"]["content"]
93 token_list = get_token_list(resp)
94 print("截断输出:", content)
95 assert "第二段" not in content
96 assert "第二段" not in token_list
97 assert "。" in token_list, "没有找到。符号"
98
99
100def test_stop_sequence1():

Callers

nothing calls this directly

Calls 4

build_request_payloadFunction · 0.90
send_requestFunction · 0.90
get_token_listFunction · 0.90
printFunction · 0.85

Tested by

no test coverage detected