forked from docker/model-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.go
More file actions
61 lines (54 loc) · 1.98 KB
/
api.go
File metadata and controls
61 lines (54 loc) · 1.98 KB
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
package desktop
// ProgressMessage represents a structured message for progress reporting
type ProgressMessage struct {
Type string `json:"type"` // "progress", "success", or "error"
Message string `json:"message"` // Deprecated: the message should be defined by clients based on Message.Total and Message.Layer
Total uint64 `json:"total"`
Pulled uint64 `json:"pulled"` // Deprecated: use Layer.Current
Layer Layer `json:"layer"` // Current layer information
Mode string `json:"mode"` // "push", "pull"
}
type Layer struct {
ID string // Layer ID
Size uint64 // Layer size
Current uint64 // Current bytes transferred
}
type OpenAIChatMessage struct {
Role string `json:"role"`
Content interface{} `json:"content"` // Can be string or []ContentPart for multimodal
}
// ContentPart represents a part of multimodal content (text or image)
type ContentPart struct {
Type string `json:"type"` // "text" or "image_url"
Text string `json:"text,omitempty"`
ImageURL *ImageURL `json:"image_url,omitempty"`
}
// ImageURL represents an image in a message
type ImageURL struct {
URL string `json:"url"` // data:image/jpeg;base64,...
}
type OpenAIChatRequest struct {
Model string `json:"model"`
Messages []OpenAIChatMessage `json:"messages"`
Stream bool `json:"stream"`
}
type OpenAIChatResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []struct {
Delta struct {
Content string `json:"content"`
Role string `json:"role,omitempty"`
ReasoningContent string `json:"reasoning_content,omitempty"`
} `json:"delta"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Usage *struct {
CompletionTokens int `json:"completion_tokens"`
PromptTokens int `json:"prompt_tokens"`
TotalTokens int `json:"total_tokens"`
} `json:"usage,omitempty"`
}