Skip to content

Embeddings

Shows how to generate text embeddings using Upstage Solar Embedding models.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Create an authenticated client using your Upstage API key.
using var client = new UpstageClient(apiKey);

// Generate an embedding for a text input using the Solar Embedding model.
// The `input` parameter accepts a string or an array of strings.
var response = await client.Embeddings.CreateEmbeddingAsync(
    model: "solar-embedding-1-large",
    input: "Upstage is a leading AI company.");

// The response contains a list of embedding data objects,
// each with a vector of floating-point numbers.

Console.WriteLine($"Model: {response.Model}");
Console.WriteLine($"Embedding dimensions: {response.Data[0].Embedding!.Count}");