chatStream method

  1. @override
Stream<ChatStreamEvent> chatStream(
  1. List<ChatMessage> messages, {
  2. List<Tool>? tools,
})
override

Sends a streaming chat request to the provider

messages - The conversation history as a list of chat messages tools - Optional list of tools to use in the chat

Returns a stream of chat events

Implementation

@override
Stream<ChatStreamEvent> chatStream(
  List<ChatMessage> messages, {
  List<Tool>? tools,
}) {
  // Use Responses API if enabled, otherwise use Chat Completions API
  if (config.useResponsesAPI && _responses != null) {
    return _responses.chatStream(messages, tools: tools);
  } else {
    return _chat.chatStream(messages, tools: tools);
  }
}