stream method

  1. @override
Future<Stream<StreamingMessage>> stream(
  1. List<LLMMessage> messages, {
  2. List<Tool>? tools,
  3. ToolChoice? toolChoice,
  4. required ModelConfig modelConfig,
  5. bool? jsonOutput,
  6. CancelToken? cancelToken,
})
override

Implementation

@override
Future<Stream<StreamingMessage>> stream(
  List<LLMMessage> messages, {
  List<Tool>? tools,
  ToolChoice? toolChoice,
  required ModelConfig modelConfig,
  bool? jsonOutput,
  CancelToken? cancelToken,
}) async {
  await rateLimitGate.acquire(estimatedTokens: modelConfig.maxTokens ?? 0);
  // NOTE: stream recording is deferred. Streamed runs that need
  // replay should use generate() in eval mode.
  return inner.stream(
    messages,
    tools: tools,
    toolChoice: toolChoice,
    modelConfig: modelConfig,
    jsonOutput: jsonOutput,
    cancelToken: cancelToken,
  );
}