-
Notifications
You must be signed in to change notification settings - Fork 1
/
record.go
53 lines (49 loc) · 1.34 KB
/
record.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 main
import (
"time"
)
type Record struct {
ID int64 `gorm:"primaryKey,autoIncrement"`
Hostname string
UpstreamEndpoint string
UpstreamSK string
CreatedAt time.Time
IP string
Body string
Model string
Response string
ResponseTime time.Duration
ElapsedTime time.Duration
Status int
Authorization string // the autorization header send by client
UserAgent string
Headers string
}
type StreamModeChunk struct {
Choices []StreamModeChunkChoice `json:"choices"`
}
type StreamModeChunkChoice struct {
Delta StreamModeDelta `json:"delta"`
FinishReason string `json:"finish_reason"`
}
type StreamModeDelta struct {
Content string `json:"content"`
}
type FetchModeResponse struct {
Model string `json:"model"`
Choices []FetchModeChoice `json:"choices"`
Usage FetchModeUsage `json:"usage"`
}
type FetchModeChoice struct {
Message FetchModeMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
type FetchModeMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
type FetchModeUsage struct {
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
TotalTokens int64 `json:"total_tokens"`
}