一种使 GPT-3 的 "davinci" 使用 discord.js 通过不和谐的机器人与用户交谈的方法?
A way to make GPT-3's "davinci" converse with a user(s) through a bot in discord using discord.js?
var collector = new MessageCollector(message.channel, filter, {
max: 10,
time: 60000,
})
start_sequence = "\nAI: "
retart_sequence = "\nHuman: "
collector.on("collect", (msg) => {
console.log(msg.content)
openai.Completion.create({
engine: "davinci",
prompt: msg.content,
temperature: 0.9,
max_tokens: 150,
top_p: 1,
frequency_penalty: 0.35,
presence_penalty: 0.6,
stop: ["\n", " Human:", " AI:"]
}).then((response) => {
message.channel.send(response.choices[0].text)
})
})
}
我试过了,但它只返回补全,比如默认预设,而不是 GPT-3“游乐场”中的聊天预设。我正在使用 openai-node 在 javascript 中编码而不是 python 来调用 openAI API.
您的 prompt
需要提供更多信息,以便 GPT-3 了解您的需求。您正在提供消息提示,例如
My message!
但你真正应该给它的是:
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: My message!
AI:
另外,如果你想要上下文感知,还需要在提示中继续添加信息,比如:
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: My message!
AI: Response here
Human: Another message here
AI:
注意令牌限制和成本。您可以选择使其不与上下文相关,或者在某些时候开始削减输出以前的消息。
var collector = new MessageCollector(message.channel, filter, {
max: 10,
time: 60000,
})
start_sequence = "\nAI: "
retart_sequence = "\nHuman: "
collector.on("collect", (msg) => {
console.log(msg.content)
openai.Completion.create({
engine: "davinci",
prompt: msg.content,
temperature: 0.9,
max_tokens: 150,
top_p: 1,
frequency_penalty: 0.35,
presence_penalty: 0.6,
stop: ["\n", " Human:", " AI:"]
}).then((response) => {
message.channel.send(response.choices[0].text)
})
})
}
我试过了,但它只返回补全,比如默认预设,而不是 GPT-3“游乐场”中的聊天预设。我正在使用 openai-node 在 javascript 中编码而不是 python 来调用 openAI API.
您的 prompt
需要提供更多信息,以便 GPT-3 了解您的需求。您正在提供消息提示,例如
My message!
但你真正应该给它的是:
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: My message!
AI:
另外,如果你想要上下文感知,还需要在提示中继续添加信息,比如:
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Human: Hello, who are you?
AI: I am an AI created by OpenAI. How can I help you today?
Human: My message!
AI: Response here
Human: Another message here
AI:
注意令牌限制和成本。您可以选择使其不与上下文相关,或者在某些时候开始削减输出以前的消息。