Shows how to translate text between languages using Upstage Solar Translation models.
This example assumes using Upstage; is in scope and apiKey contains your Upstage API key.
1 2 3 4 5 6 7 8 9101112131415161718
// Create an authenticated client using your Upstage API key.usingvarclient=newUpstageClient(apiKey);// Translate English text to Korean using the Solar translation model.// The `TranslateAsync` method requires the model name, text, source language,// and target language.varresponse=awaitclient.Translation.TranslateAsync(model:"solar-1-mini-translate-enko",text:"Hello, how are you?",sourceLang:"en",targetLang:"ko");// The response contains the translated text along with the detected// source language and the target language.Console.WriteLine($"Translated text: {response.Output.Text}");Console.WriteLine($"Source language: {response.Output.SourceLang}");Console.WriteLine($"Target language: {response.Output.TargetLang}");