MCPcopy Create free account
hub / github.com/codefuse-ai/codefuse-devops-eval / gen_answer

Method gen_answer

src/getAssistantAns.py:20–41  ·  view source on GitHub ↗
(self, chat_dict, gpu_index)

Source from the content-addressed store, hash-verified

18
19
20 def gen_answer(self, chat_dict, gpu_index):
21 # 这里实际根据自己推理逻辑 然后转为标准格式返回
22 # 以下仅仅是样例
23 import time
24 print(os.environ["CUDA_VISIBLE_DEVICES"])
25 time.sleep(1)
26 rtn_dict1 = {
27 "role": "assistant",
28 "content": None,
29 "function_call":
30 {
31 "name": "get_fudan_university_scoreline",
32 "arguments": "{\n \"year\": \"2020\"\n}"
33 }
34 }
35
36 rtn_dict2 = {
37 "role": "assistant",
38 "content": "2020年复旦大学的分数线如下:\n\n- 文科一批:630分\n- 文科二批:610分\n- 理科一批:650分\n- 理科二批:630分"
39 }
40
41 return random.choice([rtn_dict1, rtn_dict2])
42
43# ======================================================================
44# 下面注释的部分是一个huggingface推理的多卡的demo

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected