swyft-api-wrappers
v1.0.0
Published
```ts import { OpenAIClass, OpenAIFunction } from 'swyft-api-wrappers'; ```
Downloads
2
Readme
Import
import { OpenAIClass, OpenAIFunction } from 'swyft-api-wrappers';
Usage:
// Function
OpenAIFunction({
apiKey: "sk-7****************0",
instructions: [
{
name: "AvaAI",
content:
"Your name is AvaAI.",
},
],
history: [],
prompt: "What is your name?"
}).then((r) => {
console.log("Then: " + r)
}).catch((e) => {
console.log(e)
})
// Class
const test = new OpenAIClass();
test.setApi("sk-7****************0");
test.setInstructions([
{
name: "AvaAI",
content:
"Your name is AvaAI.",
},
]);
test.setMessageHistory([]);
test.setPrompt("What is your name?");
test
.getResponse()
.then((v) => {
console.log(v);
})
.catch((err) => {
console.log(err);
});