使用LLMs回答开放域问题
背景
以下提示测试LLM回答开放域问题的能力 ,这涉及在没有提供任何证据的情况下回答事实性问题。
注意
注意,由于任务的挑战性,当LLM对问题没有相关知识时,可能会产生幻觉。
提示
在这段人类与AI的对话中,AI是乐于助人且友好的,当它不知道答案时会说"我不知道"。
AI: 你好,有什么我可以帮忙的吗?
Human: 我能在SeaTac机场买到麦当劳吗?
代码 / API
- GPT-4 (OpenAI)
- Mixtral MoE 8x7B Instruct (Fireworks)
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[
{
"role": "user",
"content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?"
}
],
temperature=1,
max_tokens=250,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
import fireworks.client
fireworks.client.api_key = "<FIREWORKS_API_KEY>"
completion = fireworks.client.ChatCompletion.create(
model="accounts/fireworks/models/mixtral-8x7b-instruct",
messages=[
{
"role": "user",
"content": "In this conversation between a human and the AI, the AI is helpful and friendly, and when it does not know the answer it says \"I don’t know\".\n\nAI: Hi, how can I help you?\nHuman: Can I get McDonalds at the SeaTac airport?",
}
],
stop=["<|im_start|>","<|im_end|>","<|endoftext|>"],
stream=True,
n=1,
top_p=1,
top_k=40,
presence_penalty=0,
frequency_penalty=0,
prompt_truncate_len=1024,
context_length_exceeded_behavior="truncate",
temperature=0.9,
max_tokens=4000
)
参考
- 人工通用智能的火花:GPT-4的早期实验 (2023年4月13日)