streamTextAsOpenAI method

Stream<ChatCompletionChunk> streamTextAsOpenAI(
  1. Object prompt, [
  2. GenerateTextOptions? options
])

Stream text with OpenAI Chat Completions output, yielding typed ChatCompletionChunks (RFC-0026).

prompt may be a String or a List<Map<String, dynamic>> of messages. Stream options (include_usage, include_reasoning) are passed via options.providerOptionsopenai.stream_options on the wire.

Implementation

Stream<ChatCompletionChunk> streamTextAsOpenAI(
  Object prompt, [
  GenerateTextOptions? options,
]) {
  return _raw
      .streamTextAsOpenAI(prompt, options?.toJson())
      .map(ChatCompletionChunk.fromJson);
}