Skip to main content
Mastra 1.0 is available 🎉 Read announcement

Vectors

Vector store constructors now require an id property, and vector store methods have been renamed to follow consistent naming conventions.

Changed
Direct link to Changed

Required id property for vector store instances
Direct link to required-id-property-for-vector-store-instances

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.

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 to listVectors
Direct link to getvectors-to-listvectors

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.

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 to url
Direct link to libsqlvector-connectionurl-to-url

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',
});

OpenSearchVector: url to node
Direct link to opensearchvector-url-to-node

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 removed
Direct link to pineconevector-environment-removed

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',
});