This example assumes using Writer; is in scope and apiKey contains your Writer API key.
1 2 3 4 5 6 7 8 91011121314151617
usingvarclient=newWriterClient(apiKey);Meai.IChatClientchatClient=client;// Stream chat responses using the MEAI IChatClient interface.varenumerable=chatClient.GetStreamingResponseAsync(messages:[newMeai.ChatMessage(Meai.ChatRole.User,"Generate 5 random words.")],newMeai.ChatOptions{ModelId="palmyra-x-004",});vardeltas=newList<string>();awaitforeach(varupdateinenumerable){Console.Write(update.Text);deltas.Add(update.Text??string.Empty);}