()
| 75 | |
| 76 | |
| 77 | def 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 | |
| 100 | def test_stop_sequence1(): |
nothing calls this directly
no test coverage detected