Skip to content

Commit 5822d9b

Browse files
authored
Merge pull request #425 from dgageot/text-examples
Fix gemini model name (And test all examples)
2 parents 6debf8e + 6037f07 commit 5822d9b

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

examples/bio.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: "2"
33

44
agents:
55
root:
6-
model: gemini/gemini-2.5-flash
6+
model: google/gemini-2.5-flash
77
description: Create a biography of the user based on internet searches.
88
instruction: |
99
Your goal is to present the user with a concise and informative biography based on their online presence.

examples/pirate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ agents:
77
instruction: Always answer by talking like a pirate.
88
model: openai/gpt-4o
99
# model: anthropic/claude-3-5-sonnet-latest
10-
# model: gemini/gemini-2.5-flash
10+
# model: google/gemini-2.5-flash
1111
# model: dmr/ai/llama3.2

pkg/teamloader/teamloader_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package teamloader
22

33
import (
44
"context"
5+
"io/fs"
56
"os"
7+
"path/filepath"
68
"testing"
79

810
"github.com/stretchr/testify/assert"
@@ -94,6 +96,40 @@ func TestCheckRequiredEnvVarsWithModelGateway(t *testing.T) {
9496
require.NoError(t, err)
9597
}
9698

99+
func TestLoadExamples(t *testing.T) {
100+
// Collect the missing env vars.
101+
missingEnvs := map[string]bool{}
102+
103+
for _, file := range collectExamples(t) {
104+
t.Run(file, func(t *testing.T) {
105+
_, err := Load(t.Context(), file, config.RuntimeConfig{})
106+
if err != nil {
107+
envErr := &environment.RequiredEnvError{}
108+
require.ErrorAs(t, err, &envErr)
109+
110+
for _, env := range envErr.Missing {
111+
missingEnvs[env] = true
112+
}
113+
}
114+
})
115+
}
116+
117+
for name := range missingEnvs {
118+
t.Setenv(name, "dummy")
119+
}
120+
121+
// Load all the examples.
122+
for _, file := range collectExamples(t) {
123+
t.Run(file, func(t *testing.T) {
124+
t.Parallel()
125+
126+
teams, err := Load(t.Context(), file, config.RuntimeConfig{})
127+
require.NoError(t, err)
128+
require.NotEmpty(t, teams)
129+
})
130+
}
131+
}
132+
97133
func openRoot(t *testing.T, dir string) *os.Root {
98134
t.Helper()
99135

@@ -103,3 +139,22 @@ func openRoot(t *testing.T, dir string) *os.Root {
103139

104140
return root
105141
}
142+
143+
func collectExamples(t *testing.T) []string {
144+
t.Helper()
145+
146+
var files []string
147+
err := filepath.WalkDir(filepath.Join("..", "..", "examples"), func(path string, d fs.DirEntry, err error) error {
148+
if err != nil {
149+
return err
150+
}
151+
if !d.IsDir() && filepath.Ext(path) == ".yaml" {
152+
files = append(files, path)
153+
}
154+
return nil
155+
})
156+
require.NoError(t, err)
157+
assert.NotEmpty(t, files)
158+
159+
return files
160+
}

0 commit comments

Comments
 (0)