connect method

Future<LiveSession> connect({
  1. SessionResumptionConfig? sessionResumption,
})

Establishes a connection to a live generation service.

sessionResumption starts a resumable session, or resumes one when it was created with SessionResumptionConfig.resume.

Implementation

Future<LiveSession> connect(
    {SessionResumptionConfig? sessionResumption}) async {
  final config = _liveGenerationConfig;
  if (config?.presencePenalty != null || config?.frequencyPenalty != null) {
    debugPrint('gemini_live: LiveGenerationConfig.presencePenalty and '
        'frequencyPenalty are not sent to the server yet and are ignored.');
  }
  final session = LiveSession._(this);
  await session._open(sessionResumption);
  return session;
}