@all-inclusive/nestjs-openai
v0.0.4
Published
OpenAI API client for nestjs
Downloads
17
Maintainers
Readme
Description
This library provides convenient access to the OpenAI REST API from NestJS.
Installation
$ npm i @all-inclusive/nestjs-openai
Usage
In a parent module "forRoot"
import { OpenAiModule, Models } from "@all-inclusive/nestjs-openai";
@Module({
imports: [
OpenAiModule.forRoot({
apiKey: 'YOUR_OPEN_AI_API_KEY',
model: Models.GPT4
})
],
})
class AppModule {}
In a parent module "forRootAsync"
import { OpenAiModule, Models } from "@all-inclusive/nestjs-openai";
@Module({
imports: [
OpenAiModule.forRootAsync(
{
inject: [...any],
useFactory: {
apiKey: 'YOUR_OPEN_AI_API_KEY',
model: Models.GPT4,
},
})
],
})
class AppModule {}