3333import com .google .genai .types .FunctionResponse ;
3434import com .google .genai .types .GenerateContentResponseUsageMetadata ;
3535import com .google .genai .types .GroundingMetadata ;
36+ import com .google .genai .types .Transcription ;
3637import java .time .Instant ;
3738import java .util .List ;
3839import java .util .Objects ;
4243import org .jspecify .annotations .Nullable ;
4344
4445// TODO - b/413761119 update Agent.java when resolved.
46+
4547/** Represents an event in a session. */
4648@ JsonDeserialize (builder = Event .Builder .class )
4749public class Event extends JsonBaseModel {
@@ -64,6 +66,9 @@ public class Event extends JsonBaseModel {
6466 private @ Nullable GroundingMetadata groundingMetadata ;
6567 private @ Nullable List <CustomMetadata > customMetadata ;
6668 private @ Nullable String modelVersion ;
69+ private @ Nullable Transcription inputTranscription ;
70+ private @ Nullable Transcription outputTranscription ;
71+
6772 private long timestamp ;
6873
6974 private Event () {}
@@ -266,6 +271,32 @@ public void setModelVersion(@Nullable String modelVersion) {
266271 this .modelVersion = modelVersion ;
267272 }
268273
274+ /**
275+ * Input transcription. The transcription is independent to the model turn which means it doesn't
276+ * imply any ordering between transcription and model turn.
277+ */
278+ @ JsonProperty ("inputTranscription" )
279+ public Optional <Transcription > inputTranscription () {
280+ return Optional .ofNullable (inputTranscription );
281+ }
282+
283+ public void setInputTranscription (@ Nullable Transcription inputTranscription ) {
284+ this .inputTranscription = inputTranscription ;
285+ }
286+
287+ /**
288+ * Output transcription. The transcription is independent to the model turn which means it doesn't
289+ * imply any ordering between transcription and model turn.
290+ */
291+ @ JsonProperty ("outputTranscription" )
292+ public Optional <Transcription > outputTranscription () {
293+ return Optional .ofNullable (outputTranscription );
294+ }
295+
296+ public void setOutputTranscription (@ Nullable Transcription outputTranscription ) {
297+ this .outputTranscription = outputTranscription ;
298+ }
299+
269300 /** The timestamp of the event. */
270301 @ JsonProperty ("timestamp" )
271302 public long timestamp () {
@@ -362,6 +393,8 @@ public static class Builder {
362393 private @ Nullable GroundingMetadata groundingMetadata ;
363394 private @ Nullable List <CustomMetadata > customMetadata ;
364395 private @ Nullable String modelVersion ;
396+ private @ Nullable Transcription inputTranscription ;
397+ private @ Nullable Transcription outputTranscription ;
365398 private @ Nullable Long timestamp ;
366399
367400 @ JsonCreator
@@ -520,6 +553,20 @@ public Builder modelVersion(@Nullable String value) {
520553 return this ;
521554 }
522555
556+ @ CanIgnoreReturnValue
557+ @ JsonProperty ("inputTranscription" )
558+ public Builder inputTranscription (@ Nullable Transcription value ) {
559+ this .inputTranscription = value ;
560+ return this ;
561+ }
562+
563+ @ CanIgnoreReturnValue
564+ @ JsonProperty ("outputTranscription" )
565+ public Builder outputTranscription (@ Nullable Transcription value ) {
566+ this .outputTranscription = value ;
567+ return this ;
568+ }
569+
523570 public Event build () {
524571 Event event = new Event ();
525572 event .setId (id );
@@ -541,6 +588,8 @@ public Event build() {
541588 event .setModelVersion (modelVersion );
542589 event .setActions (actions ().orElseGet (() -> EventActions .builder ().build ()));
543590 event .setTimestamp (timestamp ().orElseGet (() -> Instant .now ().toEpochMilli ()));
591+ event .setInputTranscription (inputTranscription );
592+ event .setOutputTranscription (outputTranscription );
544593 return event ;
545594 }
546595 }
@@ -575,7 +624,9 @@ public Builder toBuilder() {
575624 .branch (this .branch )
576625 .groundingMetadata (this .groundingMetadata )
577626 .customMetadata (this .customMetadata )
578- .modelVersion (this .modelVersion );
627+ .modelVersion (this .modelVersion )
628+ .inputTranscription (this .inputTranscription )
629+ .outputTranscription (this .outputTranscription );
579630 if (this .timestamp != 0 ) {
580631 builder .timestamp (this .timestamp );
581632 }
@@ -608,7 +659,9 @@ public boolean equals(Object obj) {
608659 && Objects .equals (branch , other .branch )
609660 && Objects .equals (groundingMetadata , other .groundingMetadata )
610661 && Objects .equals (customMetadata , other .customMetadata )
611- && Objects .equals (modelVersion , other .modelVersion );
662+ && Objects .equals (modelVersion , other .modelVersion )
663+ && Objects .equals (inputTranscription , other .inputTranscription )
664+ && Objects .equals (outputTranscription , other .outputTranscription );
612665 }
613666
614667 @ Override
@@ -637,6 +690,8 @@ public int hashCode() {
637690 groundingMetadata ,
638691 customMetadata ,
639692 modelVersion ,
693+ inputTranscription ,
694+ outputTranscription ,
640695 timestamp );
641696 }
642697}
0 commit comments