-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
90 lines (73 loc) · 2.38 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package ollamaprovider
type ProviderActionResponse struct {
Ok interface{} `msgpack:"Ok,omitempty"`
Err *StatusError `msgpack:"Err,omitempty"`
}
type StatusError struct {
StatusCode int `msgpack:"statusCode"`
Status string `msgpack:"status"`
Error string `msgpack:"error"`
}
type ChatRequest struct {
Model string `msgpack:"model"`
Messages []Message `msgpack:"messages"`
Stream *bool `msgpack:"withStream"`
Format string `msgpack:"format"`
Options []OptionKV `msgpack:"options"`
}
type OptionKV struct {
_msgpack struct{} `msgpack:",as_array"`
Key string
Value string
}
type Message struct {
Role string `msgpack:"role"` // one of ["system", "user", "assistant"]
Content string `msgpack:"content"`
}
type ChatResponse struct {
Model string `msgpack:"model"`
CreatedAt uint64 `msgpack:"createdAt"`
Message Message `msgpack:"message"`
Done bool `msgpack:"done"`
Metrics `msgpack:",inline"`
}
type Metrics struct {
TotalDuration uint64 `msgpack:"totalDuration"`
LoadDuration uint64 `msgpack:"loadDuration"`
PromptEvalCount uint32 `msgpack:"promptEvalCount"`
PromptEvalDuration uint64 `msgpack:"promptEvalDuration"`
EvalCount uint32 `msgpack:"evalCount"`
EvalDuration uint64 `msgpack:"evalDuration"`
}
type ShowRequest struct {
Name string `msgpack:"name"`
Model string `msgpack:"model"`
System string `msgpack:"system"`
Template string `msgpack:"template"`
Options []OptionKV `msgpack:"options"`
}
type ShowResponse struct {
License string `msgpack:"license"`
Modelfile string `msgpack:"modelfile"`
Parameters string `msgpack:"parameters"`
Template string `msgpack:"template"`
System string `msgpack:"system"`
Details ModelDetails `msgpack:"details"`
}
type ListResponse struct {
Models []ModelResponse `msgpack:"models"`
}
type ModelResponse struct {
Name string `msgpack:"name"`
ModifiedAt uint64 `msgpack:"modifiedAt"`
Size uint64 `msgpack:"size"`
Digest string `msgpack:"digest"`
Details ModelDetails `msgpack:"details"`
}
type ModelDetails struct {
Format string `msgpack:"format"`
Family string `msgpack:"family"`
Families []string `msgpack:"families"`
ParameterSize string `msgpack:"parameterSize"`
QuantizationLevel string `msgpack:"quantizationLevel"`
}