-
Notifications
You must be signed in to change notification settings - Fork 3
/
response.go
102 lines (85 loc) · 2.62 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package yandexgpt
import (
"net/http"
"time"
)
type Response interface {
SetHeader(http.Header)
}
type httpHeader http.Header
func (h *httpHeader) SetHeader(header http.Header) {
*h = httpHeader(header)
}
type YandexGPTResponse struct {
Result YandexGPTResult `json:"result"`
httpHeader
}
type YandexGPTResponseBad struct {
Error YandexGPTError `json:"error"`
}
type YandexGPTResult struct {
Alternatives []YandexGPTAlternative `json:"alternatives"`
Usage YandexGPTUsage `json:"usage"`
ModelVersion string `json:"modelVersion"`
}
type YandexGPTAlternative struct {
Message YandexGPTMessage `json:"message"`
ToolResultList YandexToolResultList `json:"toolResultList"`
Status string `json:"status"`
}
type YandexGPTUsage struct {
InputTokens string `json:"inputTextTokens"`
CompletionTokens string `json:"completionTokens"`
TotalTokens string `json:"totalTokens"`
}
type YandexIAMResponse struct {
IAMToken string `json:"iamToken"`
ExpiresAt time.Time `json:"expiresAt"`
httpHeader
}
type YandexCompletionResponse struct {
ID string `json:"id"`
Description string `json:"description"`
CreatedAt string `json:"createdAt"`
ModifiedAt string `json:"modifiedAt"`
Done bool `json:"done"`
Metadata *MetadataResponse `json:"metadata"`
Error *StatusResponse `json:"error"`
Response string `json:"response"`
httpHeader
}
type StatusResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Details DetailsResponse `json:"details"`
}
type MetadataResponse struct {
Type string `json:"@type"`
DiskID string `json:"diskId"`
}
type DetailsResponse struct {
Type string `json:"@type"`
RequestID string `json:"requestId"`
}
type OperationResponse struct {
ID string `json:"id"`
Description string `json:"description"`
CreatedAt string `json:"createdAt"`
CreatedBy string `json:"createdBy"`
ModifiedAt string `json:"modifiedAt"`
Done bool `json:"done"`
Metadata *MetadataResponse `json:"metadata"`
Error *StatusResponse `json:"error"`
Response *YandexResponse `json:"response"`
httpHeader
}
type EmbeddingResponse struct {
Embedding []float64 `json:"embedding"`
NumTokens string `json:"numTokens"`
ModelVersion string `json:"modelVersion"`
httpHeader
}
type YandexResponse struct {
Type string `json:"@type"`
Alternatives []YandexGPTAlternative `json:"alternatives"`
}