Class LiveServerContent
-
- All Implemented Interfaces:
public abstract class LiveServerContent extends JsonSerializable
Incremental server update generated by the model in response to client messages.
Content is generated as quickly as possible, and not in real time. Clients may choose to buffer and play it out in real time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classLiveServerContent.BuilderBuilder for LiveServerContent.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description LiveServerContent()
-
Method Summary
Modifier and Type Method Description abstract Optional<Content>modelTurn()The content that the model has generated as part of the current conversation with the user. abstract Optional<Boolean>turnComplete()If true, indicates that the model is done generating. abstract Optional<Boolean>interrupted()If true, indicates that a client message has interrupted current model generation. abstract Optional<GroundingMetadata>groundingMetadata()Metadata returned to client when grounding is enabled. abstract Optional<Boolean>generationComplete()If true, indicates that the model is done generating. abstract Optional<Transcription>inputTranscription()Input transcription. abstract Optional<Transcription>outputTranscription()Output transcription. abstract Optional<UrlContextMetadata>urlContextMetadata()Metadata related to url context retrieval tool. abstract Optional<TurnCompleteReason>turnCompleteReason()Reason for the turn is complete. abstract Optional<Boolean>waitingForInput()If true, indicates that the model is not generating content because it is waiting for more input from the user, e.g. static LiveServerContent.Builderbuilder()Instantiates a builder for LiveServerContent. abstract LiveServerContent.BuildertoBuilder()Creates a builder with the same values as this instance. static LiveServerContentfromJson(String jsonString)Deserializes a JSON string to a LiveServerContent object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
modelTurn
abstract Optional<Content> modelTurn()
The content that the model has generated as part of the current conversation with the user.
-
turnComplete
abstract Optional<Boolean> turnComplete()
If true, indicates that the model is done generating. 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.
-
interrupted
abstract Optional<Boolean> interrupted()
If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.
-
groundingMetadata
abstract Optional<GroundingMetadata> groundingMetadata()
Metadata returned to client when grounding is enabled.
-
generationComplete
abstract Optional<Boolean> generationComplete()
If true, indicates that the model is done generating. When model is interrupted while generating there will be no generation_complete message in interrupted turn, it will go through interrupted >turn_complete. When model assumes realtime playback there will be delay between generation_complete and turn_complete that is caused by model waiting for playback to finish. If true, indicates that the model has finished generating all content. This is a signal to the client that it can stop sending messages.
-
inputTranscription
abstract Optional<Transcription> inputTranscription()
Input transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.
-
outputTranscription
abstract Optional<Transcription> outputTranscription()
Output transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.
-
urlContextMetadata
abstract Optional<UrlContextMetadata> urlContextMetadata()
Metadata related to url context retrieval tool.
-
turnCompleteReason
abstract Optional<TurnCompleteReason> turnCompleteReason()
Reason for the turn is complete.
-
waitingForInput
abstract Optional<Boolean> waitingForInput()
If true, indicates that the model is not generating content because it is waiting for more input from the user, e.g. because it expects the user to continue talking.
-
builder
static LiveServerContent.Builder builder()
Instantiates a builder for LiveServerContent.
-
toBuilder
abstract LiveServerContent.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static LiveServerContent fromJson(String jsonString)
Deserializes a JSON string to a LiveServerContent object.
-
-
-
-