LiveServerContent

@PublicPreviewAPI
public final class LiveServerContent implements LiveServerMessage


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

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

Summary

Public fields

final Content

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

final boolean

The model has finished generating data for the current turn.

final boolean

The model was interrupted by the client while generating data.

final boolean

The model has finished sending data in the current turn.

Public constructors

LiveServerContent(
    Content content,
    boolean interrupted,
    boolean turnComplete,
    boolean generationComplete
)

Public fields

content

public final Content content

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

This can be null if there is no content.

generationComplete

public final boolean generationComplete

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. generationComplete indicates that the model is done generating data, while turnComplete indicates the model is waiting for additional client messages. Sending a message during this delay may cause an interrupted message to be sent.

Note that if the model was interrupted, this will not be set. The model will go from interrupted ->turnComplete.

interrupted

public final boolean interrupted

The model was interrupted by the client while generating data.

An interruption occurs when the client sends a message while the model is actively sending data.

turnComplete

public final boolean turnComplete

The model has finished sending data in the current turn.

Generation will only start in response to additional client messages.

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

Public constructors

LiveServerContent

public LiveServerContent(
    Content content,
    boolean interrupted,
    boolean turnComplete,
    boolean generationComplete
)