llm_service.dart 815 B

1234567891011121314151617181920212223
  1. import 'dart:async';
  2. import 'package:flutter/foundation.dart';
  3. /// An abstract class that defines the contract for a live, bidirectional
  4. /// conversational AI service.
  5. abstract class LLMService {
  6. /// Notifier that broadcasts the current connection status of the service.
  7. /// `true` if connected, `false` otherwise.
  8. ValueNotifier<bool> get connectionStatus;
  9. /// A stream that emits audio data received from the AI model.
  10. Stream<Uint8List> get onAudioReceived;
  11. /// Initiates a connection to the AI service.
  12. Future<void> connect();
  13. /// Sends a continuous stream of audio data to the AI model.
  14. /// The AI model will send back audio responses via `onAudioReceived`.
  15. void sendAudioStream(Stream<Uint8List> audioStream);
  16. /// Closes the connection and releases all resources.
  17. void dispose();
  18. }