跳到主要内容

使用LLMs回答封闭域问题

背景

以下提示测试LLM回答封闭域问题的能力,这涉及回答属于特定主题或领域的问题。

注意

注意,由于任务的挑战性,当LLM对问题没有相关知识时,可能会产生幻觉。

提示

患者情况:
- 20岁女性
- 有厌食症和抑郁症史
- 血压100/50,脉搏50,身高5'5''
- 由营养师推荐,但她否认自己有病
- 报告饮食正常,但体重严重偏低

请将上述数据重新写成医疗记录,仅使用上述信息。

代码 / API

from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
model="gpt-4",
messages=[
{
"role": "user",
"content": "Patient’s facts:\n- 20 year old female\n- with a history of anerxia nervosa and depression\n- blood pressure 100/50, pulse 50, height 5’5’’\n- referred by her nutrionist but is in denial of her illness\n- reports eating fine but is severely underweight\n\nPlease rewrite the data above into a medical note, using exclusively the information above."
}
],
temperature=1,
max_tokens=500,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)

参考