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

Function build_request_payload

tests/ce/server/core/utils.py:13–26  ·  view source on GitHub ↗

基于模板构造请求 payload,按优先级依次合并: template < payload 参数 < case_data,后者会覆盖前者的同名字段。 :param template_name: 模板变量名,例如 "TOKEN_LOGPROB" :return: 构造后的完整请求 payload dict

(template_name: str, case_data: dict)

Source from the content-addressed store, hash-verified

11
12
13def build_request_payload(template_name: str, case_data: dict) -> dict:
14 """
15 基于模板构造请求 payload,按优先级依次合并:
16 template < payload 参数 < case_data,后者会覆盖前者的同名字段。
17
18 :param template_name: 模板变量名,例如 "TOKEN_LOGPROB"
19 :return: 构造后的完整请求 payload dict
20 """
21 template = TEMPLATES[template_name]
22 print(template)
23 final_payload = template.copy()
24 final_payload.update(case_data)
25
26 return final_payload
27
28
29def send_request(url, payload, timeout=60, stream=False):

Callers 15

test_null_metadataFunction · 0.90
test_top_p_exceed_1Function · 0.90
test_stop_seq_exceed_numFunction · 0.90
test_multilingual_inputFunction · 0.90
test_too_long_inputFunction · 0.90
test_empty_inputFunction · 0.90
test_prompt_only_spacesFunction · 0.90

Calls 3

printFunction · 0.85
copyMethod · 0.45
updateMethod · 0.45

Tested by 15

test_null_metadataFunction · 0.72
test_top_p_exceed_1Function · 0.72
test_stop_seq_exceed_numFunction · 0.72
test_multilingual_inputFunction · 0.72
test_too_long_inputFunction · 0.72
test_empty_inputFunction · 0.72
test_prompt_only_spacesFunction · 0.72