tryAGI.Pinecone
0.1.2
Prefix Reserved
See the version list below for details.
dotnet add package tryAGI.Pinecone --version 0.1.2
NuGet\Install-Package tryAGI.Pinecone -Version 0.1.2
<PackageReference Include="tryAGI.Pinecone" Version="0.1.2" />
paket add tryAGI.Pinecone --version 0.1.2
#r "nuget: tryAGI.Pinecone, 0.1.2"
// Install tryAGI.Pinecone as a Cake Addin #addin nuget:?package=tryAGI.Pinecone&version=0.1.2 // Install tryAGI.Pinecone as a Cake Tool #tool nuget:?package=tryAGI.Pinecone&version=0.1.2
Pinecone
Pinecone is a fully-fledged C# library for the Pinecone vector database.
It aims to provide identical functionality to the official Python and Rust libraries.
This is a fork of this project with netstandard2.0/net framework support.
Features
- Standard Index operations
- gRPC and REST transports for vector operations
- Sparse-dense vectors
- Efficient vector serialization
- Metadata support
- NativeAOT compatibility
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 by name
using var index = await pinecone.GetIndex(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);
// Query scored vectors by ID with metadata filter
var filter = new MetadataMap
{
["genre"] = new MetadataMap
{
["$in"] = new MetadataValue[] { "documentary", "action" }
}
};
var scored = await index.Query("birds", topK: 10, filter);
// 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.
Support
Priority place for bugs: https://github.com/tryAGI/Pinecone/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Pinecone/discussions
Discord: https://discord.gg/Ca2xhfBf3v
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- CommunityToolkit.Diagnostics (>= 8.2.1)
- Google.Protobuf (>= 3.24.0)
- Grpc.Net.Client (>= 2.55.0)
- Grpc.Net.ClientFactory (>= 2.55.0)
- RangeExtensions (>= 2.1.1)
- System.Net.Http.Json (>= 8.0.0-preview.7.23375.6)
- System.Text.Json (>= 8.0.0-preview.7.23375.6)
-
.NETStandard 2.0
- CommunityToolkit.Diagnostics (>= 8.2.1)
- Google.Protobuf (>= 3.24.0)
- Grpc.Net.Client (>= 2.55.0)
- Grpc.Net.ClientFactory (>= 2.55.0)
- RangeExtensions (>= 2.1.1)
- System.Net.Http.Json (>= 8.0.0-preview.7.23375.6)
- System.Text.Json (>= 8.0.0-preview.7.23375.6)
-
net6.0
- CommunityToolkit.Diagnostics (>= 8.2.1)
- Google.Protobuf (>= 3.24.0)
- Grpc.Net.Client (>= 2.55.0)
- Grpc.Net.ClientFactory (>= 2.55.0)
- RangeExtensions (>= 2.1.1)
- System.Net.Http.Json (>= 8.0.0-preview.7.23375.6)
- System.Text.Json (>= 8.0.0-preview.7.23375.6)
-
net7.0
- CommunityToolkit.Diagnostics (>= 8.2.1)
- Google.Protobuf (>= 3.24.0)
- Grpc.Net.Client (>= 2.55.0)
- Grpc.Net.ClientFactory (>= 2.55.0)
- RangeExtensions (>= 2.1.1)
- System.Net.Http.Json (>= 8.0.0-preview.7.23375.6)
- System.Text.Json (>= 8.0.0-preview.7.23375.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.