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

Function select_items

src/generate_fewshot.py:25–39  ·  view source on GitHub ↗
(exam_type, exam_class, num)

Source from the content-addressed store, hash-verified

23 return output_path
24
25def select_items(exam_type, exam_class, num):
26 # Filter the data based on the given exam_type and exam_class
27 filtered_data = [
28 item
29 for item in data_val
30 if item["exam_type"] == exam_type and item["exam_class"] == exam_class
31 ]
32 # Check if we have enough items
33 if len(filtered_data) < num:
34 raise ValueError(f"Not enough items matching the given criteria: {exam_type}, {exam_class}")
35
36 # Select a random sample of items
37 selected_items = random.sample(filtered_data, num)
38
39 return selected_items
40
41
42def get_query(da, use_cot):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected