-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerated_types.go
398 lines (333 loc) · 14.2 KB
/
generated_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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
// Package sdk provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
package sdk
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
// Defines values for ChatCompletionChoiceFinishReason.
const (
ContentFilter ChatCompletionChoiceFinishReason = "content_filter"
FunctionCall ChatCompletionChoiceFinishReason = "function_call"
Length ChatCompletionChoiceFinishReason = "length"
Stop ChatCompletionChoiceFinishReason = "stop"
ToolCalls ChatCompletionChoiceFinishReason = "tool_calls"
)
// Defines values for ChatCompletionToolType.
const (
Function ChatCompletionToolType = "function"
)
// Defines values for MessageRole.
const (
Assistant MessageRole = "assistant"
System MessageRole = "system"
Tool MessageRole = "tool"
User MessageRole = "user"
)
// Defines values for Provider.
const (
Anthropic Provider = "anthropic"
Cloudflare Provider = "cloudflare"
Cohere Provider = "cohere"
Deepseek Provider = "deepseek"
Groq Provider = "groq"
Ollama Provider = "ollama"
Openai Provider = "openai"
)
// Defines values for SSEventEvent.
const (
ContentDelta SSEventEvent = "content-delta"
ContentEnd SSEventEvent = "content-end"
ContentStart SSEventEvent = "content-start"
MessageEnd SSEventEvent = "message-end"
MessageStart SSEventEvent = "message-start"
StreamEnd SSEventEvent = "stream-end"
StreamStart SSEventEvent = "stream-start"
)
// ChatCompletionChoice defines model for ChatCompletionChoice.
type ChatCompletionChoice struct {
// FinishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
// `length` if the maximum number of tokens specified in the request was reached,
// `content_filter` if content was omitted due to a flag from our content filters,
// `tool_calls` if the model called a tool.
FinishReason ChatCompletionChoiceFinishReason `json:"finish_reason"`
// Index The index of the choice in the list of choices.
Index int `json:"index"`
// Message Message structure for provider requests
Message Message `json:"message"`
}
// ChatCompletionChoiceFinishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
// `length` if the maximum number of tokens specified in the request was reached,
// `content_filter` if content was omitted due to a flag from our content filters,
// `tool_calls` if the model called a tool.
type ChatCompletionChoiceFinishReason string
// ChatCompletionMessageToolCall defines model for ChatCompletionMessageToolCall.
type ChatCompletionMessageToolCall struct {
// Function The function that the model called.
Function ChatCompletionMessageToolCallFunction `json:"function"`
// Id The ID of the tool call.
Id string `json:"id"`
// Type The type of the tool. Currently, only `function` is supported.
Type ChatCompletionToolType `json:"type"`
}
// ChatCompletionMessageToolCallFunction The function that the model called.
type ChatCompletionMessageToolCallFunction struct {
// Arguments The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
Arguments string `json:"arguments"`
// Name The name of the function to call.
Name string `json:"name"`
}
// ChatCompletionStreamOptions Options for streaming response. Only set this when you set `stream: true`.
type ChatCompletionStreamOptions struct {
// IncludeUsage If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.
IncludeUsage *bool `json:"include_usage,omitempty"`
}
// ChatCompletionTool defines model for ChatCompletionTool.
type ChatCompletionTool struct {
Function FunctionObject `json:"function"`
// Type The type of the tool. Currently, only `function` is supported.
Type ChatCompletionToolType `json:"type"`
}
// ChatCompletionToolType The type of the tool. Currently, only `function` is supported.
type ChatCompletionToolType string
// CompletionUsage Usage statistics for the completion request.
type CompletionUsage struct {
// CompletionTokens Number of tokens in the generated completion.
CompletionTokens int64 `json:"completion_tokens"`
// PromptTokens Number of tokens in the prompt.
PromptTokens int64 `json:"prompt_tokens"`
// TotalTokens Total number of tokens used in the request (prompt + completion).
TotalTokens int64 `json:"total_tokens"`
}
// CreateChatCompletionRequest defines model for CreateChatCompletionRequest.
type CreateChatCompletionRequest struct {
// MaxTokens An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
MaxTokens *int `json:"max_tokens,omitempty"`
// Messages A list of messages comprising the conversation so far.
Messages []Message `json:"messages"`
// Model Model ID to use
Model string `json:"model"`
// Stream If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
Stream *bool `json:"stream,omitempty"`
// StreamOptions Options for streaming response. Only set this when you set `stream: true`.
StreamOptions *ChatCompletionStreamOptions `json:"stream_options,omitempty"`
// Tools A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
Tools *[]ChatCompletionTool `json:"tools,omitempty"`
}
// CreateChatCompletionResponse Represents a chat completion response returned by model, based on the provided input.
type CreateChatCompletionResponse struct {
// Choices A list of chat completion choices. Can be more than one if `n` is greater than 1.
Choices []ChatCompletionChoice `json:"choices"`
// Created The Unix timestamp (in seconds) of when the chat completion was created.
Created int `json:"created"`
// Id A unique identifier for the chat completion.
Id string `json:"id"`
// Model The model used for the chat completion.
Model string `json:"model"`
// Object The object type, which is always `chat.completion`.
Object string `json:"object"`
// Usage Usage statistics for the completion request.
Usage *CompletionUsage `json:"usage,omitempty"`
}
// Error defines model for Error.
type Error struct {
Error *string `json:"error,omitempty"`
}
// FunctionObject defines model for FunctionObject.
type FunctionObject struct {
// Description A description of what the function does, used by the model to choose when and how to call the function.
Description *string `json:"description,omitempty"`
// Name The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
Name string `json:"name"`
// Parameters The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
// Omitting `parameters` defines a function with an empty parameter list.
Parameters *FunctionParameters `json:"parameters,omitempty"`
// Strict Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).
Strict *bool `json:"strict,omitempty"`
}
// FunctionParameters The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
// Omitting `parameters` defines a function with an empty parameter list.
type FunctionParameters struct {
// Properties The properties of the parameters.
Properties *map[string]interface{} `json:"properties,omitempty"`
// Required The required properties of the parameters.
Required *[]string `json:"required,omitempty"`
// Type The type of the parameters. Currently, only `object` is supported.
Type *string `json:"type,omitempty"`
}
// ListModelsResponse Response structure for listing models
type ListModelsResponse struct {
Data *[]Model `json:"data,omitempty"`
Object *string `json:"object,omitempty"`
Provider *Provider `json:"provider,omitempty"`
}
// Message Message structure for provider requests
type Message struct {
Content string `json:"content"`
Reasoning *string `json:"reasoning,omitempty"`
ReasoningContent *string `json:"reasoning_content,omitempty"`
// Role Role of the message sender
Role MessageRole `json:"role"`
ToolCallId *string `json:"tool_call_id,omitempty"`
ToolCalls *[]ChatCompletionMessageToolCall `json:"tool_calls,omitempty"`
}
// MessageRole Role of the message sender
type MessageRole string
// Model Common model information
type Model struct {
Created *int64 `json:"created,omitempty"`
Id *string `json:"id,omitempty"`
Object *string `json:"object,omitempty"`
OwnedBy *string `json:"owned_by,omitempty"`
ServedBy *Provider `json:"served_by,omitempty"`
}
// Provider defines model for Provider.
type Provider string
// ProviderSpecificResponse Provider-specific response format. Examples:
//
// OpenAI GET /v1/models?provider=openai response:
// ```json
//
// {
// "provider": "openai",
// "object": "list",
// "data": [
// {
// "id": "gpt-4",
// "object": "model",
// "created": 1687882410,
// "owned_by": "openai",
// "served_by": "openai"
// }
// ]
// }
//
// ```
//
// Anthropic GET /v1/models?provider=anthropic response:
// ```json
//
// {
// "provider": "anthropic",
// "object": "list",
// "data": [
// {
// "id": "gpt-4",
// "object": "model",
// "created": 1687882410,
// "owned_by": "openai",
// "served_by": "openai"
// }
// ]
// }
//
// ```
type ProviderSpecificResponse = map[string]interface{}
// SSEvent defines model for SSEvent.
type SSEvent struct {
Data *[]byte `json:"data,omitempty"`
Event *SSEventEvent `json:"event,omitempty"`
Retry *int `json:"retry,omitempty"`
}
// SSEventEvent defines model for SSEvent.Event.
type SSEventEvent string
// BadRequest defines model for BadRequest.
type BadRequest = Error
// InternalError defines model for InternalError.
type InternalError = Error
// ProviderResponse Provider-specific response format. Examples:
//
// OpenAI GET /v1/models?provider=openai response:
// ```json
//
// {
// "provider": "openai",
// "object": "list",
// "data": [
// {
// "id": "gpt-4",
// "object": "model",
// "created": 1687882410,
// "owned_by": "openai",
// "served_by": "openai"
// }
// ]
// }
//
// ```
//
// Anthropic GET /v1/models?provider=anthropic response:
// ```json
//
// {
// "provider": "anthropic",
// "object": "list",
// "data": [
// {
// "id": "gpt-4",
// "object": "model",
// "created": 1687882410,
// "owned_by": "openai",
// "served_by": "openai"
// }
// ]
// }
//
// ```
type ProviderResponse = ProviderSpecificResponse
// Unauthorized defines model for Unauthorized.
type Unauthorized = Error
// ProviderRequest defines model for ProviderRequest.
type ProviderRequest struct {
Messages *[]struct {
Content *string `json:"content,omitempty"`
Role *string `json:"role,omitempty"`
} `json:"messages,omitempty"`
Model *string `json:"model,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
}
// CreateChatCompletionParams defines parameters for CreateChatCompletion.
type CreateChatCompletionParams struct {
// Provider Specific provider to use (default determined by model)
Provider *Provider `form:"provider,omitempty" json:"provider,omitempty"`
}
// ListModelsParams defines parameters for ListModels.
type ListModelsParams struct {
// Provider Specific provider to query (optional)
Provider *Provider `form:"provider,omitempty" json:"provider,omitempty"`
}
// ProxyPatchJSONBody defines parameters for ProxyPatch.
type ProxyPatchJSONBody struct {
Messages *[]struct {
Content *string `json:"content,omitempty"`
Role *string `json:"role,omitempty"`
} `json:"messages,omitempty"`
Model *string `json:"model,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
}
// ProxyPostJSONBody defines parameters for ProxyPost.
type ProxyPostJSONBody struct {
Messages *[]struct {
Content *string `json:"content,omitempty"`
Role *string `json:"role,omitempty"`
} `json:"messages,omitempty"`
Model *string `json:"model,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
}
// ProxyPutJSONBody defines parameters for ProxyPut.
type ProxyPutJSONBody struct {
Messages *[]struct {
Content *string `json:"content,omitempty"`
Role *string `json:"role,omitempty"`
} `json:"messages,omitempty"`
Model *string `json:"model,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
}
// CreateChatCompletionJSONRequestBody defines body for CreateChatCompletion for application/json ContentType.
type CreateChatCompletionJSONRequestBody = CreateChatCompletionRequest
// ProxyPatchJSONRequestBody defines body for ProxyPatch for application/json ContentType.
type ProxyPatchJSONRequestBody ProxyPatchJSONBody
// ProxyPostJSONRequestBody defines body for ProxyPost for application/json ContentType.
type ProxyPostJSONRequestBody ProxyPostJSONBody
// ProxyPutJSONRequestBody defines body for ProxyPut for application/json ContentType.
type ProxyPutJSONRequestBody ProxyPutJSONBody