@@ -227,7 +227,7 @@ public void call_withInputAndOutputSchema_successful() throws Exception {
227227 }
228228
229229 @ Test
230- public void call_withoutSchema_returnsFirstTextPartFromLastEvent () throws Exception {
230+ public void call_withoutSchema_returnsConcatenatedTextFromLastEvent () throws Exception {
231231 LlmAgent testAgent =
232232 createTestAgentBuilder (
233233 createTestLlm (
@@ -240,8 +240,8 @@ public void call_withoutSchema_returnsFirstTextPartFromLastEvent() throws Except
240240 LlmResponse .builder ()
241241 .content (
242242 Content .fromParts (
243- Part .fromText ("First text part is returned " ),
244- Part .fromText ("This should be ignored " )))
243+ Part .fromText ("First text part. " ),
244+ Part .fromText ("Second text part. " )))
245245 .build ())))
246246 .name ("agent name" )
247247 .description ("agent description" )
@@ -252,7 +252,31 @@ public void call_withoutSchema_returnsFirstTextPartFromLastEvent() throws Except
252252 Map <String , Object > result =
253253 agentTool .runAsync (ImmutableMap .of ("request" , "magic" ), toolContext ).blockingGet ();
254254
255- assertThat (result ).containsExactly ("result" , "First text part is returned" );
255+ assertThat (result ).containsExactly ("result" , "First text part. Second text part." );
256+ }
257+
258+ @ Test
259+ public void call_withThoughts_returnsOnlyNonThoughtText () throws Exception {
260+ TestLlm testLlm =
261+ createTestLlm (
262+ LlmResponse .builder ()
263+ .content (
264+ Content .builder ()
265+ .parts (
266+ Part .fromText ("Non-thought text 1. " ),
267+ Part .builder ().text ("This is a thought." ).thought (true ).build (),
268+ Part .fromText ("Non-thought text 2." ))
269+ .build ())
270+ .build ());
271+ LlmAgent testAgent =
272+ createTestAgentBuilder (testLlm ).name ("agent name" ).description ("agent description" ).build ();
273+ AgentTool agentTool = AgentTool .create (testAgent );
274+ ToolContext toolContext = createToolContext (testAgent );
275+
276+ Map <String , Object > result =
277+ agentTool .runAsync (ImmutableMap .of ("request" , "test" ), toolContext ).blockingGet ();
278+
279+ assertThat (result ).containsExactly ("result" , "Non-thought text 1. Non-thought text 2." );
256280 }
257281
258282 @ Test
0 commit comments