diff --git a/core/src/main/java/com/google/adk/skills/AbstractSkillSource.java b/core/src/main/java/com/google/adk/skills/AbstractSkillSource.java index 31f17a18e..4bb687470 100644 --- a/core/src/main/java/com/google/adk/skills/AbstractSkillSource.java +++ b/core/src/main/java/com/google/adk/skills/AbstractSkillSource.java @@ -44,7 +44,7 @@ public abstract class AbstractSkillSource implements SkillSource { private static final ObjectMapper yamlMapper = new ObjectMapper(new YAMLFactory()); /** A container class that holds a skill's name and the path to its SKILL.md file. */ - protected final class SkillMdPath { + public static final class SkillMdPath { private final String name; private final PathT mdPath; @@ -55,8 +55,7 @@ protected final class SkillMdPath { * @param name the name of the skill * @param mdPath the path to the SKILL.md file */ - @SuppressWarnings("ProtectedMembersInFinalClass") - protected SkillMdPath(String name, PathT mdPath) { + public SkillMdPath(String name, PathT mdPath) { this.name = name; this.mdPath = mdPath; } @@ -127,7 +126,7 @@ public InputStream openStream() throws IOException { /** * Returns a {@link Flowable} of skills as a pair of skill name and the path to the SKILL.md file. */ - protected abstract Flowable listSkills(); + protected abstract Flowable> listSkills(); /** Returns the path to the SKILL.md file for the given skill. */ protected abstract Single findSkillMdPath(String skillName); diff --git a/core/src/main/java/com/google/adk/skills/LocalSkillSource.java b/core/src/main/java/com/google/adk/skills/LocalSkillSource.java index b4b7d4876..4eafa4d5f 100644 --- a/core/src/main/java/com/google/adk/skills/LocalSkillSource.java +++ b/core/src/main/java/com/google/adk/skills/LocalSkillSource.java @@ -80,7 +80,7 @@ public Single> listResources(String skillName, String reso @Override @SuppressWarnings("StreamResourceLeak") - protected Flowable listSkills() { + protected Flowable> listSkills() { return Flowable.using(() -> Files.list(skillsBasePath), Flowable::fromStream, Stream::close) .onErrorResumeNext( t -> @@ -91,7 +91,7 @@ protected Flowable listSkills() { t))) .filter(Files::isDirectory) .mapOptional(this::findSkillMd) - .map(skillMd -> new SkillMdPath(skillMd.getParent().getFileName().toString(), skillMd)); + .map(skillMd -> new SkillMdPath<>(skillMd.getParent().getFileName().toString(), skillMd)); } @Override diff --git a/core/src/test/java/com/google/adk/tools/streaming/StreamingToolTest.java b/core/src/test/java/com/google/adk/tools/streaming/StreamingToolTest.java index c28aca686..067f33436 100644 --- a/core/src/test/java/com/google/adk/tools/streaming/StreamingToolTest.java +++ b/core/src/test/java/com/google/adk/tools/streaming/StreamingToolTest.java @@ -492,6 +492,10 @@ public void runLive_streamingTool_responsesAreSentAsUserContentToLlm() throws Ex List resEvents = runner.runLive(session, liveRequestQueue, BIDI_STREAMING_RUN_CONFIG).toList().blockingGet(); + // Wait for the tool to send its 3 results back to the LLM + assertThat(testLlm.waitForStreamingToolResults("monitorStockPrice", 3, Duration.ofSeconds(20))) + .isTrue(); + assertThat(resEvents).isNotNull(); assertThat(resEvents).isNotEmpty();