Skip to content

Chat Client Get Response Async

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

1
2
3
4
5
6
7
8
9
using var client = GetAuthenticatedOpenAiClient();
Meai.IChatClient chatClient = client;

var response = await chatClient.GetResponseAsync(
    [new Meai.ChatMessage(Meai.ChatRole.User, "Say hello in exactly 3 words.")],
    new Meai.ChatOptions { ModelId = DeepInfraModel });

var text = response.Messages[0].Text;
Console.WriteLine(text);