history property

  1. @override
Iterable<ChatMessage> get history
override

Returns an iterable of ChatMessage objects representing the chat history.

This getter provides access to the conversation history maintained by the LLM provider. The history typically includes both user messages and LLM responses in chronological order.

Returns an Iterable of ChatMessage objects.

Implementation

@override
Iterable<ChatMessage> get history => _history;
  1. @override
set history (Iterable<ChatMessage> history)
override

Sets the chat history to the provided messages.

This setter allows updating the conversation history maintained by the LLM provider. The provided history replaces the existing history with a new set of messages.

history is an Iterable of ChatMessage objects representing the new chat history.

Implementation

@override
set history(Iterable<ChatMessage> history) {
  _history
    ..clear()
    ..addAll(history);
  notifyListeners();
}