use options

This commit is contained in:
mudler
2024-04-01 20:02:25 +02:00
parent b45490e84d
commit 7c679ead94
3 changed files with 61 additions and 34 deletions

View File

@@ -61,7 +61,12 @@ var _ = Describe("Agent test", func() {
Expect(err).ToNot(HaveOccurred())
go agent.Run()
defer agent.Stop()
res := agent.Ask("can you get the weather in boston, and afterward of Milano, Italy?", "")
res := agent.Ask(
WithReasoningCallback(func(a Action, ap action.ActionParams, s string) {
fmt.Println("Reasoning", s)
}),
WithText("can you get the weather in boston, and afterward of Milano, Italy?"),
)
Expect(res).To(ContainElement(testActionResult), fmt.Sprint(res))
Expect(res).To(ContainElement(testActionResult2), fmt.Sprint(res))
})
@@ -75,7 +80,9 @@ var _ = Describe("Agent test", func() {
Expect(err).ToNot(HaveOccurred())
go agent.Run()
defer agent.Stop()
res := agent.Ask("can you get the weather in boston?", "")
res := agent.Ask(
WithText("can you get the weather in boston?"),
)
Expect(res).To(ContainElement(testActionResult), fmt.Sprint(res))
})
})