向量
🌐 Vectors
向量存储构造函数现在需要一个 id 属性,向量存储方法已被重命名以遵循统一的命名规范。
🌐 Vector store constructors now require an id property, and vector store methods have been renamed to follow consistent naming conventions.
已更改Direct link to 已更改
🌐 Changed
向量存储实例需要 id 属性Direct link to required-id-property-for-vector-store-instances
🌐 Required id property for vector store instances
向量存储实例现在需要一个 id 属性。此唯一标识符用于在 Mastra 中跟踪和管理向量存储实例。id 应该是你应用中每个向量存储的描述性、唯一字符串。
🌐 Vector store instances now require an id property. This unique identifier is used for tracking and managing vector store instances within Mastra. The id should be a descriptive, unique string for each vector store in your application.
要迁移,请在向量存储构造函数中添加一个 id 字段。
🌐 To migrate, add an id field to your vector store constructor.
const vectorStore = new PgVector({
+ id: 'main-vector-store',
connectionString: process.env.POSTGRES_CONNECTION_STRING,
});
const chromaStore = new ChromaVector({
+ id: 'chroma-embeddings',
url: process.env.CHROMA_URL,
});
const pineconeStore = new PineconeVector({
+ id: 'pinecone-production',
apiKey: process.env.PINECONE_API_KEY,
});
getVectors 到 listVectorsDirect link to getvectors-to-listvectors
🌐 getVectors to listVectors
getVectors() 方法已重命名为 listVectors()。此更改与整个 API 中的命名约定保持一致,其中复数获取方法使用 list 前缀。
🌐 The getVectors() method has been renamed to listVectors(). This change aligns with the naming convention used across the API where plural getter methods use the list prefix.
要迁移,请将所有对 getVectors() 的调用替换为 listVectors()。
🌐 To migrate, replace all calls to getVectors() with listVectors().
const vectorStore = new VectorStore({ ... });
- const vectors = await vectorStore.getVectors({ ... });
+ const vectors = await vectorStore.listVectors({ ... });
LibSQLVector:connectionUrl 到 urlDirect link to libsqlvector-connectionurl-to-url
🌐 LibSQLVector: connectionUrl to url
connectionUrl 参数已重命名为 url,以与 @libsql/client API 保持一致,并匹配 LibSQLStorage。
🌐 The connectionUrl parameter has been renamed to url to align with the @libsql/client API and match LibSQLStorage.
const vectorStore = new LibSQLVector({
id: 'my-vector',
- connectionUrl: 'file:./db.sqlite',
+ url: 'file:./db.sqlite',
});
OpenSearch向量:url 到 nodeDirect link to opensearchvector-url-to-node
🌐 OpenSearchVector: url to node
url 参数已重命名为 node,以匹配 OpenSearch ClientOptions API。构造函数现在接受所有 OpenSearch 客户端选项,包括认证、SSL 和压缩。
🌐 The url parameter has been renamed to node to match the OpenSearch ClientOptions API. The constructor now accepts all OpenSearch client options including authentication, SSL, and compression.
const vectorStore = new OpenSearchVector({
id: 'my-vector',
- url: 'http://localhost:9200',
+ node: 'http://localhost:9200',
});
PineconeVector:environment 已移除Direct link to pineconevector-environment-removed
🌐 PineconeVector: environment removed
environment 参数已被移除。如果需要指定自定义控制器主机,请使用 controllerHostUrl。构造函数现在接受所有 Pinecone 配置选项。
🌐 The environment parameter has been removed. Use controllerHostUrl instead if you need to specify a custom controller host. The constructor now accepts all Pinecone configuration options.
const vectorStore = new PineconeVector({
id: 'my-vector',
apiKey: process.env.PINECONE_API_KEY,
- environment: process.env.PINECONE_ENVIRONMENT,
});
如果你需要自定义控制器主机:
🌐 If you need a custom controller host:
const vectorStore = new PineconeVector({
id: 'my-vector',
apiKey: process.env.PINECONE_API_KEY,
controllerHostUrl: 'https://api.pinecone.io',
});