-
Notifications
You must be signed in to change notification settings - Fork 1
/
structs_ollama.go
85 lines (67 loc) · 2.1 KB
/
structs_ollama.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
package gollama
// Version
type versionResponse struct {
Version string `json:"version"`
}
// Tags
type tagsResponse struct {
Models []ModelInfo `json:"models"`
}
// Pull
type pullRequest struct {
Model string `json:"model"`
Stream bool `json:"stream"`
}
type pullResponse struct {
Status string `json:"status"`
}
// Show
type showRequest struct {
Model string `json:"model"`
}
// Embeddings
type embeddingsRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
}
type embeddingsResponse struct {
Embedding []float64 `json:"embedding"`
}
// Chat
type chatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
Images []string `json:"images,omitempty"`
}
type chatOptionsRequest struct {
Seed int `json:"seed"`
Temperature float64 `json:"temperature"`
ContextLength int64 `json:"context_length,omitempty"`
}
type chatRequest struct {
Model string `json:"model"`
Stream bool `json:"stream"`
Messages []chatMessage `json:"messages"`
Tools *[]Tool `json:"tools,omitempty"`
Format *StructuredFormat `json:"format,omitempty"`
Options chatOptionsRequest `json:"options"`
}
// ResponseChat is the response from the Ollama API
type messageResponse struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls"`
}
type chatResponse struct {
Model string `json:"model"`
CreatedAt string `json:"created_at"`
Message messageResponse `json:"message"`
DoneReason string `json:"done_reason"`
Done bool `json:"done"`
TotalDuration int64 `json:"total_duration,omitempty"`
LoadDuration int64 `json:"load_duration,omitempty"`
PromptEvalCount int `json:"prompt_eval_count,omitempty"`
PromptEvalDuration int64 `json:"prompt_eval_duration,omitempty"`
EvalCount int `json:"eval_count,omitempty"`
EvalDuration int64 `json:"eval_duration,omitempty"`
}