File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
core/src/main/java/com/google/adk Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,10 @@ public Completable sendContent(Content content) {
206206 .build ());
207207 } else {
208208 return sendClientContentInternal (
209- LiveSendClientContentParameters .builder ().turns (ImmutableList .of (content )).build ());
209+ LiveSendClientContentParameters .builder ()
210+ .turns (ImmutableList .of (content ))
211+ .turnComplete (true )
212+ .build ());
210213 }
211214 }
212215
Original file line number Diff line number Diff line change 2323import com .google .errorprone .annotations .CanIgnoreReturnValue ;
2424import com .google .genai .types .FunctionDeclaration ;
2525import com .google .genai .types .GenerateContentConfig ;
26+ import com .google .genai .types .LiveConnectConfig ;
2627import com .google .genai .types .Tool ;
2728import io .reactivex .rxjava3 .core .Completable ;
2829import io .reactivex .rxjava3 .core .Single ;
@@ -110,19 +111,23 @@ public Completable processLlmRequest(
110111 .build ())
111112 .build ();
112113 }
114+ ImmutableList <Tool > newTools =
115+ new ImmutableList .Builder <Tool >()
116+ .addAll (toolsWithoutFunctionDeclarations )
117+ .add (toolWithFunctionDeclarations )
118+ .build ();
113119 // Patch the GenerateContentConfig with the new tool definition.
114120 GenerateContentConfig generateContentConfig =
115121 llmRequest
116122 .config ()
117123 .map (GenerateContentConfig ::toBuilder )
118124 .orElse (GenerateContentConfig .builder ())
119- .tools (
120- new ImmutableList .Builder <Tool >()
121- .addAll (toolsWithoutFunctionDeclarations )
122- .add (toolWithFunctionDeclarations )
123- .build ())
125+ .tools (newTools )
124126 .build ();
127+ LiveConnectConfig liveConnectConfig =
128+ llmRequest .liveConnectConfig ().toBuilder ().tools (newTools ).build ();
125129 llmRequestBuilder .config (generateContentConfig );
130+ llmRequestBuilder .liveConnectConfig (liveConnectConfig );
126131 return Completable .complete ();
127132 }
128133
You can’t perform that action at this time.
0 commit comments