MCPcopy
hub / github.com/Tele-AI/Telechat / check_ex

Function check_ex

service/telechat_service.py:48–67  ·  view source on GitHub ↗
(do_sample, max_length, top_k, top_p, temperature, repetition_penalty)

Source from the content-addressed store, hash-verified

46
47
48def check_ex(do_sample, max_length, top_k, top_p, temperature, repetition_penalty):
49 flag = True
50 try:
51 if do_sample != None and (do_sample not in [True, False] or not isinstance(do_sample, bool)):
52 flag = False
53 if max_length != None and (not 0 < max_length <= 4096 or not isinstance(max_length, int)):
54 flag = False
55 if top_k != None and (not 0 < top_k < 100 or not isinstance(top_k, int)):
56 flag = False
57 if top_p != None and (not 0.0 < top_p < 1.0 or not isinstance(top_p, float)):
58 flag = False
59 if temperature != None and (not 0.0 < temperature < 1.0 or not isinstance(temperature, float)):
60 flag = False
61 if repetition_penalty != None and (
62 not 1.0 < repetition_penalty < 100.0 or not isinstance(repetition_penalty, float)):
63 flag = False
64 return flag
65 except Exception:
66 flag = False
67 return flag
68
69
70def streamresponse_v2(tokenizer, query, history, do_sample, max_length, top_k, top_p, temperature, repetition_penalty):

Callers 2

doc_gptDialog_v2Function · 0.85
doc_gptDialog_v3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected