import json
# from tqdm import tqdm
# from Scripts.config_experiment.misc.regenNL_scorer import regen
# from Scripts.Utils import *

# ip = r"Responses\gpt4-turbo\agg_comp_imp_fewshot\all_temp_variation\config-974sample_25n_0.0threshold_0.4temp\updated_dataset\1_mbpp-updated.json"
# with open(ip, "r") as f:
#     json_data = json.load(f)

# # try:
# #     with open(ip.replace('.json', '-regen.json'), "r") as f:
# #         json_data = json.load(f)    
# # except:
# #     pass
# # args = get_args(None)
# # args.info_prompt = "agg_comp_imp_fewshot_examples"

# # for i in tqdm(json_data):
# #     if "info_examples" in i.keys():
# #         continue
# #     tries = 3
# #     while tries:
# #         try:
# #             info, _ = get_info(
# #                 i["text"], args,{"original": i["test_list"]['original']}, 0
# #             )
# #             break
# #         except Exception as e:
# #             print(e)
# #             tries -= 1
# #             if tries == 0:
# #                 print(f"Failed to get info")
# #                 brk
# #     i["info_examples"] = info

# #     with open(ip.replace('.json', '-regen.json'), "w") as f:
# #         json.dump(json_data, f, indent=4)

# prompt_file = r"Scripts\config_experiment\prompts\regenNL.md"

# with open(prompt_file, "r") as f:
#     PROMPT = f.read()

# regen(PROMPT, ip.replace('.json', '-regen.json'), "gpt4-turbo")

# save -regen.json to csv file
import pandas as pd
ip = r"Responses\gpt4-turbo\agg_comp_imp_fewshot\all_temp_variation\config-974sample_25n_0.0threshold_0.4temp\updated_dataset\1_mbpp-updated.json"
with open(ip.replace('.json', '-regen.json'), "r") as f:
    data = json.load(f)
df = pd.DataFrame(data)
df.to_csv(ip.replace('.json', '-regen.csv'), index=False)