Documentation
Interfaces
Modelargs

Interface: ModelArgs<MClient, MConfig, MRun, MResponse>

Type parameters

Parameter
MClient extends Client
MConfig extends Config
MRun extends Run
MResponse extends Response

Properties

PropertyTypeDescriptionSource
cache?CacheStorage<string, MResponse>Enables caching for model responses. Must implement .get(key) and .set(key, value), both of which can be either sync or async.

Some examples include: new Map(), quick-lru (opens in a new tab), or any keyv adaptor (opens in a new tab).
src/model/model.ts:29 (opens in a new tab)
cacheKey?CacheKey<MRun & MConfig, string>A function that returns a cache key for the given params.

A simple example would be: (params) => JSON.stringify(params)

The default cacheKey function uses hash-object (opens in a new tab) to create a stable sha256 hash of the params.
src/model/model.ts:23 (opens in a new tab)
clientMClient-src/model/model.ts:30 (opens in a new tab)
context?Ctx-src/model/model.ts:31 (opens in a new tab)
debug?booleanWhether or not to add default console.log event handlerssrc/model/model.ts:35 (opens in a new tab)
events?Events<MRun & MConfig, MResponse, any>-src/model/model.ts:33 (opens in a new tab)
paramsMConfig & Partial<MRun>-src/model/model.ts:32 (opens in a new tab)