File tree Expand file tree Collapse file tree
core/src/main/java/com/google/adk/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818import static com .google .common .collect .ImmutableList .toImmutableList ;
1919
20+ import com .google .common .base .Ascii ;
2021import com .google .common .collect .ImmutableList ;
2122import com .google .common .collect .ImmutableMap ;
2223import com .google .common .collect .Iterables ;
@@ -128,7 +129,8 @@ public static LlmRequest sanitizeRequestForGeminiApi(LlmRequest llmRequest) {
128129 */
129130 static List <Content > ensureModelResponse (List <Content > contents ) {
130131 // Last content must be from the user, otherwise the model won't respond.
131- if (contents .isEmpty () || !Iterables .getLast (contents ).role ().orElse ("" ).equals ("user" )) {
132+ if (contents .isEmpty ()
133+ || !Ascii .equalsIgnoreCase (Iterables .getLast (contents ).role ().orElse ("" ), "user" )) {
132134 Content userContent =
133135 Content .builder ()
134136 .parts (ImmutableList .of (Part .fromText (CONTINUE_OUTPUT_MESSAGE )))
You can’t perform that action at this time.
0 commit comments