latestResponse property

GroqResponse? get latestResponse

Returns the latest response in the conversation

final response = chat.latestResponse;
print(response.choices.first.message); //prints the latest response in the conversation

Implementation

GroqResponse? get latestResponse =>
    _chatItems.whereType<ResponseChatEvent>().lastOrNull?.response;