import json
import pandas as pd

result = []
# with open("/root/paddlejob/workspace/env_run/huitingfeng/evaluation/data/humaneval/human-eval-v2-20210705.jsonl", "r") as f:
# with open("/root/paddlejob/workspace/env_run/huitingfeng/evaluation/data/gsm8k/test.jsonl", "r") as f:
with open("/root/paddlejob/workspace/env_run/huitingfeng/evaluation/data/nq/nq-test.qa.csv", "r") as f:
    lines = f.readlines()
    for ln in lines:
        ln = ln.split("\t")
        prompt = ln[0]
        response = eval(ln[1])[0]
    # lines = f.readlines()
    # for ln in lines:
    #     data = json.loads(ln)
        # For HumanEval
        # prompt = data["prompt"]
        # response = data["canonical_solution"]
        # For GSM8K
        # prompt = data["question"]
        # response = data["answer"]
        
        result.append({"corpus": "",
                 "dataset": "humaneval",
                 "instruction": "",
                 "conversation": [{"input": prompt, "output": response}]})

with open("data/router.json", "w") as f:
    json.dump(result, f, indent=4, ensure_ascii=False)
