This example assumes using DeepInfra; is in scope and apiKey contains your DeepInfra API key.
1 2 3 4 5 6 7 8 910111213141516
usingvarclient=GetAuthenticatedOpenAiClient();Meai.IChatClientchatClient=client;varupdates=newList<Meai.ChatResponseUpdate>();awaitforeach(varupdateinchatClient.GetStreamingResponseAsync([new Meai.ChatMessage(Meai.ChatRole.User, "Count from 1 to 5.")],newMeai.ChatOptions{ModelId=DeepInfraModel})){updates.Add(update);vartext=string.Concat(update.Contents.OfType<Meai.TextContent>().Select(c=>c.Text));if(!string.IsNullOrEmpty(text)){Console.Write(text);}}Console.WriteLine();