aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/aflow/template_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-15 11:37:02 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-01-19 09:21:15 +0000
commit1276f83b46b38cc241614ebc4401720f5f1fc4ab (patch)
treeedf8e8d9c9ac313d9457cebf678aea9334804f05 /pkg/aflow/template_test.go
parenta9fc52269b8aab60248b6e4c5366216bc2191101 (diff)
pkg/aflow: add ability to generate several candidate replies for LLM agents
Add LLMAgent.Candidates parameter. If set to a value N>1, then the agent is invoked N times, and all outputs become slices. The results can be later aggregated by another agent, as shown in the test.
Diffstat (limited to 'pkg/aflow/template_test.go')
-rw-r--r--pkg/aflow/template_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/aflow/template_test.go b/pkg/aflow/template_test.go
index e42ddd2c3..3b24d62f6 100644
--- a/pkg/aflow/template_test.go
+++ b/pkg/aflow/template_test.go
@@ -44,6 +44,17 @@ func TestTemplate(t *testing.T) {
},
{
template: `
+ {{range $i, $v := .array}}
+ {{$i}} {{$v}}
+ {{end}}
+ `,
+ vars: map[string]reflect.Type{
+ "array": reflect.TypeFor[[]int](),
+ },
+ used: []string{"array"},
+ },
+ {
+ template: `
{{if .bar}}
{{.foo}}
{{end}}