> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Agent.getModel() `.getModel()` 方法會取得為 Agent 設定的語言模型;如設定為函數,則會先解析函數。此方法用於存取支援 Agent 功能的底層模型。 ## 使用範例 ```typescript await agent.getModel() ``` ## 參數 **options** (`{ requestContext?: RequestContext }`): 包含請求內容的可選設定物件。 (Default: `{}`) **options.requestContext** (`RequestContext`): 用於依賴注入及內容資訊的 Request Context。 ## 傳回值 **model** (`MastraLanguageModel | Promise`): 為 Agent 設定的語言模型,可以是直接提供的執行個體,亦可以是解析為該模型的 promise。 ## 延伸使用範例 ```typescript await agent.getModel({ requestContext: new RequestContext(), }) ``` ## 相關內容 - [Agent 概覽](https://mastra.zisheng.pro/zh-HK/docs/agents/overview) - [Request Context](https://mastra.zisheng.pro/zh-HK/docs/server/request-context)