addMessageWithoutSending method

void addMessageWithoutSending(
  1. String prompt, {
  2. GroqMessageRole role = GroqMessageRole.assistant,
})

Adds a new message to the chat without sending it to the model or expecting a response. This is useful for assistant messages or passive instructions to the model. prompt the message content role the message role, usually assistant Example:

chat.addMessageWithoutSending('You are a chatbot for a software support service.', role: GroqMessageRole.assistant);

Implementation

void addMessageWithoutSending(
  String prompt, {
  GroqMessageRole role = GroqMessageRole.assistant,
}) {
  final request = GroqMessage(content: prompt, role: role);
  _chatItems.add(RequestChatEvent(request));
  _conversationItems.add(GroqConversationItem(_model, request));
}