-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
53 lines (44 loc) · 1.03 KB
/
types.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package ollamafarm
import (
"net/http"
"net/url"
"sync"
"time"
"github.com/ollama/ollama/api"
)
// Farm manages multiple Ollamas.
type Farm struct {
ollamas map[string]*Ollama
options *Options
mu sync.RWMutex
}
// Ollama stores information about an Ollama server.
type Ollama struct {
name string
url *url.URL
client *api.Client
farm *Farm
models map[string]*api.ListModelResponse
properties Properties
}
// Options defines the options for an Farm.
type Options struct {
// Client is the HTTP client used to make requests.
Client *http.Client
// Heartbeat is the time-to-live for online/offline detection. Default: 5 seconds
Heartbeat time.Duration
// ModelsTTL is the time-to-live for the models cache. Default: 30 seconds
ModelsTTL time.Duration
}
// Properties defines the properties of an Ollama client.
type Properties struct {
Group string
Offline bool
Priority int
}
// Where defines the selection criteria for Ollama clients.
type Where struct {
Group string
Model string
Offline bool
}