sendMessage method

  1. @override
Future<ChatResponse> sendMessage(
  1. String message, {
  2. List<ChatMessage>? history,
  3. Map<String, dynamic>? parameters,
})
override

Sends a single message and returns the model's reply.

Pass history to give the model prior conversation context. Throws StateError if the provider is not initialised.

Implementation

@override
Future<ChatResponse> sendMessage(
  String message, {
  List<ChatMessage>? history,
  Map<String, dynamic>? parameters,
}) {
  checkInitialized();
  return sendChatMessages([
    ...?history,
    ChatMessage.user(message),
  ], parameters: parameters);
}