> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Mastra.getVector() `.getVector()` 方法用於按名稱擷取向量儲存。此方法接受一個代表向量儲存名稱的 `string` 參數。 ## 使用範例 ```typescript mastra.getVector('testVectorStore') ``` ## 參數 **name** (`TVectorName extends keyof TVectors`): 要擷取的向量儲存名稱。必須是 Mastra 配置中存在的有效向量儲存名稱。 ## 傳回值 **vector** (`TVectors[TVectorName]`): 具有指定名稱的向量儲存實例。如找不到向量儲存,便會拋出錯誤。 ## 相關內容 - [向量儲存概覽](https://mastra.zisheng.pro/zh-HK/guides/rag/vector-databases) - [RAG 概覽](https://mastra.zisheng.pro/zh-HK/guides/rag/overview)