React Native Firebase
    Preparing search index...

    Represents an active, real-time, bidirectional conversation with the model.

    This class should only be instantiated by calling LiveGenerativeModel.connect.

    Index

    Constructors

    • Internal

      Parameters

      • webSocketHandler: WebSocketHandler
      • serverMessages: AsyncGenerator<unknown>

      Returns LiveSession

    Methods

    • Beta

      Closes this session. All methods on this session will throw an error once this resolves.

      Returns Promise<void>

    • Beta

      Sends content to the server.

      Parameters

      • request: string | (string | Part)[]

        The message to send to the model.

      • turnComplete: boolean = true

        Indicates if the turn is complete. Defaults to false.

      Returns Promise<void>

      If this session has been closed.

    • Beta

      Sends audio data to the server in realtime.

      Parameters

      Returns Promise<void>

      The server requires that the audio data is base64-encoded 16-bit PCM at 16kHz little-endian.

      // const pcmData = ... base64-encoded 16-bit PCM at 16kHz little-endian.
      const blob = { mimeType: "audio/pcm", data: pcmData };
      liveSession.sendAudioRealtime(blob);

      If this session has been closed.

    • Beta

      Sends function responses to the server.

      Parameters

      Returns Promise<void>

      If this session has been closed.

    • Beta

      Sends realtime input to the server.

      Parameters

      Returns Promise<void>

      Use sendTextRealtime(), sendAudioRealtime(), and sendVideoRealtime() instead.

      If this session has been closed.

    • Beta

      Sends text to the server in realtime.

      Parameters

      • text: string

        The text data to send.

      Returns Promise<void>

      liveSession.sendTextRealtime("Hello, how are you?");
      

      If this session has been closed.

    • Beta

      Sends video data to the server in realtime.

      Parameters

      Returns Promise<void>

      The server requires that the video is sent as individual video frames at 1 FPS. It is recommended to set mimeType to image/jpeg.

      // const videoFrame = ... base64-encoded JPEG data
      const blob = { mimeType: "image/jpeg", data: videoFrame };
      liveSession.sendVideoRealtime(blob);

      If this session has been closed.

    Properties

    inConversation: boolean = false

    Indicates whether this Live session is being controlled by an AudioConversationController.

    isClosed: boolean = false

    Indicates whether this Live session is closed.