1
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。

4

1 回答 1

1

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:

请注意代币限制和成本。您可以选择使其与上下文无关,或者在某些时候开始删除以前的消息。

于 2021-10-13T04:03:48.277 回答