Skip to main content

Mastra.getVector()

.getVector() 方法用于通过名称检索向量存储。该方法接受一个 string 参数,表示向量存储的名称。

🌐 The .getVector() method is used to retrieve a vector store by its name. The method accepts a single string parameter for the vector store's name.

使用示例
Direct link to 使用示例

🌐 Usage example

mastra.getVector("testVectorStore");

参数
Direct link to 参数

🌐 Parameters

name:

TVectorName extends keyof TVectors
The name of the vector store to retrieve. Must be a valid vector store name that exists in the Mastra configuration.

返回
Direct link to 返回

🌐 Returns

vector:

TVectors[TVectorName]
The vector store instance with the specified name. Throws an error if the vector store is not found.

🌐 Related