forked from diemus/azure-openai-proxy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
200 lines (174 loc) · 6.67 KB
/
types.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
199
200
package azure
type ListModelResponse struct {
Object string `json:"object"`
Data []Model `json:"data"`
}
type Model struct {
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created_at"`
Capabilities Capabilities `json:"capabilities"`
LifecycleStatus string `json:"lifecycle_status"`
Status string `json:"status"`
Deprecation Deprecation `json:"deprecation,omitempty"`
FineTune string `json:"fine_tune,omitempty"`
Created int `json:"created"`
OwnedBy string `json:"owned_by"`
Permission []ModelPermission `json:"permission"`
Root string `json:"root"`
Parent any `json:"parent"`
}
type ModelList struct {
Object string `json:"object"`
Data []Model `json:"data"`
}
type ModelPermission struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
AllowCreateEngine bool `json:"allow_create_engine"`
AllowSampling bool `json:"allow_sampling"`
AllowLogprobs bool `json:"allow_logprobs"`
AllowSearchIndices bool `json:"allow_search_indices"`
AllowView bool `json:"allow_view"`
AllowFineTuning bool `json:"allow_fine_tuning"`
Organization string `json:"organization"`
Group any `json:"group"`
IsBlocking bool `json:"is_blocking"`
}
// DeployedModel represents a model deployed in Azure
type DeployedModel struct {
ID string `json:"id"`
ModelID string `json:"model"`
DeploymentID string `json:"deployment_id"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CapabilityVersions []string `json:"capability_versions,omitempty"`
}
// ListDeployedModelsResponse represents the response for listing deployed models
type ListDeployedModelsResponse struct {
Data []DeployedModel `json:"data"`
}
// JSONModeRequest represents a request with JSON mode enabled
type JSONModeRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Temperature float64 `json:"temperature,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
ResponseFormat *ResponseFormat `json:"response_format,omitempty"`
}
// ResponseFormat specifies the desired format for the model's output
type ResponseFormat struct {
Type string `json:"type"` // Can be "text" or "json_object"
}
// ChatMessage represents a message in a chat conversation
type ChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
// JSONModeResponse represents a response when JSON mode is enabled
type JSONModeResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []JSONChoice `json:"choices"`
Usage Usage `json:"usage"`
}
// JSONChoice represents a choice in the JSON mode response
type JSONChoice struct {
Index int `json:"index"`
Message ChatMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
// Usage represents token usage information
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
// DeploymentCapability represents the capabilities of a deployment
type DeploymentCapability struct {
Name string `json:"name"`
Version string `json:"version"`
}
// DeploymentDetails represents detailed information about a deployment
type DeploymentDetails struct {
ID string `json:"id"`
ModelID string `json:"model"`
OwnerID string `json:"owner"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Capabilities []DeploymentCapability `json:"capabilities"`
ScaleSettings ScaleSettings `json:"scale_settings"`
RaiPolicy string `json:"rai_policy"`
}
// ScaleSettings represents the scale settings for a deployment
type ScaleSettings struct {
ScaleType string `json:"scale_type"`
Capacity int `json:"capacity"`
}
// SpeechRequest represents the request structure for text-to-speech
type SpeechRequest struct {
Model string `json:"model"`
Input string `json:"input"`
Voice string `json:"voice"`
ResponseFormat string `json:"response_format,omitempty"`
Speed float64 `json:"speed,omitempty"`
}
// SpeechResponse represents the response structure from text-to-speech
type SpeechResponse struct {
Type string `json:"type"`
Data []byte `json:"data"`
}
// VoiceInfo represents information about available voices
type VoiceInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Language string `json:"language"`
Gender string `json:"gender"`
}
// ListVoicesResponse represents the response structure for listing available voices
type ListVoicesResponse struct {
Voices []VoiceInfo `json:"voices"`
}
// ImageGenerationRequest represents the request structure for image generation
type ImageGenerationRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
NumImages int `json:"num_images,omitempty"`
Size string `json:"size,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
}
// ImageGenerationResponse represents the response structure from image generation
type ImageGenerationResponse struct {
Created int64 `json:"created"`
Data []ImageData `json:"data"`
}
// ImageData represents data of a generated image
type ImageData struct {
URL string `json:"url"`
}
// AudioTranscriptionRequest represents the request structure for audio transcription
type AudioTranscriptionRequest struct {
Model string `json:"model"`
Audio []byte `json:"audio"`
Language string `json:"language,omitempty"`
}
// AudioTranscriptionResponse represents the response structure from audio transcription
type AudioTranscriptionResponse struct {
Text string `json:"text"`
}
type Capabilities struct {
ChatCompletion bool `json:"chat_completion"`
Completion bool `json:"completion"`
Embeddings bool `json:"embeddings"`
FineTune bool `json:"fine_tune"`
Inference bool `json:"inference"`
}
type Deprecation struct {
FineTune int `json:"fine_tune,omitempty"`
Inference int `json:"inference,omitempty"`
}