-
Notifications
You must be signed in to change notification settings - Fork 0
/
client-impl.go
198 lines (159 loc) · 4.56 KB
/
client-impl.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
package openai_scheduler
import (
"context"
o "github.com/sashabaranov/go-openai"
)
// region ChatCompletion
func (c *Client) CreateChatCompletion(
ctx context.Context,
request o.ChatCompletionRequest,
) (
response o.ChatCompletionResponse, err error,
) {
response, err = c.Raw.CreateChatCompletion(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CreateChatCompletionStream(
ctx context.Context,
request o.ChatCompletionRequest,
) (
stream *o.ChatCompletionStream, err error,
) {
stream, err = c.Raw.CreateChatCompletionStream(ctx, request)
c.StatusAdjust(err)
return
}
// endregion
// region Completion
func (c *Client) CreateCompletion(
ctx context.Context,
request o.CompletionRequest,
) (
response o.CompletionResponse, err error,
) {
response, err = c.Raw.CreateCompletion(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CreateCompletionStream(
ctx context.Context, request o.CompletionRequest,
) (
stream *o.CompletionStream, err error,
) {
stream, err = c.Raw.CreateCompletionStream(ctx, request)
c.StatusAdjust(err)
return
}
// endregion
// region FineTune
func (c *Client) CreateFineTune(ctx context.Context, request o.FineTuneRequest) (response o.FineTune, err error) {
response, err = c.Raw.CreateFineTune(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CancelFineTune(ctx context.Context, fineTuneID string) (response o.FineTune, err error) {
response, err = c.Raw.CancelFineTune(ctx, fineTuneID)
c.StatusAdjust(err)
return
}
func (c *Client) ListFineTunes(ctx context.Context) (response o.FineTuneList, err error) {
response, err = c.Raw.ListFineTunes(ctx)
c.StatusAdjust(err)
return
}
func (c *Client) GetFineTune(ctx context.Context, fineTuneID string) (response o.FineTune, err error) {
response, err = c.Raw.GetFineTune(ctx, fineTuneID)
c.StatusAdjust(err)
return
}
func (c *Client) DeleteFineTune(ctx context.Context, fineTuneID string) (response o.FineTuneDeleteResponse, err error) {
response, err = c.Raw.DeleteFineTune(ctx, fineTuneID)
c.StatusAdjust(err)
return
}
func (c *Client) ListFineTuneEvents(ctx context.Context, fineTuneID string) (response o.FineTuneEventList, err error) {
response, err = c.Raw.ListFineTuneEvents(ctx, fineTuneID)
c.StatusAdjust(err)
return
}
// endregion
// region Image
func (c *Client) CreateImage(ctx context.Context, request o.ImageRequest) (response o.ImageResponse, err error) {
response, err = c.Raw.CreateImage(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CreateEditImage(ctx context.Context, request o.ImageEditRequest) (response o.ImageResponse, err error) {
response, err = c.Raw.CreateEditImage(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CreateVariImage(ctx context.Context, request o.ImageVariRequest) (response o.ImageResponse, err error) {
response, err = c.Raw.CreateVariImage(ctx, request)
c.StatusAdjust(err)
return
}
// endregion
// region Audio
func (c *Client) CreateTranscription(
ctx context.Context,
request o.AudioRequest,
) (response o.AudioResponse, err error) {
response, err = c.Raw.CreateTranscription(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) CreateTranslation(
ctx context.Context,
request o.AudioRequest,
) (response o.AudioResponse, err error) {
response, err = c.Raw.CreateTranslation(ctx, request)
c.StatusAdjust(err)
return
}
// endregion
// region File
func (c *Client) CreateFile(ctx context.Context, request o.FileRequest) (file o.File, err error) {
file, err = c.Raw.CreateFile(ctx, request)
c.StatusAdjust(err)
return
}
func (c *Client) DeleteFile(ctx context.Context, fileID string) (err error) {
err = c.Raw.DeleteFile(ctx, fileID)
c.StatusAdjust(err)
return
}
func (c *Client) ListFiles(ctx context.Context) (files o.FilesList, err error) {
files, err = c.Raw.ListFiles(ctx)
c.StatusAdjust(err)
return
}
func (c *Client) GetFile(ctx context.Context, fileID string) (file o.File, err error) {
file, err = c.Raw.GetFile(ctx, fileID)
c.StatusAdjust(err)
return
}
// endregion
// region Engine
func (c *Client) ListEngines(ctx context.Context) (engines o.EnginesList, err error) {
engines, err = c.Raw.ListEngines(ctx)
c.StatusAdjust(err)
return
}
func (c *Client) GetEngine(
ctx context.Context,
engineID string,
) (engine o.Engine, err error) {
engine, err = c.Raw.GetEngine(ctx, engineID)
c.StatusAdjust(err)
return
}
// endregion
// region Moderations
func (c *Client) Moderations(ctx context.Context, request o.ModerationRequest) (response o.ModerationResponse, err error) {
response, err = c.Raw.Moderations(ctx, request)
c.StatusAdjust(err)
return
}
// endregion