一种方法,使GPT-3的“davinci”与用户匡威,通过一个机器人在不和谐使用discord.js?

oxalkeyp  于 2023-03-03  发布在  其他
关注(0)|答案(1)|浏览(181)
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的“Playground”中的聊天预置。我使用openai-node来编写javascript代码,而不是python来调用openAI API。

z3yyvxxp

z3yyvxxp1#

您的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:

**请注意令牌限制和成本。**您可以选择使其 * 不 * 与上下文相关,或者在某个时候开始删除以前的消息。

相关问题