diff --git a/java/dev/enola/ai/dotagent/AgentsLoaderIntegrationTest.java b/java/dev/enola/ai/dotagent/AgentsLoaderIntegrationTest.java index 0fc9b53a0..861fe1bb6 100644 --- a/java/dev/enola/ai/dotagent/AgentsLoaderIntegrationTest.java +++ b/java/dev/enola/ai/dotagent/AgentsLoaderIntegrationTest.java @@ -22,10 +22,12 @@ import static dev.enola.ai.iri.GoogleModelProvider.*; import com.google.adk.agents.BaseAgent; +import com.google.adk.models.BaseLlm; import dev.enola.ai.adk.iri.GoogleLlmProvider; import dev.enola.ai.adk.test.AgentTester; import dev.enola.ai.adk.tool.Tools; +import dev.enola.ai.iri.Provider; import dev.enola.common.context.testlib.SingletonRule; import dev.enola.common.io.mediatype.MediaTypeProviders; import dev.enola.common.io.mediatype.StandardMediaTypes; @@ -50,15 +52,20 @@ public class AgentsLoaderIntegrationTest { SingletonRule.$(MediaTypeProviders.set(new YamlMediaType(), new StandardMediaTypes())); final SecretManager secretManager = new TestSecretManager(); + final Provider llmProvider = new GoogleLlmProvider(secretManager); final ResourceProvider rp = new ClasspathResource.Provider("agents"); + @Test + public void optimisticChefYAML_() throws IOException { + var yamlTester = new AgentsTester(rp, FLASH_LITE, llmProvider, Tools.none()); + yamlTester.test("chef-optimist.agent.yaml"); + } + @Test public void optimisticChefYAML() throws IOException { if (secretManager.getOptional(GOOGLE_AI_API_KEY_SECRET_NAME).isEmpty()) return; // We must create the AgentsLoader AFTER we know that the API secret is available: - var loader = - new AgentsLoader( - rp, FLASH_LITE, new GoogleLlmProvider(secretManager), Tools.none()); + var loader = new AgentsLoader(rp, FLASH_LITE, llmProvider, Tools.none()); var agent = load(loader, "chef-optimist.agent.yaml"); var agentTester = new AgentTester(agent); @@ -81,7 +88,7 @@ public void clock() throws IOException { var tools = Tools.builtin(testInstantSource); if (secretManager.getOptional(GOOGLE_AI_API_KEY_SECRET_NAME).isEmpty()) return; - var loader = new AgentsLoader(rp, FLASH_LITE, new GoogleLlmProvider(secretManager), tools); + var loader = new AgentsLoader(rp, FLASH_LITE, llmProvider, tools); var agent = load(loader, "clock.agent.yaml"); var agentTester = new AgentTester(agent); @@ -96,8 +103,7 @@ public void clock() throws IOException { @Test public void person() throws IOException { if (secretManager.getOptional(GOOGLE_AI_API_KEY_SECRET_NAME).isEmpty()) return; - var loader = - new AgentsLoader(rp, FLASH, new GoogleLlmProvider(secretManager), Tools.none()); + var loader = new AgentsLoader(rp, FLASH, llmProvider, Tools.none()); var agent = load(loader, "person.agent.yaml"); var agentTester = new AgentTester(agent); agentTester.assertJsonResponseEquals( diff --git a/java/dev/enola/ai/dotagent/AgentsTester.java b/java/dev/enola/ai/dotagent/AgentsTester.java new file mode 100644 index 000000000..356bac54d --- /dev/null +++ b/java/dev/enola/ai/dotagent/AgentsTester.java @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2025 The Enola Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dev.enola.ai.dotagent; + +import com.google.adk.models.BaseLlm; + +import dev.enola.ai.adk.tool.ToolsetProvider; +import dev.enola.ai.iri.Provider; +import dev.enola.common.io.resource.ResourceProvider; + +import java.io.IOException; +import java.net.URI; +import java.util.stream.Stream; + +public class AgentsTester { + + public AgentsTester( + ResourceProvider resourceProvider, + URI defaultLLM, + Provider llmProvider, + ToolsetProvider toolsProvider) {} + + public void test(String url) throws IOException { + test(Stream.of(URI.create(url))); + } + + public void test(Stream urls) throws IOException {} +} diff --git a/test/agents/chef-optimist.agent.yaml b/test/agents/chef-optimist.agent.yaml index 84a9b905b..b469969eb 100644 --- a/test/agents/chef-optimist.agent.yaml +++ b/test/agents/chef-optimist.agent.yaml @@ -4,3 +4,6 @@ instruction: every dish as a masterpiece in the making. Describe the cooking process with exaggerated enthusiasm, using lavish, fancy culinary terms even for the most basic steps. Every step is a celebration, and every flavor is a revelation. Your tone should be bright, inspiring, and utterly joyful. +tests: + - prompt: How to make scrambled eggs? + replyContainsAny: [darling, epiphany, odyssey, sunshine, symphony, precious, jewels, bliss]