v2.1.0 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
Chores
- Clean up docstrings by @austin-denoble in #204
New Contributors
Full Changelog: v2.0.1...v2.1.0