File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
core/src/main/java/com/google/adk/examples Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,15 @@ private static String convertExamplesToText(List<Example> examples) {
6262 for (int exampleNum = 0 ; exampleNum < examples .size (); exampleNum ++) {
6363 Example example = examples .get (exampleNum );
6464 StringBuilder output = new StringBuilder ();
65- output
66- .append (String .format (EXAMPLE_START , exampleNum + 1 ))
67- .append (USER_PREFIX )
68- .append (example .input ().parts ().get ().get (0 ).text ().get ())
69- .append ("\n \n " );
65+ if (example .input ().parts ().isPresent ()
66+ && !example .input ().parts ().get ().isEmpty ()
67+ && example .input ().parts ().get ().get (0 ).text ().isPresent ()) {
68+ output
69+ .append (String .format (EXAMPLE_START , exampleNum + 1 ))
70+ .append (USER_PREFIX )
71+ .append (example .input ().parts ().get ().get (0 ).text ().get ())
72+ .append ("\n \n " );
73+ }
7074
7175 for (Content content : example .output ()) {
7276 String rolePrefix = content .role ().orElse ("" ).equals ("model" ) ? MODEL_PREFIX : USER_PREFIX ;
You can’t perform that action at this time.
0 commit comments