Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bookQA数据 #5

Open
DSXiangLi opened this issue Jun 4, 2023 · 0 comments
Open

bookQA数据 #5

DSXiangLi opened this issue Jun 4, 2023 · 0 comments

Comments

@DSXiangLi
Copy link

您好,我看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})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant