首页 > 编程语言 >如何使用 Node.js 和 OpenAI API 快速开发一个私有的 ChatGPT 智能聊天机器人程序 All In One

如何使用 Node.js 和 OpenAI API 快速开发一个私有的 ChatGPT 智能聊天机器人程序 All In One

时间:2023-02-08 23:36:03浏览次数:65  
标签:Node const js API openai OpenAI com

如何使用 Node.js 和 OpenAI API 快速开发一个私有的 ChatGPT 智能聊天机器人程序 All In One

OpenAI API

https://platform.openai.com/docs/libraries/node-js-library

$ npm install openai

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",
  temperature: 0,
  max_tokens: 7,
});

(

标签:Node,const,js,API,openai,OpenAI,com
From: https://www.cnblogs.com/xgqfrms/p/17103702.html

相关文章