in src/scripts/gen_completions.py [0:0]
def try_prompt(dataset, engine, indices, shots_num, dataset_name, entity_name):
json_output = {}
output_filename = f"./data/{dataset_name}/{entity_name}/grouped_completions.json" if entity_name \
else f"./data/{dataset_name}/function_completions.json"
for i in indices:
json_output[i] = []
cur_prompt = prompts["prompt"][f"determine_{entity_name}"].format(prompts["group"][entity_name], dataset[i]) \
if entity_name else dataset[i]
for j in range(shots_num):
response = None
while not response and len(dataset[i]) > 0:
response = try_request(engine, cur_prompt, entity_name is None)
json_output[i].append(response if response else [])
update_json_file(output_filename, json_output)