MCPcopy Create free account
hub / github.com/FreedomIntelligence/CMB / wrap

Method wrap

workers/base.py:293–310  ·  view source on GitHub ↗

data.keys(): ['id', 'exam_type', 'exam_class', 'question_type', 'question', 'option']. These are the raw data. We still need 'option_str'.

(self, data: list[dict])

Source from the content-addressed store, hash-verified

291 return "以下是中国{exam_type}中{exam_class}考试的一道{question_type},不需要做任何分析和解释,直接输出答案选项。\n{question}\n{option_str}"
292
293 def wrap(self, data: list[dict]):
294 '''
295 data.keys(): ['id', 'exam_type', 'exam_class', 'question_type', 'question', 'option']. These are the raw data.
296 We still need 'option_str'.
297 '''
298 res = []
299 lines = []
300 for line in data:
301 line["option_str"] = "\n".join(
302 [f"{k}. {v}" for k, v in line["option"].items() if len(v) > 1]
303 )
304 query = self.input_template.format_map(line)
305 line['query'] = query
306
307 res.append(query)
308 lines.append(line)
309
310 return res, lines
311
312 def wrap_conv(self, data: list[dict]): # add
313 lines = []

Callers 1

generate_batchMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected