getResponseAsync method

  1. @override
Stream<String?> getResponseAsync({
  1. required String prompt,
})
override

Implementation

@override
Stream<String?> getResponseAsync({required String prompt}) {
  if (llmInference != null) {
    _controller = StreamController<String?>();
    llmInference!.generateResponse(
      prompt,
      allowInterop(streamPartialResults),
    );
    return _controller!.stream;
  } else {
    throw Exception("Gemma is not initialized yet");
  }
}