Manage Pinecone indexes -- list, describe, and inspect your vector database indexes.
1 2 3 4 5 6 7 8 910
// List all indexes in the project.usingvarclient=newPineconeClient(apiKey);varindexes=awaitclient.ManageIndexes.ListIndexesAsync();Console.WriteLine($"Found {indexes.Indexes?.Count ?? 0} indexes");foreach(varindexinindexes.Indexes??[]){Console.WriteLine($" {index.Name}: {index.Metric}, dim={index.Dimension}, host={index.Host}");}
Embeddings
Generate vector embeddings using Pinecone's hosted embedding models.
1 2 3 4 5 6 7 8 910111213141516171819
// Generate dense text embeddings using the multilingual-e5-large model.usingvarclient=newPineconeClient(apiKey);varresponse=awaitclient.Inference.EmbedAsync(model:"multilingual-e5-large",inputs:[ new EmbedRequestInput { Text = "The quick brown fox jumps over the lazy dog." }, new EmbedRequestInput { Text = "Pinecone is a vector database." }, ]);Console.WriteLine($"Model: {response.Model}, Vector type: {response.VectorType}");foreach(varembeddinginresponse.Data){if(embedding.IsDense){Console.WriteLine($" Dense embedding: {embedding.Dense!.Values.Count} dimensions");}}
Reranking
Rerank documents by relevance to a query using Pinecone's hosted reranking models.
1 2 3 4 5 6 7 8 9101112131415161718192021222324
// Rerank documents by relevance to a query.usingvarclient=newPineconeClient(apiKey);vardoc1=newDocument();doc1.AdditionalProperties["text"]="Paris is the capital of France.";vardoc2=newDocument();doc2.AdditionalProperties["text"]="Berlin is the capital of Germany.";vardoc3=newDocument();doc3.AdditionalProperties["text"]="The Eiffel Tower is in Paris.";varresponse=awaitclient.Inference.RerankAsync(model:"bge-reranker-v2-m3",query:"What is the capital of France?",documents:[doc1,doc2,doc3],topN:3,returnDocuments:true);Console.WriteLine($"Reranking model: {response.Model}");foreach(varresultinresponse.Data){Console.WriteLine($" Index: {result.Index}, Score: {result.Score:F4}");}
Models
List and inspect available Pinecone embedding and reranking models.
1 2 3 4 5 6 7 8 910
// List all available embedding and reranking models.usingvarclient=newPineconeClient(apiKey);varresponse=awaitclient.Inference.ListModelsAsync();Console.WriteLine($"Found {response.Models?.Count ?? 0} models");foreach(varmodelinresponse.Models??[]){Console.WriteLine($" {model.Model}: type={model.Type}, dim={model.DefaultDimension}");}
MEAI Tools
Use Pinecone operations as AIFunction tools with any Microsoft.Extensions.AI IChatClient.
1 2 3 4 5 6 7 8 91011121314151617
// Create MEAI AIFunction tools for use with any IChatClient.usingvarclient=newPineconeClient(apiKey);vartools=newList<AITool>{client.AsListIndexesTool(),client.AsDescribeIndexTool(),client.AsEmbedTool(),client.AsRerankTool(),client.AsListModelsTool(),client.AsListCollectionsTool(),};foreach(vartoolintools.Cast<AIFunction>()){Console.WriteLine($" Tool: {tool.Name} - {tool.Description}");}