Skip to content

Releases: pinecone-io/pinecone-ts-client

Release v6.1.0

01 Jun 18:54
Compare
Choose a tag to compare

This release adds a new ChatContextOptions type which allows passing contextOptions in ChatOptions when calling chat or chatStream. ChatContextOptions supports passing topK and snippetSize. There have also been fixes made to context and chat methods to fix issues with argument parameters not being properly passed with the requests.

What's Changed

Full Changelog: v6.0.1...v6.1.0

Release v6.0.1

20 May 05:11
Compare
Choose a tag to compare

This patch fixes an issue with the listBackups method not applying pagination to project-level operations. There have also been additional types exported from the top of the package for working with backups and inference models.

What's Changed

Full Changelog: v6.0.0...v6.0.1

Release v6.0.0

10 May 01:00
Compare
Choose a tag to compare

This version of the Pinecone Node SDK depends on version 2025-04 of the Pinecone API. You can read more about versioning here. This v6 SDK release line should continue to receive fixes as long as the 2025-04 API version is in support.

Features

Namespaces

You now have the ability to work more explicitly with namespaces that are associated with an index. There have been several namespace methods added to the Index class:

import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
const index = pc.index('my-index');

// list all namespaces
const namespacesResp = await index.listNamespaces();

// describe a namespace
const namespace = await index.describeNamespace('ns1');

// delete a namespace (including all record data)
await index.deleteNamespace('ns1');

Backups and Restore Jobs

You can now create and manage backups of serverless indexes. It is a static, non-queryable copy of an index that represents a set of records. You can create a backup of a serverless index, and you can create a new serverless index from a backup. You can read more about backups here.

import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();

// create a backup of an existing index
const backup = await pc.createBackup({
  indexName: 'my-index',
  name: 'my-index-backup-1',
  description: 'weekly backup',
});

// describe a backup
const backupDesc = await pc.describeBackup(backup.backupId);
console.log(backupDesc);
// {
//   backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
//   sourceIndexName: 'my-index',
//   sourceIndexId: 'b480770b-600d-4c4e-bf19-799c933ae2bf',
//   name: 'my-index-backup-1',
//   description: 'weekly backup',
//   status: 'Initializing',
//   cloud: 'aws',
//   region: 'us-east-1',
//   dimension: 1024,
//   metric: 'cosine',
//   recordCount: 500,
//   namespaceCount: 4,
//   sizeBytes: 78294,
//   tags: {},
//   createdAt: '2025-05-07T03:11:11.722238160Z'
// }

// list all existing backups for the project
const projectBackups = await pc.listBackups();

// list all existing backups for a specific index in the project
const indexBackups = await pc.listBackups({ indexName: 'my-index' });

// create a new index from a backup, which initiates a restore job
const response = await pc.createIndexFromBackup({
  backupId: backup.backupId,
  name: 'my-index-restore-1',
});
console.log(response);
// {
//   restoreJobId: '4d4c8693-10fd-4204-a57b-1e3e626fca07',
//   indexId: 'deb7688b-9f21-4c16-8eb7-f0027abd27fe'
// }

// check on the progress of your index restoration
const restoreJob = await pc.describeRestoreJob(response.restoreJobId);
console.log(restoreJob);
//     {
//       restoreJobId: '4d4c8693-10fd-4204-a57b-1e3e626fca07',
//       backupId: '11450b9f-96e5-47e5-9186-03f346b1f385',
//       targetIndexName: 'my-index-restore-1',
//       targetIndexId: 'deb7688b-9f21-4c16-8eb7-f0027abd27fe',
//       status: 'Completed',
//       createdAt: 2025-05-07T03:38:37.107Z,
//       completedAt: 2025-05-07T03:40:23.687Z,
//       percentComplete: 100
//     }

Inference Models

You can now use the Inference class to browse models hosted by Pinecone, including detailed configuration options for each model.

List all available models:

const models = await pc.inference.listModels();
console.log(models);
// {
//   models: [
//     {
//       model: 'llama-text-embed-v2',
//       shortDescription: 'A high performance dense embedding model optimized for multilingual and cross-lingual text question-answering retrieval with support for long documents (up to 2048 tokens) and dynamic embedding size (Matryoshka Embeddings).',
//       type: 'embed',
//       vectorType: 'dense',
//       defaultDimension: 1024,
//       modality: 'text',
//       maxSequenceLength: 2048,
//       maxBatchSize: 96,
//       providerName: 'NVIDIA',
//       supportedDimensions: [Array],
//       supportedMetrics: [Array],
//       supportedParameters: [Array]
//     },
//     ...
//     {
//       model: 'pinecone-rerank-v0',
//       shortDescription: 'A state of the art reranking model that out-performs competitors on widely accepted benchmarks. It can handle chunks up to 512 tokens (1-2 paragraphs)',
//       type: 'rerank',
//       vectorType: undefined,
//       defaultDimension: undefined,
//       modality: 'text',
//       maxSequenceLength: 512,
//       maxBatchSize: 100,
//       providerName: 'Pinecone',
//       supportedDimensions: undefined,
//       supportedMetrics: undefined,
//       supportedParameters: [Array]
//     }
//   ]
// }

Check details for a single model:

const model = await pc.inference.getModel('pinecone-sparse-english-v0');
console.log(model);
// {
//   model: 'pinecone-sparse-english-v0',
//   shortDescription: 'A sparse embedding model for converting text to sparse vectors for keyword or hybrid semantic/keyword search. Built on the innovations of the DeepImpact architecture.',
//   type: 'embed',
//   vectorType: 'sparse',
//   defaultDimension: undefined,
//   modality: 'text',
//   maxSequenceLength: 512,
//   maxBatchSize: 96,
//   providerName: 'Pinecone',
//   supportedDimensions: undefined,
//   supportedMetrics: [ 'DotProduct' ],
//   supportedParameters: [
//     {
//       parameter: 'input_type',
//       type: 'one_of',
//       valueType: 'string',
//       required: true,
//       allowedValues: [Array],
//       min: undefined,
//       max: undefined,
//       _default: undefined
//     },
//     {
//       parameter: 'truncate',
//       type: 'one_of',
//       valueType: 'string',
//       required: false,
//       allowedValues: [Array],
//       min: undefined,
//       max: undefined,
//       _default: 'END'
//     },
//     {
//       parameter: 'return_tokens',
//       type: 'any',
//       valueType: 'boolean',
//       required: false,
//       allowedValues: undefined,
//       min: undefined,
//       max: undefined,
//       _default: false
//     }
//   ]
// }

What's Changed

Full Changelog: v5.1.2...v6.0.0

v5.1.2

23 Apr 21:21
Compare
Choose a tag to compare

This patch corrects an issue with runtime validation and TypeScript types not allowing the embed parameter in ConfigureIndexRequest. Several dev dependencies for jest have also been updated, along with some tweaks to the integration test suite to prevent hangs in CI.

What's Changed

Full Changelog: v5.1.1...v5.1.2

Release v5.1.1

04 Mar 07:40
Compare
Choose a tag to compare

Fixes an issue where the typing for the upsertRecords method did not accept _id as an object argument. The _id and _score values are now properly returned from the searchRecords method instead of mapped values.

What's Changed

Full Changelog: v5.1.0...v5.1.1

Release v5.1.0

28 Feb 16:26
Compare
Choose a tag to compare

Features

Indexes with Integrated Inference

This release adds a new createIndexForModel method as well as upsertRecords, and searchRecords methods. Together these methods provide a way for you to easily store your data and let us manage the process of creating embeddings. To learn about available models, see the Model Gallery.

import { Pinecone } from '@pinecone-database/pinecone';

// 1. Instantiate the Pinecone client
const pc = new Pinecone();

// 2. Create an index configured for use with a particular model
await pc.createIndexForModel({
  name: 'my-integrated-index',
  cloud: 'aws',
  region: 'us-east-1',
  embed: {
    model: 'multilingual-e5-large',
    fieldMap: { text: 'chunk_text' },
  },
  waitUntilReady: true,
});

// 3. Instantiate an Index client with a namespace
const namespace = pc.index('my-integrated-index').namespace('my-namespace');

// 4. Upsert records
await namespace.upsertRecords([
  {
    id: 'rec1',
    chunk_text:
      "Apple's first product, the Apple I, was released in 1976 and was hand-built by co-founder Steve Wozniak.",
    category: 'product',
  },
  {
    id: 'rec2',
    chunk_text:
      'Apples are a great source of dietary fiber, which supports digestion and helps maintain a healthy gut.',
    category: 'nutrition',
  },
  {
    id: 'rec3',
    chunk_text:
      'Apples originated in Central Asia and have been cultivated for thousands of years, with over 7,500 varieties available today.',
    category: 'cultivation',
  },
  {
    id: 'rec4',
    chunk_text:
      'In 2001, Apple released the iPod, which transformed the music industry by making portable music widely accessible.',
    category: 'product',
  },
  {
    id: 'rec5',
    chunk_text:
      'Apple went public in 1980, making history with one of the largest IPOs at that time.',
    category: 'milestone',
  },
  {
    id: 'rec6',
    chunk_text:
      'Rich in vitamin C and other antioxidants, apples contribute to immune health and may reduce the risk of chronic diseases.',
    category: 'nutrition',
  },
  {
    id: 'rec7',
    chunk_text:
      "Known for its design-forward products, Apple's branding and market strategy have greatly influenced the technology sector and popularized minimalist design worldwide.",
    category: 'influence',
  },
  {
    id: 'rec8',
    chunk_text:
      'The high fiber content in apples can also help regulate blood sugar levels, making them a favorable snack for people with diabetes.',
    category: 'nutrition',
  },
]);

// 5. Search for similar records
const response = await namespace.searchRecords({
  query: {
    topK: 3,
    inputs: { text: 'Apple corporation' },
  },
  fields: ['chunk_text'],
  rerank: {
    model: 'bge-reranker-v2-m3',
    rankFields: ['chunk_text'],
    topN: 3,
  },
});

New Assistant features

There are a few new fields available for working with Assistants. You can now pass messages and topK with context requests. You can also request use jsonResponse and includeHighlights in chat methods. The jsonResponse boolean allows you to return content in a JSON format, while includeHighlights let's you include additional contextual information from source references.

What's Changed

Full Changelog: v5.0.2...v5.1.0

Release v5.0.2

20 Feb 09:40
Compare
Choose a tag to compare

Types Embedding and EmbeddingsListUsage are now exported from the top of the client package.

Full Changelog: v5.0.1...v5.0.2

Release v5.0.1

20 Feb 08:01
Compare
Choose a tag to compare

What's Changed

Full Changelog: v5.0.0...v5.0.1

Release v5.0.0

15 Feb 05:35
Compare
Choose a tag to compare

This version of the Pinecone Node SDK depends on version 2025-01 of the Pinecone API. You can read more about versioning here. This v5 SDK release line should continue to receive fixes as long as the 2025-01 API version is in support.

Features

Sparse index support

You can now work with sparse-only indexes. These indexes enable direct indexing and retrieval of sparse vectors, supporting traditional methods like BM25 and learned sparse models such as pinecone-sparse-english-v0. You can read more about getting started with sparse-only indexes here.

The following example demonstrates creating a new sparse-only index, and upserting some arbitrary sparse vector data:

import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();

// create a sparse serverless index
await pc.createIndex({
  name: 'sample-index',
  vectorType: 'sparse',
  spec: {
    serverless: {
      cloud: 'aws',
      region: 'us-east-1',
    },
  },
});

// upsert sparse vectors to the index
const index = pc.index('sample-index');

const sparseVectors = [
  {
    id: '1',
    sparseValues: { indices: [0, 1], values: [0.236, 0.34] },
  },
  {
    id: '2',
    sparseValues: { indices: [0, 1], values: [0.345, 0.98] },
  },
];

await index.upsertVectors(sparseVectors);

Assistant support

Support has been added for working with Pinecone Assistants. Pinecone Assistant is a service that allows you to upload documents, ask questions, and receive responses that reference your documents. This is known as retrieval-augmented generation (RAG).

const pc = new Pinecone();

// create an assistant
await pc.createAssistant({
  name: 'test-assistant',
  instructions: 'respond to queries in english',
  region: 'us',
  metadata: { key: 'value' },
});

const assistant = pc.assistant('test-assistant');

// upload a file to the assistant
const file = await assistant.uploadFile({
  path: '/local/path/to/file.pdf',
  metadata: { key: 'value' },
});

// check on the status of the file
const fileStatus = await assistant.describeFile(file.id);
console.log(fileStatus.percentDone);

// chat with the assistant
const stream = await assistant.chatStream({
  messages: [{ role: 'user', content: 'What is the capital of France?' }],
});

// stream the response
for await (const chunk of stream) {
  if (chunk.type === 'content_chunk') {
    process.stdout.write(chunk.delta.content || '');
  }
}
});

What's Changed

Full Changelog: 4.1.0...v5.0.0

4.1.0

09 Jan 17:42
Compare
Choose a tag to compare

Features

Index tags

Users can now tag indexes with key:value pairs for categorizing and identifying indexes. You can add tags when creating an index, or modify/delete tags when configuring an index.

Example code:

import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();
await pc.createIndex({
  name: 'sample-index',
  dimension: 1536,
  spec: {
    serverless: {
      cloud: 'aws',
      region: 'us-west-2',
    },
  },
  tags: { team: 'data-science' },  // Index tag here
});

Retries

The upsert, configureIndex, and update operations now make use of a new RetryOnServerFailure class. This class takes in an asynchronous operation and retries it if the server respond with either of 2 new errors: a PineconeUnavailableError (503) or a PineconeInternalServerError (500). The RetryOnServerFailure class retries 3 times as a default with an exponential backoff and a jitter factor. If maxRetries exceeds 10, an error is thrown to avoid overloading the server.

Housekeeping

  • Add integration testing w/external NextJS app (Edge runtime) by @aulorbe in #304
  • Rename previously-named e2e workflow to external-app for consistency by @aulorbe in #311
  • Remove extra call to delete an already-deleted index in bulkImport integration test by @aulorbe in #313
  • Refactor listPaginated tests by @aulorbe in #312
  • Remove git submodule cmds and update Vercel cmds in external-app tests by @aulorbe in #316
  • Small fix in deleteAll documentation regarding namespaces by @kehanzhang in #314
  • Add sleep to codegen script by @aulorbe in #321

New Contributors

Full Changelog: v4.0.0...4.1.0