chat method

  1. @override
Future<ChatResponse> chat(
  1. List<ChatMessage> messages
)
override

Sends a chat request to the provider with a sequence of messages.

messages - The conversation history as a list of chat messages

Returns the provider's response or throws an LLMError

Implementation

@override
Future<ChatResponse> chat(List<ChatMessage> messages) async {
  // Use Responses API if enabled, otherwise use Chat Completions API
  if (config.useResponsesAPI && _responses != null) {
    return _responses.chat(messages);
  } else {
    return _chat.chat(messages);
  }
}