File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
core/src/main/java/com/google/adk/events Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -344,9 +344,12 @@ public final String stringifyContent() {
344344 /** Builder for {@link Event}. */
345345 public static class Builder {
346346
347- private String id ;
348- private String invocationId ;
349- private String author ;
347+ private static final String MISSING_INVOCATION_ID = "__adk__invocation__id__missing" ;
348+ private static final String MISSING_AUTHOR = "__adk__author__unknown" ;
349+
350+ private @ Nullable String id ;
351+ private @ Nullable String invocationId ;
352+ private @ Nullable String author ;
350353 private @ Nullable Content content ;
351354 private @ Nullable EventActions actions ;
352355 private @ Nullable Set <String > longRunningToolIds ;
@@ -522,9 +525,9 @@ public Builder modelVersion(@Nullable String value) {
522525
523526 public Event build () {
524527 Event event = new Event ();
525- event .setId (id );
526- event .setInvocationId (invocationId );
527- event .setAuthor (author );
528+ event .setId (Optional . ofNullable ( id ). orElse ( UUID . randomUUID (). toString ()) );
529+ event .setInvocationId (Optional . ofNullable ( invocationId ). orElse ( MISSING_INVOCATION_ID ) );
530+ event .setAuthor (Optional . ofNullable ( author ). orElse ( MISSING_AUTHOR ) );
528531 event .setContent (content );
529532 event .setLongRunningToolIds (longRunningToolIds );
530533 event .setPartial (partial );
You can’t perform that action at this time.
0 commit comments