Class AbstractApiClientAbstract

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.

Hierarchy

Constructors

Properties

cache?: ApiReponseCache<any>

API response cache

cacheDefaults: IResponseCacheOptions = ...

Default options for caching for api requests. Can be overriden in individual method calls.

events: EventEmitter = ...

Event emitter for cache events

queue: PromiseQueue<IQueue<(() => Promise<unknown>), IQueueAddOptions>, IQueueAddOptions>

Global queue for sending requests to the openai api.

retryDefaults: IAsyncRetryOptions = ...

Default options for async retry for api requests. Can be overriden in individual method calls.

sendRequest: (<T>(options) => Promise<T>)

Type declaration

    • <T>(options): Promise<T>
    • Generic 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.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

concurrencyDefaults: IPromiseQueueOptions<IQueue<(() => Promise<unknown>), IQueueAddOptions>, IQueueAddOptions> = ...

Options for concurrency control. These affect all API requests.

Accessors

Methods

Generated using TypeDoc