Skip to content

v2.1.0 Release

Compare
Choose a tag to compare
@austin-denoble austin-denoble released this 06 Mar 20:44
· 7 commits to main since this release

Listing record ids by prefix in a namespace (for serverless indexes)

We've implemented SDK support for a new data plane endpoint used to list ids by prefix in a given namespace. If no prefix or an empty string is passed, this can be used to list all ids in a namespace.

The index class now has a listPaginated function. With clever assignment of record ids, this can be used to help model hierarchical relationships between different records such as when you have embeddings for multiple chunks or fragments related to the same document.

You can fetch each page of results with listPaginated.

const pc = new Pinecone();
const index = pc.index('my-index').namespace('my-namespace');

const results = await index.listPaginated({ prefix: 'doc1#' });
console.log(results);
// {
//   vectors: [
//     { id: 'doc1#01' }, { id: 'doc1#02' }, { id: 'doc1#03' },
//     { id: 'doc1#04' }, { id: 'doc1#05' },  { id: 'doc1#06' },
//     { id: 'doc1#07' }, { id: 'doc1#08' }, { id: 'doc1#09' },
//     ...
//   ],
//   pagination: {
//     next: 'eyJza2lwX3Bhc3QiOiJwcmVUZXN0LS04MCIsInByZWZpeCI6InByZVRlc3QifQ=='
//   },
//   namespace: 'my-namespace',
//   usage: { readUnits: 1 }
// }

// Fetch the next page of results
await index.listPaginated({
  prefix: 'doc1#',
  paginationToken: results.pagination.next,
});

Fixes

  • types(update): wrap metadata param in Partial by @omikader in #199

Chores

New Contributors

Full Changelog: v2.0.1...v2.1.0