FirebaseAILogic Framework Reference

LiveServerContent

@available(iOS 15.0, macOS 12.0, tvOS 15.0, *)
@available(watchOS, unavailable)
public struct LiveServerContent : Sendable

Incremental server update generated by the model in response to client messages.

Content is generated as quickly as possible, and not in realtime. Clients may choose to buffer and play it out in realtime.

  • The content that the model has generated as part of the current conversation with the user.

    This can be nil if the message signifies something else (such as the turn ending).

    Declaration

    Swift

    public var modelTurn: ModelContent? { get }
  • The model has finished sending data in the current turn.

    Generation will only start in response to additional client messages.

    Can be set alongside modelTurn, indicating that the content is the last in the turn.

    Declaration

    Swift

    public var isTurnComplete: Bool { get }
  • The model was interrupted by a client message while generating data.

    If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.

    Declaration

    Swift

    public var wasInterrupted: Bool { get }
  • The model has finished generating data for the current turn.

    For realtime playback, there will be a delay between when the model finishes generating content and the client has finished playing back the generated content. LiveServerContent/isGenerationComplete indicates that the model is done generating data, while isTurnComplete indicates the model is waiting for additional client messages. Sending a message during this delay may cause a wasInterrupted message to be sent.

    Important

    If the model wasInterrupted, this will not be set. The model will go from wasInterrupted -> isTurnComplete.

    Declaration

    Swift

    public var isGenerationComplete: Bool { get }
  • Metadata specifying the sources used to ground generated content.

    Declaration

    Swift

    public var groundingMetadata: GroundingMetadata? { get }
  • The model’s interpretation of what the client said in an audio message.

    This field is only populated when an AudioTranscriptionConfig is provided to the inputAudioTranscription field in LiveGenerationConfig.

    Declaration

    Swift

    public var inputAudioTranscription: LiveAudioTranscription? { get }
  • Transcription matching the model’s audio response.

    This field is only populated when an AudioTranscriptionConfig is provided to the outputAudioTranscription field in LiveGenerationConfig.

    Important

    Transcripts are independent to the model turn. This means transcripts may come earlier or later than when the model sends the corresponding audio responses.

    Declaration

    Swift

    public var outputAudioTranscription: LiveAudioTranscription? { get }