stores/pinecone/README.md
Vector store implementation for Pinecone, using the official @pinecone-database/pinecone SDK with added telemetry support.
pnpm add @mastra/pinecone
import { PineconeVector } from '@mastra/pinecone';
const vectorStore = new PineconeVector({
id: 'my-pinecone',
apiKey: 'your-api-key',
});
// Create a new index
await vectorStore.createIndex({ indexName: 'my-index', dimension: 1536, metric: 'cosine' });
// Add vectors
const vectors = [[0.1, 0.2, ...], [0.3, 0.4, ...]];
const metadata = [{ text: 'doc1' }, { text: 'doc2' }];
const ids = await vectorStore.upsert({ indexName: 'my-index', vectors, metadata });
// Query vectors
const results = await vectorStore.query({
indexName: 'my-index',
queryVector: [0.1, 0.2, ...],
topK: 10,
filter: { text: { $eq: 'doc1' } },
includeVector: false,
});
Required:
id: Unique identifier for this vector store instanceapiKey: Your Pinecone API keyOptional:
controllerHostUrl: Custom Pinecone controller host URLcloud: Cloud provider for new index creation ('aws' | 'gcp' | 'azure', default: 'aws')region: Region for new index creation (default: 'us-east-1')createIndex({indexName, dimension, metric?}): Create a new indexupsert({indexName, vectors, metadata?, ids?}): Add or update vectorsquery({indexName, queryVector, topK?, filter?, includeVector?}): Search for similar vectorsupdateVector({ indexName, id?, filter?, namespace?, update }): Update a single vector by ID or metadata filterdeleteVector({ indexName, id }): Delete a single vector by IDdeleteVectors({ indexName, ids?, filter?, namespace? }): Delete multiple vectors by IDs or metadata filterlistIndexes(): List all indexesdescribeIndex(indexName): Get index statisticsdeleteIndex(indexName): Delete an index