v4.0.0
Pinecone .NET SDK 4.0.0 Release Notes
This release introduces APIs for namespace management, backup and restore for indexes, and listing of available models.
Breaking Changes
CreateIndexRequestMetric
has been renamed toMetricType
for better consistency.CreateIndexForModelRequestEmbedMetric
has been renamed toMetricType
ModelIndexEmbedMetric
has been renamed toMetricType
SparseEmbedding.SparseIndices
type has changed fromIEnumerable<int>
toIEnumerable<long>
New Features
Namespace Management
Namespaces provide logical separation of data within your indexes. You don't need to explicitly create namespaces before using them - they're automatically created when you upsert records.
List Namespaces
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var index = pinecone.Index("example-index");
var namespaces = await index.ListNamespacesAsync(new ListNamespacesRequest());
foreach(var @namespace in namespaces.Namespaces)
{
Console.WriteLine($"Namespace: {@namespace.Name}");
Console.WriteLine($"Record Count: {@namespace.RecordCount}");
}
Describe a Namespace
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var index = pinecone.Index("example-index");
var @namespace = await index.DescribeNamespaceAsync("namespace-name");
Console.WriteLine($"Namespace: {@namespace.Name}");
Console.WriteLine($"Record Count: {@namespace.RecordCount}");
Delete a Namespace
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var index = pinecone.Index("example-index");
await index.DeleteNamespaceAsync("namespace-name");
Backup and Restore Operations
New backup functionality enables data protection and migration scenarios.
Backup an Index
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var backup = await pinecone.Backups.BackupIndexAsync("index-name", new BackupIndexRequest());
Restore a Backup
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var response = await pinecone.Backups.CreateIndexFromBackupAsync("backup-id", new CreateIndexFromBackupRequest {
Name = "new-index-name"
});
Console.WriteLine($"Restore Job ID: {response.RestoreJobId}");
Console.WriteLine($"New Index ID: {response.IndexId}");
Get a Backup
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var backup = await pinecone.Backups.GetAsync("backup-id");
List Backups
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var backups = await pinecone.Backups.ListAsync();
foreach (var backup in backups.Data)
{
Console.WriteLine($"BackupId: {backup.BackupId}");
Console.WriteLine($"Name: {backup.Name}");
Console.WriteLine($"CreatedAt: {backup.CreatedAt}");
Console.WriteLine($"Status: {backup.Status}");
Console.WriteLine($"RecordCount: {backup.RecordCount}");
}
Delete Backup
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
await pinecone.Backups.DeleteAsync("backup-id");
Restore Jobs
Track and manage the progress of index restore operations.
List Restore Jobs
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var jobs = await pinecone.RestoreJobs.ListAsync(new ListRestoreJobsRequest());
foreach(var job in jobs.Data)
{
Console.WriteLine($"Restore Job ID: {job.RestoreJobId}");
Console.WriteLine($"Status: {job.Status}");
Console.WriteLine($"CreatedAt: {job.CreatedAt}");
Console.WriteLine($"TargetIndexName: {job.TargetIndexName}");
}
Get Restore Job
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var job = await pinecone.RestoreJobs.GetAsync("job-id");
Console.WriteLine($"Restore Job ID: {job.RestoreJobId}");
Console.WriteLine($"Status: {job.Status}");
Console.WriteLine($"CreatedAt: {job.CreatedAt}");
Console.WriteLine($"TargetIndexName: {job.TargetIndexName}");
Models
Access and manage embedding models directly through the SDK.
List Available Models
using Pinecone;
using Pinecone.Inference;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var models = await pinecone.Inference.Models.ListAsync(new ListModelsRequest());
foreach (var model in models.Models)
{
Console.WriteLine($"Name: {model.Model}");
Console.WriteLine($"Type: {model.Type}");
Console.WriteLine($"Vector type: {model.VectorType}");
}
Get Specific Model
using Pinecone;
var pinecone = new PineconeClient("PINECONE_API_KEY");
var model = await pinecone.Inference.Models.GetAsync("pinecone-sparse-english-v0");
Console.WriteLine($"Name: {model.Model}");
Console.WriteLine($"Type: {model.Type}");
Console.WriteLine($"Vector type: {model.VectorType}");
Migration Guide
The renaming of various metric types to MetricType
requires updating any code that creates indexes. If you're using CreateIndexRequestMetric
, CreateIndexForModelRequestEmbedMetric
, or ModelIndexEmbedMetric
in your code, you'll need to update those to MetricType
.
Full Changelog: 3.1.0...4.0.0