MediaBrain-SJTU / MING

明医 (MING):中文医疗问诊大模型
Apache License 2.0
851 stars 108 forks source link

bookQA数据 #5

Open DSXiangLi opened 1 year ago

DSXiangLi commented 1 year ago

您好,我看BookQA数据的生成代码中,只有Question的部分是依赖医学Context生成。Answer的部分似乎是让ChatGPT直接回答的?而不是基于医学上文来进行回答? 代码如下

prompt = f"指南:\n{input_book}\n"
prompt += f"请根据上述文本中与医学知识相关的内容与逻辑关系提出几个中文问题。注意,提出的问题应该提供充实的内容,使问题具有挑战性。\n"

message = [{"role": "assistant", "content": prompt}]
completion = openai.ChatCompletion.create(
    model= "gpt-3.5-turbo",
    messages= message,
    temperature= 1.0,
    top_p= 1.0,
    frequency_penalty= 0.0,
    presence_penalty= 0.0
)

response = completion.choices[0].message["content"]
questions = parse_response(response)

qa_pairs=[]
for question in questions:
    message = [{"role": "assistant", "content": question}]
    completion = openai.ChatCompletion.create(
        model= "gpt-3.5-turbo",
        messages= message,
        temperature= 1.0,
        top_p= 1.0,
        frequency_penalty= 0.0,
        presence_penalty= 0.0
    )
    answer = completion.choices[0].message["content"]
    qa_pairs.append({'question':question,'answer':answer})