MCPcopy
hub / github.com/ModelTC/LightLLM / test_stop_parameter

Function test_stop_parameter

test/test_api/test_openai_api.py:594–615  ·  view source on GitHub ↗

测试stop参数

()

Source from the content-addressed store, hash-verified

592
593
594def test_stop_parameter():
595 """测试stop参数"""
596 client = LightLLMClient()
597
598 try:
599 print("=== 测试stop参数 ===")
600
601 # 测试单个stop字符串
602 result = client.completions_with_stop("Count: 1, 2, 3, 4", stop="12", max_tokens=50)
603 print("提示: Count: 1, 2, 3, 4 (stop='12')")
604 print("补全:", repr(result["choices"][0]["text"]))
605 print("完成原因:", result["choices"][0]["finish_reason"])
606 print()
607
608 # 测试多个stop字符串
609 result = client.completions_with_stop("The colors are red, blue, green", stop=["red", "blue"], max_tokens=50)
610 print("提示: The colors are red, blue, green (stop=['red', 'blue'])")
611 print("补全:", repr(result["choices"][0]["text"]))
612 print("完成原因:", result["choices"][0]["finish_reason"])
613 print()
614 except Exception as e:
615 print(f"错误: {e}")
616
617
618def test_multiple_token_arrays():

Callers 1

mainFunction · 0.85

Calls 2

completions_with_stopMethod · 0.95
LightLLMClientClass · 0.85

Tested by

no test coverage detected