diff --git a/.changeset/fluffy-squids-play.md b/.changeset/fluffy-squids-play.md new file mode 100644 index 0000000000000000000000000000000000000000..bc72fbb04d649b2a92389c2d78e0b7d2927f8554 --- /dev/null +++ b/.changeset/fluffy-squids-play.md @@ -0,0 +1,5 @@ +--- +"llamaindex": patch +--- + +Use Pinecone namespaces for all operations diff --git a/packages/core/src/storage/vectorStore/PineconeVectorStore.ts b/packages/core/src/storage/vectorStore/PineconeVectorStore.ts index 74c32552910581ad2d4fab67ce6c552ac84ee355..515995469860f9032a77845300f0b1a2ad1a5ff1 100644 --- a/packages/core/src/storage/vectorStore/PineconeVectorStore.ts +++ b/packages/core/src/storage/vectorStore/PineconeVectorStore.ts @@ -73,7 +73,7 @@ export class PineconeVectorStore implements VectorStore { async index() { const db: Pinecone = await this.getDb(); - return await db.index(this.indexName); + return db.index(this.indexName).namespace(this.namespace); } /** @@ -82,8 +82,8 @@ export class PineconeVectorStore implements VectorStore { * @returns The result of the delete query. */ async clearIndex() { - const db: Pinecone = await this.getDb(); - return await db.index(this.indexName).deleteAll(); + const idx = await this.index(); + return await idx.deleteAll(); } /** @@ -155,12 +155,10 @@ export class PineconeVectorStore implements VectorStore { }; const idx = await this.index(); - const results = await idx.namespace(this.namespace).query(options); + const results = await idx.query(options); const idList = results.matches.map((row) => row.id); - const records: FetchResponse<any> = await idx - .namespace(this.namespace) - .fetch(idList); + const records: FetchResponse<any> = await idx.fetch(idList); const rows = Object.values(records.records); const nodes = rows.map((row) => {