generateStream method

  1. @override
Stream<String> generateStream(
  1. String prompt, {
  2. Iterable<Attachment> attachments = const [],
})
override

Generates a stream of text based on the given prompt and attachments. This method does not interact with a chat or build on any chat history.

prompt is the input text to generate a response for. attachments is an optional iterable of Attachment objects to include with the prompt. These can be images, files, or links that provide additional context for the LLM.

Returns a Stream of String containing the generated text chunks. This allows for streaming responses as they are generated by the LLM.

Implementation

@override
Stream<String> generateStream(
  String prompt, {
  Iterable<Attachment> attachments = const [],
}) {
  return _runMessage(_toAgentMessage(prompt, attachments));
}