OpenAI其主要目标,包括制造“通用”机器人和使用自然语言的聊天机器人
今天主要讲解react中的nextjs,怎样使用文本补全。
openAI的文本补全接口:OpenAI API
官方提供nodejs的代码以及curl的方法:
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "Say this is a test",
max_tokens: 7,
temperature: 0,
});
curl https://api.openai/v1/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"model": "text-davinci-003",
"prompt": "Say this is a test",
"max
更多推荐
openAI文本补全Text completion
发布评论