Agent.getModel()
.getModel() 方法用于获取为代理配置的语言模型,如果它是一个函数,则会解析它。此方法用于访问支持代理功能的基础模型。
🌐 The .getModel() method retrieves the language model configured for an agent, resolving it if it's a function. This method is used to access the underlying model that powers the agent's capabilities.
使用示例Direct link to 使用示例
🌐 Usage example
await agent.getModel();
参数Direct link to 参数
🌐 Parameters
{ requestContext = new RequestContext() }?:
{ requestContext?: RequestContext }
= new RequestContext()
Optional configuration object containing request context.
返回Direct link to 返回
🌐 Returns
model:
MastraLanguageModel | Promise<MastraLanguageModel>
The language model configured for the agent, either as a direct instance or a promise that resolves to the model.
扩展使用示例Direct link to 扩展使用示例
🌐 Extended usage example
await agent.getModel({
requestContext: new RequestContext(),
});
选项参数Direct link to 选项参数
🌐 Options parameters
requestContext?:
RequestContext
= undefined
Request Context for dependency injection and contextual information.
相关Direct link to 相关
🌐 Related