From f65e58bd73ea33b38d5fe43c897b01216ac34ac6 Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Wed, 21 Jan 2026 11:23:10 -0800 Subject: [PATCH] feat: HITL - Revert the "Boolean confirmation" changes, we'll fix it differently PiperOrigin-RevId: 859186246 --- ...equestConfirmationLlmRequestProcessor.java | 15 +----- ...stConfirmationLlmRequestProcessorTest.java | 47 +------------------ 2 files changed, 3 insertions(+), 59 deletions(-) diff --git a/core/src/main/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessor.java b/core/src/main/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessor.java index 6f6c778d7..5008718bf 100644 --- a/core/src/main/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessor.java +++ b/core/src/main/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessor.java @@ -42,7 +42,6 @@ import io.reactivex.rxjava3.core.Single; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -110,8 +109,8 @@ public Single processRequest( continue; } - final Map toolsToResumeWithConfirmation = new HashMap<>(); - final Map toolsToResumeWithArgs = new HashMap<>(); + Map toolsToResumeWithConfirmation = new HashMap<>(); + Map toolsToResumeWithArgs = new HashMap<>(); event.functionCalls().stream() .filter( @@ -164,16 +163,6 @@ public Single processRequest( // Create an updated LlmRequest including the new event's content ImmutableList.Builder updatedContentsBuilder = ImmutableList.builder().addAll(llmRequest.contents()); - - final List functionCalls = - toolsToResumeWithArgs.values().stream() - .map(functionCall -> Part.builder().functionCall(functionCall).build()) - .collect(toImmutableList()); - Content functionCallContent = - Content.builder().role("model").parts(functionCalls).build(); - // add function call - updatedContentsBuilder.add(functionCallContent); - // add function response assembledEvent.content().ifPresent(updatedContentsBuilder::add); LlmRequest updatedLlmRequest = diff --git a/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java b/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java index 931886b50..b93e02edb 100644 --- a/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java +++ b/core/src/test/java/com/google/adk/flows/llmflows/RequestConfirmationLlmRequestProcessorTest.java @@ -97,48 +97,11 @@ public class RequestConfirmationLlmRequestProcessorTest { .build())) .build(); - private static final Event FUNCTION_CALL_EVENT = - Event.builder() - .author("model") - .content( - Content.builder() - .role("model") - .parts( - Part.builder() - .functionCall( - FunctionCall.builder() - .id(ORIGINAL_FUNCTION_CALL_ID) - .name(ECHO_TOOL_NAME) - .args(ImmutableMap.of("say", "hello")) - .build()) - .build()) - .build()) - .build(); - - private static final Event FUNCTION_RESPONSE_EVENT = - Event.builder() - .author("user") - .content( - Content.builder() - .role("user") - .parts( - Part.builder() - .functionResponse( - FunctionResponse.builder() - .id(ORIGINAL_FUNCTION_CALL_ID) - .name(ECHO_TOOL_NAME) - .response( - ImmutableMap.of("result", ImmutableMap.of("say", "hello"))) - .build()) - .build()) - .build()) - .build(); - private static final RequestConfirmationLlmRequestProcessor processor = new RequestConfirmationLlmRequestProcessor(); @Test - public void runAsync_withConfirmation_callsOriginalFunctionAndAppendsToUpdatedRequest() { + public void runAsync_withConfirmation_callsOriginalFunction() { LlmAgent agent = createAgentWithEchoTool(); Session session = Session.builder("session_id") @@ -158,14 +121,6 @@ public void runAsync_withConfirmation_callsOriginalFunctionAndAppendsToUpdatedRe assertThat(fr.id()).hasValue(ORIGINAL_FUNCTION_CALL_ID); assertThat(fr.name()).hasValue(ECHO_TOOL_NAME); assertThat(fr.response()).hasValue(ImmutableMap.of("result", ORIGINAL_FUNCTION_CALL_ARGS)); - assertThat(result.updatedRequest()) - .isEqualTo( - LlmRequest.builder() - .contents( - ImmutableList.of( - FUNCTION_CALL_EVENT.content().get(), - FUNCTION_RESPONSE_EVENT.content().get())) - .build()); } @Test