Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ public Completable sendContent(Content content) {
.build());
} else {
return sendClientContentInternal(
LiveSendClientContentParameters.builder().turns(ImmutableList.of(content)).build());
LiveSendClientContentParameters.builder()
.turns(ImmutableList.of(content))
.turnComplete(true)
.build());
}
}

Expand Down
15 changes: 10 additions & 5 deletions core/src/main/java/com/google/adk/tools/BaseTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.genai.types.FunctionDeclaration;
import com.google.genai.types.GenerateContentConfig;
import com.google.genai.types.LiveConnectConfig;
import com.google.genai.types.Tool;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Single;
Expand Down Expand Up @@ -110,19 +111,23 @@ public Completable processLlmRequest(
.build())
.build();
}
ImmutableList<Tool> newTools =
new ImmutableList.Builder<Tool>()
.addAll(toolsWithoutFunctionDeclarations)
.add(toolWithFunctionDeclarations)
.build();
// Patch the GenerateContentConfig with the new tool definition.
GenerateContentConfig generateContentConfig =
llmRequest
.config()
.map(GenerateContentConfig::toBuilder)
.orElse(GenerateContentConfig.builder())
.tools(
new ImmutableList.Builder<Tool>()
.addAll(toolsWithoutFunctionDeclarations)
.add(toolWithFunctionDeclarations)
.build())
.tools(newTools)
.build();
LiveConnectConfig liveConnectConfig =
llmRequest.liveConnectConfig().toBuilder().tools(newTools).build();
llmRequestBuilder.config(generateContentConfig);
llmRequestBuilder.liveConnectConfig(liveConnectConfig);
return Completable.complete();
}

Expand Down