@maiar-ai/core / ModelProvider
Class: abstract ModelProvider
Defined in: packages/core/src/runtime/providers/model.ts:37
Base class for model providers
Constructors​
new ModelProvider()​
new ModelProvider(
__namedParameters):ModelProvider
Defined in: packages/core/src/runtime/providers/model.ts:45
Parameters​
__namedParameters​
id​
string
Returns​
Properties​
id​
readonlyid:string
Defined in: packages/core/src/runtime/providers/model.ts:38
capabilities​
readonlycapabilities:Map<string,ModelCapability>
Defined in: packages/core/src/runtime/providers/model.ts:39
Accessors​
logger​
Get Signature​
get logger():
Logger
Defined in: packages/core/src/runtime/providers/model.ts:41
Returns​
Logger
Methods​
init()​
abstractinit():void|Promise<void>
Defined in: packages/core/src/runtime/providers/model.ts:54
Initializes the model provider. Must be implemented by subclasses.
Returns​
void | Promise<void>
A promise that resolves when initialization is complete.
checkHealth()​
abstractcheckHealth():void|Promise<void>
Defined in: packages/core/src/runtime/providers/model.ts:60
Checks the health of the model provider. Must be implemented by subclasses.
Returns​
void | Promise<void>
A promise that resolves when health check is complete.
shutdown()​
abstractshutdown():void|Promise<void>
Defined in: packages/core/src/runtime/providers/model.ts:66
Shuts down the model provider. Must be implemented by subclasses.
Returns​
void | Promise<void>
A promise that resolves when shutdown is complete.
addCapability()​
addCapability(
capability):void
Defined in: packages/core/src/runtime/providers/model.ts:68
Parameters​
capability​
Returns​
void
getCapability()​
getCapability<
I,O,C>(capabilityId):undefined|ModelCapability<I,O,C>
Defined in: packages/core/src/runtime/providers/model.ts:72
Type Parameters​
• I
• O
• C = unknown
Parameters​
capabilityId​
string
Returns​
undefined | ModelCapability<I, O, C>
getCapabilities()​
getCapabilities():
ModelCapability[]
Defined in: packages/core/src/runtime/providers/model.ts:80
Returns​
hasCapability()​
hasCapability(
capabilityId):boolean
Defined in: packages/core/src/runtime/providers/model.ts:84
Parameters​
capabilityId​
string
Returns​
boolean
executeCapability()​
executeCapability<
K>(capabilityId,input,config?):Promise<ICapabilities[K]["output"]>
Defined in: packages/core/src/runtime/providers/model.ts:88
Type Parameters​
• K extends "text-generation"
Parameters​
capabilityId​
K
input​
ICapabilities[K]["input"]
config?​
ICapabilities[K] extends object ? C : unknown
Returns​
Promise<ICapabilities[K]["output"]>