@ashetm/ng-openai
Version:
``@ashetm/ng-openai`` is a wrapped library of ``openai`` for Angular.
80 lines (71 loc) • 3.51 kB
JavaScript
import * as i0 from '@angular/core';
import { NgModule, Injectable, InjectionToken } from '@angular/core';
import { Configuration, OpenAIApi } from 'openai';
class OpenairootModule {
}
OpenairootModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenairootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
OpenairootModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: OpenairootModule });
OpenairootModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenairootModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenairootModule, decorators: [{
type: NgModule,
args: [{
declarations: [],
imports: [],
exports: []
}]
}] });
class AOpenaiConfiguration extends Configuration {
}
class OpenaiService extends OpenAIApi {
constructor() {
super(new Configuration({
apiKey: ''
}));
throw new Error('Do not instanciate directly!');
}
}
OpenaiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
OpenaiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiService, decorators: [{
type: Injectable
}], ctorParameters: function () { return []; } });
const OPENAI_TOKEN_CONFIGURATION = new InjectionToken('OPENAI_TOKEN_CONFIGURATION');
class OpenaiModule {
constructor() {
throw new Error('Import OpenaiModule.forRoot static method!');
}
static forRoot(configuration) {
return {
ngModule: OpenairootModule,
providers: [
{
provide: OpenaiService,
useFactory: (configuration) => new OpenAIApi(configuration),
deps: [OPENAI_TOKEN_CONFIGURATION]
}, {
provide: OPENAI_TOKEN_CONFIGURATION,
useValue: new Configuration(configuration)
}
]
};
}
}
OpenaiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
OpenaiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: OpenaiModule });
OpenaiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: OpenaiModule, decorators: [{
type: NgModule,
args: [{
declarations: [],
imports: [],
exports: []
}]
}], ctorParameters: function () { return []; } });
/*
* Public API Surface of openai
*/
/**
* Generated bundle index. Do not edit.
*/
export { AOpenaiConfiguration, OPENAI_TOKEN_CONFIGURATION, OpenaiModule, OpenaiService, OpenairootModule };
//# sourceMappingURL=ashetm-ng-openai.mjs.map