gpt4 book ai didi

openai-api - 如何使用 OpenAI 的 gpt-3.5-turbo API 防止幻觉?

转载 作者:行者123 更新时间:2023-12-02 22:47:31 24 4
gpt4 key购买 nike

我正在尝试制作一个个人招聘助理工具来帮助我自动回答求职申请问题的过程,例如“你为什么想在这里工作?”或“写一封求职信,说明您的经验与该职位的关系。”。

我使用我的简历和问答部分作为 API 调用的上下文,并使用问题作为提示。总的来说,这个系统运行良好,但它经常让我产生幻觉。例如,它会说我的经验比简历中实际概述的要多,或者它会说我是我从未使用过或在我的上下文中列出的技术的专家。

我尝试通过此代码显式提示模型,但没有成功:

def prepare_context(self):
context = (
"Your role in this instance is "
"to act as a recruiting assistant and help answer interview questions. "
"Your responses should be based on the information provided in the resume and "
"previous Q&As without hallucinating additional information or experience.\n\n"
"My Resume:\n\n"
f"{self.resume}\n\n"
"My Previously answered questions:\n"
)

for q, a in self.qa_list:
context += f"Q: {q}\nA: {a}\n"

context += (
"\nWhen answering the following questions, remember to answer "
"in the first person as if you were the job applicant. The responses "
"should be concise, truthful, and based solely on the given information. "
"Do not create or infer any additional experiences or skills that are "
"not explicitly mentioned in the resume or previous Q&As. "
"Do not generate any information that is not included in the resume or previous questions and answers. "
"Remember, you are answering as me "
"so answer all further questions from my perspective.\n"
)

return context

最佳答案

你不能

除非我错过了标题,否则目前无法防止任何大型语言模型的幻觉。如果你打算这样做,你要么需要接受随机错误,无论它们是什么,要么你需要每次都仔细检查所有人工智能的输出。您可以创建一个第二阶段自动错误检查器,但无论您如何实现它,一些错误仍然会通过,让您可以选择接受错误或检查所有内容。

一般来说,我只会使用生成式人工智能来自动化低风险任务。我认为求职并不是低风险的事情,因为“幻觉”可能会对您的职业声誉和 future 的就业能力产生严重后果。只是我的两分钱。

关于openai-api - 如何使用 OpenAI 的 gpt-3.5-turbo API 防止幻觉?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76575168/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com