ng-openai
Overview
A simple Angular service for openai(chatGPT)
Démo
Installation
npm i npm install ng-openai
import { NgOpenaiModule } from 'ng-openai';
imports: [
NgOpenaiModule.forRoot('sk-XXXXXXXXXXXXXXXXXXXXXX'), // your API key here
]
Usage
const completion = await this.ngOpenaiService.openai().createCompletion({
model: "text-davinci-002",
prompt: "Hello world",
});
console.log(completion.data.choices[0].text);