MultipleEmbeddings

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using var api = GetAuthenticatedClient();

string category = "Luxury";
string description = "Best hotel in town if you like luxury hotels. They have an amazing infinity pool, a spa,"
                     + " and a really helpful concierge. The location is perfect -- right downtown, close to all the tourist"
                     + " attractions. We highly recommend this hotel.";
List<string> inputs = [category, description];

CreateEmbeddingResponse response = await api.Embeddings.CreateEmbeddingAsync(
    input: inputs,
    model: CreateEmbeddingRequestModel.TextEmbedding3Small);

foreach (Embedding embedding in response.Data)
{
    IList<double> vector = embedding.Embedding1;

    Console.WriteLine($"Dimension: {vector.Count}");
    Console.WriteLine("Floats: ");
    for (int i = 0; i < vector.Count; i++)
    {
        Console.WriteLine($"  [{i,4}] = {vector[i]}");
    }

    Console.WriteLine();
}