llm_test.go 1008 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
//go:build integration

package integration

import (
	"context"
	"testing"
	"time"

10
	"github.com/ollama/ollama/api"
11
12
13
14
15
16
17
18
19
)

// TODO - this would ideally be in the llm package, but that would require some refactoring of interfaces in the server
//        package to avoid circular dependencies

var (
	stream = false
	req    = [2]api.GenerateRequest{
		{
20
			Model:  smol,
21
22
			Prompt: "why is the ocean blue?",
			Stream: &stream,
23
			Options: map[string]any{
24
25
26
27
				"seed":        42,
				"temperature": 0.0,
			},
		}, {
28
			Model:  smol,
29
30
			Prompt: "what is the origin of the us thanksgiving holiday?",
			Stream: &stream,
31
			Options: map[string]any{
32
33
34
35
36
				"seed":        42,
				"temperature": 0.0,
			},
		},
	}
37
	resp = [2][]string{
38
		{"sunlight", "scattering", "interact"},
Michael Yang's avatar
Michael Yang committed
39
		{"england", "english", "massachusetts", "pilgrims"},
40
41
42
	}
)

43
func TestIntegrationSimple(t *testing.T) {
44
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
45
	defer cancel()
Daniel Hiltgen's avatar
Daniel Hiltgen committed
46
	GenerateTestHelper(ctx, t, req[0], resp[0])
47
}