Skip to content

Embeddings

Generate vector embeddings using Pinecone's hosted embedding models.

This example assumes using Pinecone; is in scope and apiKey contains your Pinecone API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// Generate dense text embeddings using the multilingual-e5-large model.
using var client = new PineconeClient(apiKey);

var response = await client.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 (var embedding in response.Data)
{
    if (embedding.IsDense)
    {
        Console.WriteLine($"  Dense embedding: {embedding.Dense!.Values.Count} dimensions");
    }
}