-
Notifications
You must be signed in to change notification settings - Fork 2
/
response.go
76 lines (64 loc) · 1.91 KB
/
response.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
package gochatgptsdk
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
type ModelChat struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature int `json:"temperature,omitempty"`
TopP int `json:"top_p,omitempty"`
FrequencyPenalty int `json:"frequency_penalty,omitempty"`
PresencePenalty int `json:"presence_penalty,omitempty"`
}
type Choice struct {
Index int `json:"index"`
Message Message `json:"message"`
FinishReason string `json:"finish_reason"`
}
type ChoiceText struct {
Text string `json:"text"`
Index int `json:"index"`
Logprobs interface{} `json:"logprobs"`
FinishReason string `json:"finish_reason"`
}
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
type ModelChatResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Choices []Choice `json:"choices"`
Usage Usage `json:"usage"`
}
type ModelTextResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []ChoiceText `json:"choices"`
Usage Usage `json:"usage"`
}
type DataURL struct {
URL string `json:"url"`
}
type DataB64JSON struct {
B64JSON string `json:"b64_json"`
}
type ModelImagesResponse[T DataURL | DataB64JSON] struct {
Created int64 `json:"created"`
Data []T `json:"data"`
}
type Error struct {
Code interface{} `json:"code"`
Message string `json:"message"`
Param interface{} `json:"param"`
Type string `json:"type"`
}
type ErrorResponse struct {
Error Error `json:"error"`
}