Abstract
Create a new OpenaiApiClient instance.
The constructor options to use.
Optional
Readonly
cacheAPI response cache
Readonly
cacheDefault options for caching for api requests. Can be overriden in individual method calls.
Readonly
eventsEvent emitter for cache events
Readonly
queueGlobal queue for sending requests to the openai api.
Readonly
retryDefault options for async retry for api requests. Can be overriden in individual method calls.
Protected
Readonly
sendGeneric function for sending requests to the openai api. This is used for all the API endpoints. It handles retrying, cache, hashing, and emitting events. This method is bound to the instance on initialization because it gets wrapped with a concurrency controller in the constructor.
Optional
cache?: IResponseCacheOptionsOptional
retry?: IAsyncRetryOptionsStatic
Readonly
concurrencyOptions for concurrency control. These affect all API requests.
All emitted event names. Please note that the cache also emits events.
Protected
emitProtected
handleHandle cache options.
Optional
cacheOptions: IResponseCacheOptionsThe cache options to handle.
Protected
handleHandle the options passed to the constructor.
The options to handle.
Protected
handleHandle retry options.
Optional
retryOptions: IAsyncRetryOptionsThe retry options to handle.
Generated using TypeDoc
A class representing some kind of client retrieving resources over the internet, like an API or SQL server.
Remarks
In order to use this class, it must be extended first and then use the sendRequest method.