gpt4 book ai didi

openai-api - 是否可以在 Open AI API 中使用 continue?

转载 作者:行者123 更新时间:2023-12-02 05:47:49 28 4
gpt4 key购买 nike

我正在使用带有端点的 Open AI API 进行测试:

https://api.openai.com/v1/completions

但是,我在网站上发现 https://chat.openai.com/chat ,我们可以简单地使用继续要求 AI 给出带有上下文的答案。我们可以使用 continue mulittime 来扩展更多的最大 token 限制。

是否可以在API中使用“continue”或者有同样的效果?

我已尝试使用 API 中的 user 字段,但仍然无效。

最佳答案

是的,你可以,如果你发送你的信件的史前史,或者需要完成的部分并使用停用词:

continue: your text that was not finished

还有一个选项可以只使用“n”参数和更高的“max_tokens”

const response = await openai.createCompletion({
model: 'text-davinci-003',
prompt: 'continue: your text that was not finished \n',
n: 5,
temperature: 0.5,
max_tokens: 2000,
stop: '\n', // or ['AI:', 'user:']
})

这意味着 AI 会在您的停用词后向您发送 5 * 2000 个 token 和文本。 Here is很好的例子。

关于openai-api - 是否可以在 Open AI API 中使用 continue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74860930/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com