@elizaos/core v1.0.6 / v2 / ModelHandler
Interface: ModelHandler
Defines the structure for a model handler registration within the AgentRuntime
.
Each model (e.g., for text generation, embedding) is associated with a handler function,
the name of the provider (plugin or system) that registered it, and an optional priority.
The priority
(higher is more preferred) helps in selecting which handler to use if multiple
handlers are registered for the same model type. The registrationOrder
(not in type, but used in runtime)
serves as a tie-breaker. See AgentRuntime.registerModel
and AgentRuntime.getModel
.
Properties​
handler()​
handler: (
runtime
,params
) =>Promise
<unknown
>
The function that executes the model, taking runtime and parameters, and returning a Promise.
Parameters​
• runtime: IAgentRuntime
• params: Record
<string
, unknown
>
Returns​
Promise
<unknown
>
Defined in​
packages/core/src/specs/v2/types.ts:2351
provider​
provider:
string
The name of the provider (e.g., plugin name) that registered this model handler.
Defined in​
packages/core/src/specs/v2/types.ts:2353
priority?​
optional
priority:number
Optional priority for this model handler. Higher numbers indicate higher priority.
This is used by AgentRuntime.getModel
to select the most appropriate handler
when multiple are available for a given model type. Defaults to 0 if not specified.