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 -节点在javascript中编码,而不是使用python调用openAI API。
发布于 2021-10-13 04:03:48
您的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:要注意令牌的限制和成本。您可以选择使其与上下文无关,或者在某个时候开始删除以前的消息。
https://stackoverflow.com/questions/69549494
复制相似问题