Documentation
Classes
AbstractModel

Class: abstract AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Extended By

Type parameters

ParameterDefault
MClient extends Client-
MConfig extends Config-
MRun extends Run-
MResponse extends Response-
AResponse extends anyany

Constructors

new AbstractModel(args)

new AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>(args): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Parameters

ParameterType
argsModelArgs<MClient, MConfig, MRun, MResponse>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:67 (opens in a new tab)

Properties

ModifierPropertyTypeDescriptionSource
abstractmodelProviderProvider-src/model/model.ts:57 (opens in a new tab)
abstractmodelTypeType-src/model/model.ts:56 (opens in a new tab)
publictokenizerITokenizer-src/model/model.ts:65 (opens in a new tab)

Methods

addEvents()

addEvents(events): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Add event handlers to the model.

Parameters

ParameterType
eventsEvents<MRun & MConfig, MResponse, AResponse>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:235 (opens in a new tab)


addParams()

addParams(params): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Add the params. Overrides existing keys.

Parameters

ParameterType
paramsPartial<MConfig & Partial<MRun>>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:213 (opens in a new tab)


abstract clone()

abstract clone<Args>(args?): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Clone the model, optionally adding new arguments

Type parameters

Parameter
Args extends ModelArgs<MClient, MConfig, MRun, MResponse>

Parameters

ParameterType
args?Args

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:52 (opens in a new tab)


getClient()

getClient(): MClient

Get the current client

Returns

MClient

Source

src/model/model.ts:180 (opens in a new tab)


getContext()

getContext(): Ctx

Get the current context

Returns

Ctx

Source

src/model/model.ts:191 (opens in a new tab)


getEvents()

getEvents(): Events<MRun & MConfig, MResponse, AResponse>

Get the current event handlers

Returns

Events<MRun & MConfig, MResponse, AResponse>

Source

src/model/model.ts:230 (opens in a new tab)


getParams()

getParams(): MConfig & Partial<MRun>

Get the current params

Returns

MConfig & Partial<MRun>

Source

src/model/model.ts:208 (opens in a new tab)


run()

run(params, context?): Promise<MResponse>

Parameters

ParameterType
params`{ [K in string
context?Ctx

Returns

Promise<MResponse>

Source

src/model/model.ts:78 (opens in a new tab)


setCache()

setCache(cache): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Set the cache to a new cache. Set to undefined to remove existing.

Parameters

ParameterType
cacheundefined | CacheStorage<string, MResponse>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:174 (opens in a new tab)


setClient()

setClient(client): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Set the client to a new OpenAI API client.

Parameters

ParameterType
clientMClient

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:185 (opens in a new tab)


setContext()

setContext(context): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Set the context to a new context. Removes all existing values.

Parameters

ParameterType
contextCtx

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:202 (opens in a new tab)


setEvents()

setEvents(events): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Set the event handlers to a new set of events. Removes all existing event handlers. Set to empty object {} to remove all events.

Parameters

ParameterType
eventsEvents<MRun & MConfig, MResponse, AResponse>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:244 (opens in a new tab)


setParams()

setParams(params): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Set the params to a new params. Removes all existing values.

Parameters

ParameterType
paramsMConfig & Partial<MRun>

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:223 (opens in a new tab)


updateContext()

updateContext(context): AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Add the context. Overrides existing keys.

Parameters

ParameterType
contextCtx

Returns

AbstractModel<MClient, MConfig, MRun, MResponse, AResponse>

Source

src/model/model.ts:196 (opens in a new tab)