hiexam
microsoft · AI-102 · Q294 · code_completion · azure, openai, api_integration

Complete the code snippet below to retrieve embeddings from the OpenAI API using Azure credentials.

Complete the code snippet below to retrieve embeddings from the OpenAI API using Azure credentials.
Uri endpoint = new Uri("https://openai.openai.azure.com");
AzureKeyCredential credentials = new AzureKeyCredential("{{key_slot}}");

OpenAIClient openAIClient = new (endpoint, credentials);
EmbeddingsOptions embeddingOptions = new EmbeddingsOptions(input_text_string);
var returnValue = openAIClient.GetEmbeddings("{{embedding_slot}}", embeddingOptions);

foreach (float item in returnValue.Value.Data[0].Embedding)
{
    Console.WriteLine(item);
}
Correct slot values

Answer hidden

Unlock AI-102

First 5 questions of every exam are free. Unlock the rest.

Includes
  • · All — questions
  • · Verified answers + AI explanations
  • · Spaced-repetition mistake notebook
  • · Phone, tablet, laptop sync

One-time payment. Doesn't auto-renew. · Already paid? Sign in