Shows how to use the Upstage Solar LLM for chat completions.
This example assumes using Upstage; is in scope and apiKey contains your Upstage API key.
1 2 3 4 5 6 7 8 9101112131415161718192021222324
// Create an authenticated client using your Upstage API key.usingvarclient=newUpstageClient(apiKey);// Send a simple chat message to the Solar Mini model.// The `CreateChatCompletionAsync` method accepts a model name and a list of messages.varresponse=awaitclient.Chat.CreateChatCompletionAsync(model:"solar-mini",messages:[newChatMessage{Role=ChatMessageRole.System,Content="You are a helpful assistant.",},newChatMessage{Role=ChatMessageRole.User,Content="Hello! What is Upstage?",},]);// The response contains a unique ID, the model used, and a list of choices.// Each choice has a message with the assistant's reply.Console.WriteLine($"Response: {response.Choices[0].Message!.Content}");