Skip to content

Chat Client Get Response

This example assumes using Writer; is in scope and apiKey contains your Writer API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
using var client = new WriterClient(apiKey);
Meai.IChatClient chatClient = client;

// Use the MEAI IChatClient interface for chat completions.
var response = await chatClient.GetResponseAsync(
    messages: [new Meai.ChatMessage(Meai.ChatRole.User, "Generate 5 random words.")],
    new Meai.ChatOptions
    {
        ModelId = "palmyra-x-004",
    });

Console.WriteLine(response.Text);