blob: 2e20db3a96a5c90ded0c865a525e5230877b2ea9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package llmutils
import (
"os"
"testing"
"codeberg.org/snonux/hexai/internal/appconfig"
)
func TestNewClientFromApp_Ollama(t *testing.T) {
cfg := appconfig.App{Provider: "ollama"}
c, err := NewClientFromApp(cfg)
if err != nil || c == nil {
t.Fatalf("ollama client failed: %v %v", c, err)
}
}
func TestNewClientFromApp_OpenAI_WithKey(t *testing.T) {
t.Setenv("HEXAI_OPENAI_API_KEY", "test-key")
cfg := appconfig.App{Provider: "openai"}
c, err := NewClientFromApp(cfg)
if err != nil || c == nil {
t.Fatalf("openai client failed: %v %v", c, err)
}
// ensure env override precedence
_ = os.Unsetenv("OPENAI_API_KEY")
}
|