Chat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
using var client = new GroqClient(apiKey);
IList<ChatCompletionRequestMessage> messages = [ 
    new ChatCompletionRequestUserMessage {
        Role = ChatCompletionRequestUserMessageRole.User,
        Content = "Generate five random words."
    }];
CreateChatCompletionRequest request = new() { 
    Messages = messages, 
    Model = CreateChatCompletionRequestModel.Llama370b8192
};
var response = await client.Chat.CreateChatCompletionAsync(request);
Assert.IsNotNull(response);
Console.WriteLine(response.Choices[0].Message.Content);