aistar-node
v4.0.2
Published
Node.js library for the AiStar API
Downloads
3
Maintainers
Readme
AiStar Node.js Library
AiStar Node.js 库提供从 Node.js 应用程序方便地访问 AiStar API。
⚠️ 重要提示:该库仅供服务器端使用
安装
npm install aistar-node
用法
const { Configuration, OpenAIApi } = require("aistar-node");
const configuration = new Configuration({
apiKey: process.env.AISTAR_API_KEY,
});
const openai = new OpenAIApi(configuration);
openai.createChatCompletionSSE({
model: "gpt-3.5-turbo",
messages: [{role: "user", content: "Hello world"}],
}).then(res => {
res.message = (resp) => {
console.log("resp = ", resp)
}
res.error = (ev) => {
console.log("error", ev)
}
res.open = (ev) => {
console.log("open", ev)
}
res.end = (ev) => {
console.log("end", ev)
}
res.closed = (ev) => {
console.log("closed", ev)
}
});
支持
⚠️ 该库仅支持:createChatCompletionSSE 方法
Todo
Other Method