From 69f047ed62f8ddc711f2ecea54c72d4e6f6b6b52 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 21 Apr 2025 22:24:12 +0200 Subject: [PATCH] fix: simplify tests to run faster Signed-off-by: Ettore Di Giacinto --- core/agent/agent_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/agent/agent_test.go b/core/agent/agent_test.go index 2f06c30..0b80945 100644 --- a/core/agent/agent_test.go +++ b/core/agent/agent_test.go @@ -226,7 +226,10 @@ var _ = Describe("Agent test", func() { WithLLMAPIKey(apiKeyURL), WithTimeout("10m"), WithActions( - actions.NewSearch(map[string]string{}), + &TestAction{response: map[string]string{ + "boston": testActionResult, + "milan": testActionResult2, + }}, ), EnablePlanning, EnableForceReasoning, @@ -238,18 +241,21 @@ var _ = Describe("Agent test", func() { defer agent.Stop() result := agent.Ask( - types.WithText("Thoroughly plan a trip to San Francisco from Venice, Italy; check flight times, visa requirements and whether electrical items are allowed in cabin luggage."), + types.WithText("Use the plan tool to do two actions in sequence: search for the weather in boston and search for the weather in milan"), ) Expect(len(result.State)).To(BeNumerically(">", 1)) actionsExecuted := []string{} + actionResults := []string{} for _, r := range result.State { xlog.Info(r.Result) actionsExecuted = append(actionsExecuted, r.Action.Definition().Name.String()) + actionResults = append(actionResults, r.ActionResult.Result) } - Expect(actionsExecuted).To(ContainElement("search_internet"), fmt.Sprint(result)) + Expect(actionsExecuted).To(ContainElement("get_weather"), fmt.Sprint(result)) Expect(actionsExecuted).To(ContainElement("plan"), fmt.Sprint(result)) - + Expect(actionResults).To(ContainElement(testActionResult), fmt.Sprint(result)) + Expect(actionResults).To(ContainElement(testActionResult2), fmt.Sprint(result)) }) It("Can initiate conversations", func() {