generateContent method

Stream<String> generateContent(
  1. String sessionId,
  2. String prompt, {
  3. EdgeGenAIGenerationOptions? options,
  4. bool useMemory = false,
  5. Uint8List? image,
  6. List<EdgeGenAITool> tools = const [],
})

Sends prompt (and, optionally, image) to the on-device model and streams its generated text.

Each event is the full response text generated so far, not just the newly-added chunk.

sessionId identifies the calling EdgeGenAIPrompt instance so each instance keeps its own isolated conversation. By default, this is a stateless one-off call. Pass useMemory as true to remember (and build on) prior useMemory calls from the same sessionId; use resetConversation to start that remembered conversation over.

tools are functions the model may call while generating; their Dart implementations run in this isolate when it does.

Implementation

Stream<String> generateContent(
  String sessionId,
  String prompt, {
  EdgeGenAIGenerationOptions? options,
  bool useMemory = false,
  Uint8List? image,
  List<EdgeGenAITool> tools = const [],
}) {
  throw UnimplementedError('generateContent() has not been implemented.');
}