Pinecone.NET
1.2.0
See the version list below for details.
dotnet add package Pinecone.NET --version 1.2.0
NuGet\Install-Package Pinecone.NET -Version 1.2.0
<PackageReference Include="Pinecone.NET" Version="1.2.0" />
<PackageVersion Include="Pinecone.NET" Version="1.2.0" />
<PackageReference Include="Pinecone.NET" />
paket add Pinecone.NET --version 1.2.0
#r "nuget: Pinecone.NET, 1.2.0"
#:package Pinecone.NET@1.2.0
#addin nuget:?package=Pinecone.NET&version=1.2.0
#tool nuget:?package=Pinecone.NET&version=1.2.0
Pinecone.NET
Pinecone.NET is a C# library for the Pinecone vector database. It aims to provide identical functionality to the official Python and Rust libraries.
Features
- Standard Index operations
- gRPC and REST transports for vector operations
- Sparse-dense vectors
- Efficient vector serialization
- Metadata support
- NativeAOT compatibility
Installation
dotnet add package Pinecone.NET or Install-Package Pinecone.NET
Usage
Working with indexes
using Pinecone;
// Initialize the client with your API key and environment
var apiKey = "<your-api-key>";
var environment = "<your-environment>"; // for example us-east4-gcp
using var pinecone = new PineconeClient(apiKey, environment);
// List all indexes
var indexes = await pinecone.ListIndexes();
// Create a new index if it doesn't exist
var indexName = "myIndex";
if (!indexes.Contains(indexName))
{
await pinecone.CreateIndex(indexName, 1536, Metric.Cosine);
}
// Get an index (uses gRPC transport by default)
using var index = await pinecone.GetIndex(indexName);
// Get an index that uses specific transport
using Pinecone.Rest;
...
using var index = await pinecone.GetIndex<RestTransport>(indexName);
// Configure an index
await pinecone.ConfigureIndex(indexName, replicas: 2, podType: "p2");
// Delete an index
await pinecone.DeleteIndex(indexName);
Working with vectors
// Assuming you have an instance of `index`
// Create and upsert vectors
var vectors = new[]
{
new Vector
{
Id = "vector1",
Values = new float[] { 0.1f, 0.2f, 0.3f },
Metadata = new MetadataMap
{
["genre"] = "horror",
["duration"] = 120
}
}
};
await index.Upsert(vectors);
// Fetch vectors by IDs
var fetched = await index.Fetch(new[] { "vector1" });
// Query scored vectors by ID
var scored = await index.Query("vector1", topK: 10);
// Query scored vectors by a new, previously unseen vector
var vector = new[] { 0.1f, 0.2f, 0.3f, ... };
var scored = await index.Query(vector, topK: 10);
// Delete vectors by vector IDs
await index.Delete(new[] { "vector1" });
// Delete vectors by metadata filter
await index.Delete(new MetadataMap
{
["genre"] = new MetadataMap
{
["$in"] = new MetadataValue[] { "documentary", "action" }
}
});
// Delete all vectors in the index
await index.DeleteAll();
Working with Collections
using Pinecone;
// Assuming you have an instance of `PineconeClient` named `pinecone`
// List all collections
var collections = await pinecone.ListCollections();
// Create a new collection
await pinecone.CreateCollection("myCollection", "myIndex");
// Describe a collection
var details = await pinecone.DescribeCollection("myCollection");
// Delete a collection
await pinecone.DeleteCollection("myCollection");
Contributing
Contributions are welcome! Feel free open an issue or a PR.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- CommunityToolkit.Diagnostics (>= 8.2.0)
- Google.Protobuf (>= 3.23.0)
- Grpc.Net.Client (>= 2.53.0)
- Grpc.Net.ClientFactory (>= 2.53.0)
- RangeExtensions (>= 2.1.1)
- System.Text.Json (>= 8.0.0-preview.3.23174.8)
-
net8.0
- CommunityToolkit.Diagnostics (>= 8.2.0)
- Google.Protobuf (>= 3.23.0)
- Grpc.Net.Client (>= 2.53.0)
- Grpc.Net.ClientFactory (>= 2.53.0)
- RangeExtensions (>= 2.1.1)
- System.Text.Json (>= 8.0.0-preview.3.23174.8)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Pinecone.NET:
| Package | Downloads |
|---|---|
|
Squidex.AI
Squidex Internal Libraries |
|
|
OBotService
OBase Framework |
|
|
RAGify
A RAG (Retrieval-Augmented Generation) framework for .NET. Build intelligent applications with document ingestion, text chunking, embedding generation, vector storage, semantic search, reranking, and answer generation. Everything ships in this single package. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Pinecone.NET:
| Repository | Stars |
|---|---|
|
Azure-Samples/azure-search-openai-demo-csharp
A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure Cognitive Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 48,057 | 9/27/2024 |
| 2.1.1 | 148,941 | 6/21/2024 |
| 2.1.0 | 18,410 | 6/5/2024 |
| 2.0.0 | 998 | 5/18/2024 |
| 1.4.0 | 10,337 | 12/17/2023 |
| 1.3.2 | 10,239 | 11/21/2023 |
| 1.3.1 | 788 | 11/14/2023 |
| 1.3.0 | 25,468 | 8/15/2023 |
| 1.2.2 | 2,658 | 7/27/2023 |
| 1.2.1 | 6,881 | 7/7/2023 |
| 1.2.0 | 2,675 | 5/15/2023 |
| 1.1.0 | 992 | 5/13/2023 |
| 1.0.0 | 863 | 5/10/2023 |