ogx-client 0.7.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release-doctor.yml +0 -2
- package/.release-please-manifest.json +1 -1
- package/.stats.yml +4 -4
- package/CHANGELOG.md +27 -0
- package/CONTRIBUTING.md +0 -14
- package/README.md +5 -4
- package/api.md +26 -48
- package/bin/check-release-environment +0 -4
- package/dist/CHANGELOG.md +27 -0
- package/dist/README.md +5 -4
- package/dist/index.d.mts +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -16
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/resources/chat/chat.d.ts +2 -2
- package/dist/resources/chat/chat.d.ts.map +1 -1
- package/dist/resources/chat/chat.js +2 -2
- package/dist/resources/chat/chat.js.map +1 -1
- package/dist/resources/chat/chat.mjs +2 -2
- package/dist/resources/chat/completions/completions.d.ts +2021 -0
- package/dist/resources/chat/completions/completions.d.ts.map +1 -0
- package/dist/resources/chat/completions/completions.js +70 -0
- package/dist/resources/chat/completions/completions.js.map +1 -0
- package/dist/resources/chat/completions/completions.mjs +43 -0
- package/dist/resources/chat/completions/completions.mjs.map +1 -0
- package/dist/resources/chat/completions/index.d.ts +3 -0
- package/dist/resources/chat/completions/index.d.ts.map +1 -0
- package/dist/resources/chat/completions/index.js +16 -0
- package/dist/resources/chat/completions/index.js.map +1 -0
- package/dist/resources/chat/completions/index.mjs +10 -0
- package/dist/resources/chat/completions/index.mjs.map +1 -0
- package/dist/resources/chat/completions/messages.d.ts +204 -0
- package/dist/resources/chat/completions/messages.d.ts.map +1 -0
- package/dist/resources/chat/completions/messages.js +35 -0
- package/dist/resources/chat/completions/messages.js.map +1 -0
- package/dist/resources/chat/completions/messages.mjs +30 -0
- package/dist/resources/chat/completions/messages.mjs.map +1 -0
- package/dist/resources/chat/completions.d.ts +1 -2020
- package/dist/resources/chat/completions.d.ts.map +1 -1
- package/dist/resources/chat/completions.js +15 -29
- package/dist/resources/chat/completions.js.map +1 -1
- package/dist/resources/chat/completions.mjs +1 -27
- package/dist/resources/chat/completions.mjs.map +1 -1
- package/dist/resources/chat/index.d.ts +1 -1
- package/dist/resources/chat/index.d.ts.map +1 -1
- package/dist/resources/chat/index.js +2 -2
- package/dist/resources/chat/index.js.map +1 -1
- package/dist/resources/chat/index.mjs +1 -1
- package/dist/resources/completions.d.ts +2 -2
- package/dist/resources/completions.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.d.ts +12 -11
- package/dist/resources/conversations/conversations.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.js.map +1 -1
- package/dist/resources/conversations/conversations.mjs.map +1 -1
- package/dist/resources/conversations/index.d.ts +1 -1
- package/dist/resources/conversations/index.d.ts.map +1 -1
- package/dist/resources/conversations/items.d.ts +49 -29
- package/dist/resources/conversations/items.d.ts.map +1 -1
- package/dist/resources/conversations/items.js +5 -5
- package/dist/resources/conversations/items.js.map +1 -1
- package/dist/resources/conversations/items.mjs +5 -5
- package/dist/resources/conversations/items.mjs.map +1 -1
- package/dist/resources/files.d.ts +10 -10
- package/dist/resources/files.d.ts.map +1 -1
- package/dist/resources/files.js.map +1 -1
- package/dist/resources/files.mjs.map +1 -1
- package/dist/resources/index.d.ts +1 -4
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -7
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/index.mjs +1 -4
- package/dist/resources/index.mjs.map +1 -1
- package/dist/resources/models/index.d.ts +2 -2
- package/dist/resources/models/index.d.ts.map +1 -1
- package/dist/resources/models/index.js.map +1 -1
- package/dist/resources/models/index.mjs +1 -1
- package/dist/resources/models/index.mjs.map +1 -1
- package/dist/resources/models/models.d.ts +220 -32
- package/dist/resources/models/models.d.ts.map +1 -1
- package/dist/resources/models/models.js +32 -10
- package/dist/resources/models/models.js.map +1 -1
- package/dist/resources/models/models.mjs +32 -10
- package/dist/resources/models/models.mjs.map +1 -1
- package/dist/resources/models/openai.d.ts +128 -2
- package/dist/resources/models/openai.d.ts.map +1 -1
- package/dist/resources/models/openai.js +17 -5
- package/dist/resources/models/openai.js.map +1 -1
- package/dist/resources/models/openai.mjs +17 -5
- package/dist/resources/models/openai.mjs.map +1 -1
- package/dist/resources/responses/responses.d.ts +0 -16
- package/dist/resources/responses/responses.d.ts.map +1 -1
- package/dist/resources/responses/responses.js.map +1 -1
- package/dist/resources/responses/responses.mjs.map +1 -1
- package/dist/resources/shared.d.ts +0 -19
- package/dist/resources/shared.d.ts.map +1 -1
- package/dist/src/index.ts +12 -43
- package/dist/src/resources/chat/chat.ts +2 -2
- package/dist/src/resources/chat/completions/completions.ts +2444 -0
- package/dist/src/resources/chat/completions/index.ts +24 -0
- package/dist/src/resources/chat/completions/messages.ts +273 -0
- package/dist/src/resources/chat/completions.ts +1 -2422
- package/dist/src/resources/chat/index.ts +1 -1
- package/dist/src/resources/completions.ts +2 -2
- package/dist/src/resources/conversations/conversations.ts +15 -9
- package/dist/src/resources/conversations/index.ts +1 -1
- package/dist/src/resources/conversations/items.ts +84 -28
- package/dist/src/resources/files.ts +29 -10
- package/dist/src/resources/index.ts +9 -10
- package/dist/src/resources/models/index.ts +10 -2
- package/dist/src/resources/models/models.ts +321 -32
- package/dist/src/resources/models/openai.ts +180 -3
- package/dist/src/resources/responses/responses.ts +0 -21
- package/dist/src/resources/shared.ts +0 -20
- package/dist/src/version.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/index.ts +12 -43
- package/src/resources/chat/chat.ts +2 -2
- package/src/resources/chat/completions/completions.ts +2444 -0
- package/src/resources/chat/completions/index.ts +24 -0
- package/src/resources/chat/completions/messages.ts +273 -0
- package/src/resources/chat/completions.ts +1 -2422
- package/src/resources/chat/index.ts +1 -1
- package/src/resources/completions.ts +2 -2
- package/src/resources/conversations/conversations.ts +15 -9
- package/src/resources/conversations/index.ts +1 -1
- package/src/resources/conversations/items.ts +84 -28
- package/src/resources/files.ts +29 -10
- package/src/resources/index.ts +9 -10
- package/src/resources/models/index.ts +10 -2
- package/src/resources/models/models.ts +321 -32
- package/src/resources/models/openai.ts +180 -3
- package/src/resources/responses/responses.ts +0 -21
- package/src/resources/shared.ts +0 -20
- package/src/version.ts +1 -1
- package/tests/api-resources/chat/{completions.test.ts → completions/completions.test.ts} +0 -1
- package/tests/api-resources/chat/completions/messages.test.ts +47 -0
- package/tests/api-resources/completions.test.ts +1 -1
- package/tests/api-resources/conversations/items.test.ts +12 -0
- package/tests/api-resources/models/models.test.ts +34 -0
- package/tests/api-resources/models/openai.test.ts +18 -0
- package/tests/api-resources/responses/responses.test.ts +0 -2
- package/.github/workflows/publish-npm.yml +0 -32
- package/dist/resources/moderations.d.ts +0 -83
- package/dist/resources/moderations.d.ts.map +0 -1
- package/dist/resources/moderations.js +0 -24
- package/dist/resources/moderations.js.map +0 -1
- package/dist/resources/moderations.mjs +0 -20
- package/dist/resources/moderations.mjs.map +0 -1
- package/dist/resources/safety.d.ts +0 -297
- package/dist/resources/safety.d.ts.map +0 -1
- package/dist/resources/safety.js +0 -24
- package/dist/resources/safety.js.map +0 -1
- package/dist/resources/safety.mjs +0 -20
- package/dist/resources/safety.mjs.map +0 -1
- package/dist/resources/shields.d.ts +0 -82
- package/dist/resources/shields.d.ts.map +0 -1
- package/dist/resources/shields.js +0 -46
- package/dist/resources/shields.js.map +0 -1
- package/dist/resources/shields.mjs +0 -42
- package/dist/resources/shields.mjs.map +0 -1
- package/dist/src/resources/moderations.ts +0 -97
- package/dist/src/resources/safety.ts +0 -367
- package/dist/src/resources/shields.ts +0 -119
- package/src/resources/moderations.ts +0 -97
- package/src/resources/safety.ts +0 -367
- package/src/resources/shields.ts +0 -119
- package/tests/api-resources/moderations.test.ts +0 -29
- package/tests/api-resources/safety.test.ts +0 -41
- package/tests/api-resources/shields.test.ts +0 -88
|
@@ -6,2425 +6,4 @@
|
|
|
6
6
|
//
|
|
7
7
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
import { isRequestOptions } from '../../core';
|
|
11
|
-
import { APIPromise } from '../../core';
|
|
12
|
-
import * as Core from '../../core';
|
|
13
|
-
import * as CompletionsAPI from './completions';
|
|
14
|
-
import * as ChatAPI from './chat';
|
|
15
|
-
import { Stream } from '../../streaming';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* OGX Inference API for generating completions, chat completions, and embeddings.
|
|
19
|
-
*
|
|
20
|
-
* This API provides the raw interface to the underlying models. Three kinds of models are supported:
|
|
21
|
-
* - LLM models: these models generate "raw" and "chat" (conversational) completions.
|
|
22
|
-
* - Embedding models: these models generate embeddings to be used for semantic search.
|
|
23
|
-
* - Rerank models: these models reorder the documents based on their relevance to a query.
|
|
24
|
-
*/
|
|
25
|
-
export class Completions extends APIResource {
|
|
26
|
-
/**
|
|
27
|
-
* Generate an OpenAI-compatible chat completion for the given messages using the
|
|
28
|
-
* specified model.
|
|
29
|
-
*/
|
|
30
|
-
create(
|
|
31
|
-
body: CompletionCreateParamsNonStreaming,
|
|
32
|
-
options?: Core.RequestOptions,
|
|
33
|
-
): APIPromise<CompletionCreateResponse>;
|
|
34
|
-
create(
|
|
35
|
-
body: CompletionCreateParamsStreaming,
|
|
36
|
-
options?: Core.RequestOptions,
|
|
37
|
-
): APIPromise<Stream<ChatAPI.ChatCompletionChunk>>;
|
|
38
|
-
create(
|
|
39
|
-
body: CompletionCreateParamsBase,
|
|
40
|
-
options?: Core.RequestOptions,
|
|
41
|
-
): APIPromise<Stream<ChatAPI.ChatCompletionChunk> | CompletionCreateResponse>;
|
|
42
|
-
create(
|
|
43
|
-
body: CompletionCreateParams,
|
|
44
|
-
options?: Core.RequestOptions,
|
|
45
|
-
): APIPromise<CompletionCreateResponse> | APIPromise<Stream<ChatAPI.ChatCompletionChunk>> {
|
|
46
|
-
return this._client.post('/v1/chat/completions', { body, ...options, stream: body.stream ?? false }) as
|
|
47
|
-
| APIPromise<CompletionCreateResponse>
|
|
48
|
-
| APIPromise<Stream<ChatAPI.ChatCompletionChunk>>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Describe a chat completion by its ID.
|
|
53
|
-
*/
|
|
54
|
-
retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise<CompletionRetrieveResponse> {
|
|
55
|
-
return this._client.get(`/v1/chat/completions/${completionId}`, options);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* List chat completions.
|
|
60
|
-
*/
|
|
61
|
-
list(query?: CompletionListParams, options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
|
|
62
|
-
list(options?: Core.RequestOptions): Core.APIPromise<CompletionListResponse>;
|
|
63
|
-
list(
|
|
64
|
-
query: CompletionListParams | Core.RequestOptions = {},
|
|
65
|
-
options?: Core.RequestOptions,
|
|
66
|
-
): Core.APIPromise<CompletionListResponse> {
|
|
67
|
-
if (isRequestOptions(query)) {
|
|
68
|
-
return this.list({}, query);
|
|
69
|
-
}
|
|
70
|
-
return this._client.get('/v1/chat/completions', { query, ...options });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Response from an OpenAI-compatible chat completion request.
|
|
76
|
-
*/
|
|
77
|
-
export interface CompletionCreateResponse {
|
|
78
|
-
/**
|
|
79
|
-
* The ID of the chat completion.
|
|
80
|
-
*/
|
|
81
|
-
id: string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* List of choices.
|
|
85
|
-
*/
|
|
86
|
-
choices: Array<CompletionCreateResponse.Choice>;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The Unix timestamp in seconds when the chat completion was created.
|
|
90
|
-
*/
|
|
91
|
-
created: number;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* The model that was used to generate the chat completion.
|
|
95
|
-
*/
|
|
96
|
-
model: string;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The object type.
|
|
100
|
-
*/
|
|
101
|
-
object?: 'chat.completion';
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The service tier that was used for this response.
|
|
105
|
-
*/
|
|
106
|
-
service_tier?: string | null;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* System fingerprint for this completion.
|
|
110
|
-
*/
|
|
111
|
-
system_fingerprint?: string | null;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Token usage information for the completion.
|
|
115
|
-
*/
|
|
116
|
-
usage?: CompletionCreateResponse.Usage | null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export namespace CompletionCreateResponse {
|
|
120
|
-
/**
|
|
121
|
-
* A choice from an OpenAI-compatible chat completion response.
|
|
122
|
-
*/
|
|
123
|
-
export interface Choice {
|
|
124
|
-
/**
|
|
125
|
-
* The reason the model stopped generating.
|
|
126
|
-
*/
|
|
127
|
-
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The index of the choice.
|
|
131
|
-
*/
|
|
132
|
-
index: number;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The message from the model.
|
|
136
|
-
*/
|
|
137
|
-
message: Choice.Message;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The log probabilities for the tokens in the message.
|
|
141
|
-
*/
|
|
142
|
-
logprobs?: Choice.Logprobs | null;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export namespace Choice {
|
|
146
|
-
/**
|
|
147
|
-
* The message from the model.
|
|
148
|
-
*/
|
|
149
|
-
export interface Message {
|
|
150
|
-
/**
|
|
151
|
-
* Annotations for the message, when applicable.
|
|
152
|
-
*/
|
|
153
|
-
annotations?: Array<{ [key: string]: unknown }>;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Audio response data when using audio output modality.
|
|
157
|
-
*/
|
|
158
|
-
audio?: { [key: string]: unknown } | null;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The content of the message.
|
|
162
|
-
*/
|
|
163
|
-
content?: string | null;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
167
|
-
*/
|
|
168
|
-
function_call?: Message.FunctionCall;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* The refusal message generated by the model.
|
|
172
|
-
*/
|
|
173
|
-
refusal?: string | null;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The role of the message author, always 'assistant' in responses.
|
|
177
|
-
*/
|
|
178
|
-
role?: 'assistant';
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* The tool calls generated by the model.
|
|
182
|
-
*/
|
|
183
|
-
tool_calls?: Array<Message.Function | Message.Custom>;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export namespace Message {
|
|
187
|
-
/**
|
|
188
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
189
|
-
*/
|
|
190
|
-
export interface FunctionCall {
|
|
191
|
-
/**
|
|
192
|
-
* Arguments to pass to the function as a JSON string.
|
|
193
|
-
*/
|
|
194
|
-
arguments: string;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Name of the function to call.
|
|
198
|
-
*/
|
|
199
|
-
name: string;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
204
|
-
*/
|
|
205
|
-
export interface Function {
|
|
206
|
-
/**
|
|
207
|
-
* Unique identifier for the tool call.
|
|
208
|
-
*/
|
|
209
|
-
id: string;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Function call details.
|
|
213
|
-
*/
|
|
214
|
-
function: Function.Function;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Must be 'function' to identify this as a function call.
|
|
218
|
-
*/
|
|
219
|
-
type: 'function';
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export namespace Function {
|
|
223
|
-
/**
|
|
224
|
-
* Function call details.
|
|
225
|
-
*/
|
|
226
|
-
export interface Function {
|
|
227
|
-
/**
|
|
228
|
-
* Arguments to pass to the function as a JSON string.
|
|
229
|
-
*/
|
|
230
|
-
arguments: string;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Name of the function to call.
|
|
234
|
-
*/
|
|
235
|
-
name: string;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* A call to a custom tool created by the model.
|
|
241
|
-
*/
|
|
242
|
-
export interface Custom {
|
|
243
|
-
/**
|
|
244
|
-
* The ID of the tool call.
|
|
245
|
-
*/
|
|
246
|
-
id: string;
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* The custom tool that the model called.
|
|
250
|
-
*/
|
|
251
|
-
custom: Custom.Custom;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* The type of the tool. Always 'custom'.
|
|
255
|
-
*/
|
|
256
|
-
type: 'custom';
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export namespace Custom {
|
|
260
|
-
/**
|
|
261
|
-
* The custom tool that the model called.
|
|
262
|
-
*/
|
|
263
|
-
export interface Custom {
|
|
264
|
-
/**
|
|
265
|
-
* The input for the custom tool call generated by the model.
|
|
266
|
-
*/
|
|
267
|
-
input: string;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* The name of the custom tool to call.
|
|
271
|
-
*/
|
|
272
|
-
name: string;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* The log probabilities for the tokens in the message.
|
|
279
|
-
*/
|
|
280
|
-
export interface Logprobs {
|
|
281
|
-
/**
|
|
282
|
-
* The log probabilities for the tokens in the message.
|
|
283
|
-
*/
|
|
284
|
-
content?: Array<Logprobs.Content> | null;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* The log probabilities for the refusal tokens.
|
|
288
|
-
*/
|
|
289
|
-
refusal?: Array<Logprobs.Refusal> | null;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export namespace Logprobs {
|
|
293
|
-
/**
|
|
294
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
295
|
-
* response.
|
|
296
|
-
*/
|
|
297
|
-
export interface Content {
|
|
298
|
-
/**
|
|
299
|
-
* The token.
|
|
300
|
-
*/
|
|
301
|
-
token: string;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* The log probability of the token.
|
|
305
|
-
*/
|
|
306
|
-
logprob: number;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* The bytes for the token.
|
|
310
|
-
*/
|
|
311
|
-
bytes?: Array<number> | null;
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* The top log probabilities for the token.
|
|
315
|
-
*/
|
|
316
|
-
top_logprobs?: Array<Content.TopLogprob> | null;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export namespace Content {
|
|
320
|
-
/**
|
|
321
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
322
|
-
* response.
|
|
323
|
-
*/
|
|
324
|
-
export interface TopLogprob {
|
|
325
|
-
/**
|
|
326
|
-
* The token.
|
|
327
|
-
*/
|
|
328
|
-
token: string;
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* The log probability of the token.
|
|
332
|
-
*/
|
|
333
|
-
logprob: number;
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* The bytes for the token.
|
|
337
|
-
*/
|
|
338
|
-
bytes?: Array<number> | null;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
344
|
-
* response.
|
|
345
|
-
*/
|
|
346
|
-
export interface Refusal {
|
|
347
|
-
/**
|
|
348
|
-
* The token.
|
|
349
|
-
*/
|
|
350
|
-
token: string;
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* The log probability of the token.
|
|
354
|
-
*/
|
|
355
|
-
logprob: number;
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* The bytes for the token.
|
|
359
|
-
*/
|
|
360
|
-
bytes?: Array<number> | null;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* The top log probabilities for the token.
|
|
364
|
-
*/
|
|
365
|
-
top_logprobs?: Array<Refusal.TopLogprob> | null;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export namespace Refusal {
|
|
369
|
-
/**
|
|
370
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
371
|
-
* response.
|
|
372
|
-
*/
|
|
373
|
-
export interface TopLogprob {
|
|
374
|
-
/**
|
|
375
|
-
* The token.
|
|
376
|
-
*/
|
|
377
|
-
token: string;
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* The log probability of the token.
|
|
381
|
-
*/
|
|
382
|
-
logprob: number;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* The bytes for the token.
|
|
386
|
-
*/
|
|
387
|
-
bytes?: Array<number> | null;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Token usage information for the completion.
|
|
395
|
-
*/
|
|
396
|
-
export interface Usage {
|
|
397
|
-
/**
|
|
398
|
-
* Number of tokens in the completion.
|
|
399
|
-
*/
|
|
400
|
-
completion_tokens?: number;
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Detailed breakdown of output token usage.
|
|
404
|
-
*/
|
|
405
|
-
completion_tokens_details?: Usage.CompletionTokensDetails;
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Number of tokens in the prompt.
|
|
409
|
-
*/
|
|
410
|
-
prompt_tokens?: number;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Detailed breakdown of input token usage.
|
|
414
|
-
*/
|
|
415
|
-
prompt_tokens_details?: Usage.PromptTokensDetails;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Total tokens used (prompt + completion).
|
|
419
|
-
*/
|
|
420
|
-
total_tokens?: number;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
export namespace Usage {
|
|
424
|
-
/**
|
|
425
|
-
* Detailed breakdown of output token usage.
|
|
426
|
-
*/
|
|
427
|
-
export interface CompletionTokensDetails {
|
|
428
|
-
/**
|
|
429
|
-
* Number of tokens used for reasoning (o1/o3 models).
|
|
430
|
-
*/
|
|
431
|
-
reasoning_tokens?: number;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Detailed breakdown of input token usage.
|
|
436
|
-
*/
|
|
437
|
-
export interface PromptTokensDetails {
|
|
438
|
-
/**
|
|
439
|
-
* Number of tokens retrieved from cache.
|
|
440
|
-
*/
|
|
441
|
-
cached_tokens?: number;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Chat completion response extended with the original input messages.
|
|
448
|
-
*/
|
|
449
|
-
export interface CompletionRetrieveResponse {
|
|
450
|
-
/**
|
|
451
|
-
* The ID of the chat completion.
|
|
452
|
-
*/
|
|
453
|
-
id: string;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* List of choices.
|
|
457
|
-
*/
|
|
458
|
-
choices: Array<CompletionRetrieveResponse.Choice>;
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* The Unix timestamp in seconds when the chat completion was created.
|
|
462
|
-
*/
|
|
463
|
-
created: number;
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* The input messages used to generate this completion.
|
|
467
|
-
*/
|
|
468
|
-
input_messages: Array<
|
|
469
|
-
| CompletionRetrieveResponse.OpenAIUserMessageParamOutput
|
|
470
|
-
| CompletionRetrieveResponse.OpenAISystemMessageParam
|
|
471
|
-
| CompletionRetrieveResponse.OpenAIAssistantMessageParamOutput
|
|
472
|
-
| CompletionRetrieveResponse.OpenAIToolMessageParam
|
|
473
|
-
| CompletionRetrieveResponse.OpenAIDeveloperMessageParam
|
|
474
|
-
>;
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* The model that was used to generate the chat completion.
|
|
478
|
-
*/
|
|
479
|
-
model: string;
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* The object type.
|
|
483
|
-
*/
|
|
484
|
-
object?: 'chat.completion';
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* The service tier that was used for this response.
|
|
488
|
-
*/
|
|
489
|
-
service_tier?: string | null;
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* System fingerprint for this completion.
|
|
493
|
-
*/
|
|
494
|
-
system_fingerprint?: string;
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Token usage information for the completion.
|
|
498
|
-
*/
|
|
499
|
-
usage?: CompletionRetrieveResponse.Usage;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
export namespace CompletionRetrieveResponse {
|
|
503
|
-
/**
|
|
504
|
-
* A choice from an OpenAI-compatible chat completion response.
|
|
505
|
-
*/
|
|
506
|
-
export interface Choice {
|
|
507
|
-
/**
|
|
508
|
-
* The reason the model stopped generating.
|
|
509
|
-
*/
|
|
510
|
-
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* The index of the choice.
|
|
514
|
-
*/
|
|
515
|
-
index: number;
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* The message from the model.
|
|
519
|
-
*/
|
|
520
|
-
message: Choice.Message;
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* The log probabilities for the tokens in the message.
|
|
524
|
-
*/
|
|
525
|
-
logprobs?: Choice.Logprobs | null;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export namespace Choice {
|
|
529
|
-
/**
|
|
530
|
-
* The message from the model.
|
|
531
|
-
*/
|
|
532
|
-
export interface Message {
|
|
533
|
-
/**
|
|
534
|
-
* Annotations for the message, when applicable.
|
|
535
|
-
*/
|
|
536
|
-
annotations?: Array<{ [key: string]: unknown }>;
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Audio response data when using audio output modality.
|
|
540
|
-
*/
|
|
541
|
-
audio?: { [key: string]: unknown } | null;
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* The content of the message.
|
|
545
|
-
*/
|
|
546
|
-
content?: string | null;
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
550
|
-
*/
|
|
551
|
-
function_call?: Message.FunctionCall;
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* The refusal message generated by the model.
|
|
555
|
-
*/
|
|
556
|
-
refusal?: string | null;
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* The role of the message author, always 'assistant' in responses.
|
|
560
|
-
*/
|
|
561
|
-
role?: 'assistant';
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* The tool calls generated by the model.
|
|
565
|
-
*/
|
|
566
|
-
tool_calls?: Array<Message.Function | Message.Custom>;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
export namespace Message {
|
|
570
|
-
/**
|
|
571
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
572
|
-
*/
|
|
573
|
-
export interface FunctionCall {
|
|
574
|
-
/**
|
|
575
|
-
* Arguments to pass to the function as a JSON string.
|
|
576
|
-
*/
|
|
577
|
-
arguments: string;
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Name of the function to call.
|
|
581
|
-
*/
|
|
582
|
-
name: string;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
587
|
-
*/
|
|
588
|
-
export interface Function {
|
|
589
|
-
/**
|
|
590
|
-
* Unique identifier for the tool call.
|
|
591
|
-
*/
|
|
592
|
-
id: string;
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Function call details.
|
|
596
|
-
*/
|
|
597
|
-
function: Function.Function;
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Must be 'function' to identify this as a function call.
|
|
601
|
-
*/
|
|
602
|
-
type: 'function';
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
export namespace Function {
|
|
606
|
-
/**
|
|
607
|
-
* Function call details.
|
|
608
|
-
*/
|
|
609
|
-
export interface Function {
|
|
610
|
-
/**
|
|
611
|
-
* Arguments to pass to the function as a JSON string.
|
|
612
|
-
*/
|
|
613
|
-
arguments: string;
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Name of the function to call.
|
|
617
|
-
*/
|
|
618
|
-
name: string;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* A call to a custom tool created by the model.
|
|
624
|
-
*/
|
|
625
|
-
export interface Custom {
|
|
626
|
-
/**
|
|
627
|
-
* The ID of the tool call.
|
|
628
|
-
*/
|
|
629
|
-
id: string;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* The custom tool that the model called.
|
|
633
|
-
*/
|
|
634
|
-
custom: Custom.Custom;
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* The type of the tool. Always 'custom'.
|
|
638
|
-
*/
|
|
639
|
-
type: 'custom';
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
export namespace Custom {
|
|
643
|
-
/**
|
|
644
|
-
* The custom tool that the model called.
|
|
645
|
-
*/
|
|
646
|
-
export interface Custom {
|
|
647
|
-
/**
|
|
648
|
-
* The input for the custom tool call generated by the model.
|
|
649
|
-
*/
|
|
650
|
-
input: string;
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* The name of the custom tool to call.
|
|
654
|
-
*/
|
|
655
|
-
name: string;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* The log probabilities for the tokens in the message.
|
|
662
|
-
*/
|
|
663
|
-
export interface Logprobs {
|
|
664
|
-
/**
|
|
665
|
-
* The log probabilities for the tokens in the message.
|
|
666
|
-
*/
|
|
667
|
-
content?: Array<Logprobs.Content> | null;
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* The log probabilities for the refusal tokens.
|
|
671
|
-
*/
|
|
672
|
-
refusal?: Array<Logprobs.Refusal> | null;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
export namespace Logprobs {
|
|
676
|
-
/**
|
|
677
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
678
|
-
* response.
|
|
679
|
-
*/
|
|
680
|
-
export interface Content {
|
|
681
|
-
/**
|
|
682
|
-
* The token.
|
|
683
|
-
*/
|
|
684
|
-
token: string;
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* The log probability of the token.
|
|
688
|
-
*/
|
|
689
|
-
logprob: number;
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* The bytes for the token.
|
|
693
|
-
*/
|
|
694
|
-
bytes?: Array<number> | null;
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* The top log probabilities for the token.
|
|
698
|
-
*/
|
|
699
|
-
top_logprobs?: Array<Content.TopLogprob> | null;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
export namespace Content {
|
|
703
|
-
/**
|
|
704
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
705
|
-
* response.
|
|
706
|
-
*/
|
|
707
|
-
export interface TopLogprob {
|
|
708
|
-
/**
|
|
709
|
-
* The token.
|
|
710
|
-
*/
|
|
711
|
-
token: string;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* The log probability of the token.
|
|
715
|
-
*/
|
|
716
|
-
logprob: number;
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* The bytes for the token.
|
|
720
|
-
*/
|
|
721
|
-
bytes?: Array<number> | null;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
727
|
-
* response.
|
|
728
|
-
*/
|
|
729
|
-
export interface Refusal {
|
|
730
|
-
/**
|
|
731
|
-
* The token.
|
|
732
|
-
*/
|
|
733
|
-
token: string;
|
|
734
|
-
|
|
735
|
-
/**
|
|
736
|
-
* The log probability of the token.
|
|
737
|
-
*/
|
|
738
|
-
logprob: number;
|
|
739
|
-
|
|
740
|
-
/**
|
|
741
|
-
* The bytes for the token.
|
|
742
|
-
*/
|
|
743
|
-
bytes?: Array<number> | null;
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* The top log probabilities for the token.
|
|
747
|
-
*/
|
|
748
|
-
top_logprobs?: Array<Refusal.TopLogprob> | null;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
export namespace Refusal {
|
|
752
|
-
/**
|
|
753
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
754
|
-
* response.
|
|
755
|
-
*/
|
|
756
|
-
export interface TopLogprob {
|
|
757
|
-
/**
|
|
758
|
-
* The token.
|
|
759
|
-
*/
|
|
760
|
-
token: string;
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* The log probability of the token.
|
|
764
|
-
*/
|
|
765
|
-
logprob: number;
|
|
766
|
-
|
|
767
|
-
/**
|
|
768
|
-
* The bytes for the token.
|
|
769
|
-
*/
|
|
770
|
-
bytes?: Array<number> | null;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* A message from the user in an OpenAI-compatible chat completion request.
|
|
778
|
-
*/
|
|
779
|
-
export interface OpenAIUserMessageParamOutput {
|
|
780
|
-
/**
|
|
781
|
-
* The content of the message, which can include text and other media.
|
|
782
|
-
*/
|
|
783
|
-
content:
|
|
784
|
-
| string
|
|
785
|
-
| Array<
|
|
786
|
-
| OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam
|
|
787
|
-
| OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam
|
|
788
|
-
| OpenAIUserMessageParamOutput.OpenAIFile
|
|
789
|
-
>;
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* The name of the user message participant.
|
|
793
|
-
*/
|
|
794
|
-
name?: string | null;
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Must be 'user' to identify this as a user message.
|
|
798
|
-
*/
|
|
799
|
-
role?: 'user';
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
export namespace OpenAIUserMessageParamOutput {
|
|
803
|
-
/**
|
|
804
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
805
|
-
*/
|
|
806
|
-
export interface OpenAIChatCompletionContentPartTextParam {
|
|
807
|
-
/**
|
|
808
|
-
* The text content of the message.
|
|
809
|
-
*/
|
|
810
|
-
text: string;
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* Must be 'text' to identify this as text content.
|
|
814
|
-
*/
|
|
815
|
-
type?: 'text';
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Image content part for OpenAI-compatible chat completion messages.
|
|
820
|
-
*/
|
|
821
|
-
export interface OpenAIChatCompletionContentPartImageParam {
|
|
822
|
-
/**
|
|
823
|
-
* Image URL specification and processing details.
|
|
824
|
-
*/
|
|
825
|
-
image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* Must be 'image_url' to identify this as image content.
|
|
829
|
-
*/
|
|
830
|
-
type?: 'image_url';
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
export namespace OpenAIChatCompletionContentPartImageParam {
|
|
834
|
-
/**
|
|
835
|
-
* Image URL specification and processing details.
|
|
836
|
-
*/
|
|
837
|
-
export interface ImageURL {
|
|
838
|
-
/**
|
|
839
|
-
* URL of the image to include in the message.
|
|
840
|
-
*/
|
|
841
|
-
url: string;
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Level of detail for image processing. Can be 'low', 'high', or 'auto'.
|
|
845
|
-
*/
|
|
846
|
-
detail?: 'low' | 'high' | 'auto' | null;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* File content part for OpenAI-compatible chat completion messages.
|
|
852
|
-
*/
|
|
853
|
-
export interface OpenAIFile {
|
|
854
|
-
/**
|
|
855
|
-
* File specification.
|
|
856
|
-
*/
|
|
857
|
-
file: OpenAIFile.File;
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
* Must be 'file' to identify this as file content.
|
|
861
|
-
*/
|
|
862
|
-
type?: 'file';
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
export namespace OpenAIFile {
|
|
866
|
-
/**
|
|
867
|
-
* File specification.
|
|
868
|
-
*/
|
|
869
|
-
export interface File {
|
|
870
|
-
/**
|
|
871
|
-
* Base64-encoded file data.
|
|
872
|
-
*/
|
|
873
|
-
file_data?: string | null;
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
* ID of an uploaded file.
|
|
877
|
-
*/
|
|
878
|
-
file_id?: string | null;
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Name of the file.
|
|
882
|
-
*/
|
|
883
|
-
filename?: string | null;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* A system message providing instructions or context to the model.
|
|
890
|
-
*/
|
|
891
|
-
export interface OpenAISystemMessageParam {
|
|
892
|
-
/**
|
|
893
|
-
* The content of the 'system prompt'. If multiple system messages are provided,
|
|
894
|
-
* they are concatenated.
|
|
895
|
-
*/
|
|
896
|
-
content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* The name of the system message participant.
|
|
900
|
-
*/
|
|
901
|
-
name?: string | null;
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Must be 'system' to identify this as a system message.
|
|
905
|
-
*/
|
|
906
|
-
role?: 'system';
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
export namespace OpenAISystemMessageParam {
|
|
910
|
-
/**
|
|
911
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
912
|
-
*/
|
|
913
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
914
|
-
/**
|
|
915
|
-
* The text content of the message.
|
|
916
|
-
*/
|
|
917
|
-
text: string;
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Must be 'text' to identify this as text content.
|
|
921
|
-
*/
|
|
922
|
-
type?: 'text';
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* A message containing the model's (assistant) response in an OpenAI-compatible
|
|
928
|
-
* chat completion request.
|
|
929
|
-
*/
|
|
930
|
-
export interface OpenAIAssistantMessageParamOutput {
|
|
931
|
-
/**
|
|
932
|
-
* The content of the model's response.
|
|
933
|
-
*/
|
|
934
|
-
content?:
|
|
935
|
-
| string
|
|
936
|
-
| Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam>
|
|
937
|
-
| null;
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* The name of the assistant message participant.
|
|
941
|
-
*/
|
|
942
|
-
name?: string | null;
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* Must be 'assistant' to identify this as the model's response.
|
|
946
|
-
*/
|
|
947
|
-
role?: 'assistant';
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
|
|
951
|
-
*/
|
|
952
|
-
tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
|
|
953
|
-
|
|
954
|
-
[k: string]: unknown;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
export namespace OpenAIAssistantMessageParamOutput {
|
|
958
|
-
/**
|
|
959
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
960
|
-
*/
|
|
961
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
962
|
-
/**
|
|
963
|
-
* The text content of the message.
|
|
964
|
-
*/
|
|
965
|
-
text: string;
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Must be 'text' to identify this as text content.
|
|
969
|
-
*/
|
|
970
|
-
type?: 'text';
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
/**
|
|
974
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
975
|
-
*/
|
|
976
|
-
export interface ToolCall {
|
|
977
|
-
/**
|
|
978
|
-
* Unique identifier for the tool call.
|
|
979
|
-
*/
|
|
980
|
-
id: string;
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Function call details.
|
|
984
|
-
*/
|
|
985
|
-
function: ToolCall.Function;
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Must be 'function' to identify this as a function call.
|
|
989
|
-
*/
|
|
990
|
-
type: 'function';
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
export namespace ToolCall {
|
|
994
|
-
/**
|
|
995
|
-
* Function call details.
|
|
996
|
-
*/
|
|
997
|
-
export interface Function {
|
|
998
|
-
/**
|
|
999
|
-
* Arguments to pass to the function as a JSON string.
|
|
1000
|
-
*/
|
|
1001
|
-
arguments: string;
|
|
1002
|
-
|
|
1003
|
-
/**
|
|
1004
|
-
* Name of the function to call.
|
|
1005
|
-
*/
|
|
1006
|
-
name: string;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
* A message representing the result of a tool invocation in an OpenAI-compatible
|
|
1013
|
-
* chat completion request.
|
|
1014
|
-
*/
|
|
1015
|
-
export interface OpenAIToolMessageParam {
|
|
1016
|
-
/**
|
|
1017
|
-
* The response content from the tool.
|
|
1018
|
-
*/
|
|
1019
|
-
content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
* Unique identifier for the tool call this response is for.
|
|
1023
|
-
*/
|
|
1024
|
-
tool_call_id: string;
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* Must be 'tool' to identify this as a tool response.
|
|
1028
|
-
*/
|
|
1029
|
-
role?: 'tool';
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
export namespace OpenAIToolMessageParam {
|
|
1033
|
-
/**
|
|
1034
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1035
|
-
*/
|
|
1036
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1037
|
-
/**
|
|
1038
|
-
* The text content of the message.
|
|
1039
|
-
*/
|
|
1040
|
-
text: string;
|
|
1041
|
-
|
|
1042
|
-
/**
|
|
1043
|
-
* Must be 'text' to identify this as text content.
|
|
1044
|
-
*/
|
|
1045
|
-
type?: 'text';
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* A message from the developer in an OpenAI-compatible chat completion request.
|
|
1051
|
-
*/
|
|
1052
|
-
export interface OpenAIDeveloperMessageParam {
|
|
1053
|
-
/**
|
|
1054
|
-
* The content of the developer message.
|
|
1055
|
-
*/
|
|
1056
|
-
content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
1057
|
-
|
|
1058
|
-
/**
|
|
1059
|
-
* The name of the developer message participant.
|
|
1060
|
-
*/
|
|
1061
|
-
name?: string | null;
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
* Must be 'developer' to identify this as a developer message.
|
|
1065
|
-
*/
|
|
1066
|
-
role?: 'developer';
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
export namespace OpenAIDeveloperMessageParam {
|
|
1070
|
-
/**
|
|
1071
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1072
|
-
*/
|
|
1073
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1074
|
-
/**
|
|
1075
|
-
* The text content of the message.
|
|
1076
|
-
*/
|
|
1077
|
-
text: string;
|
|
1078
|
-
|
|
1079
|
-
/**
|
|
1080
|
-
* Must be 'text' to identify this as text content.
|
|
1081
|
-
*/
|
|
1082
|
-
type?: 'text';
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Token usage information for the completion.
|
|
1088
|
-
*/
|
|
1089
|
-
export interface Usage {
|
|
1090
|
-
/**
|
|
1091
|
-
* Number of tokens in the completion.
|
|
1092
|
-
*/
|
|
1093
|
-
completion_tokens?: number;
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
* Detailed breakdown of output token usage.
|
|
1097
|
-
*/
|
|
1098
|
-
completion_tokens_details?: Usage.CompletionTokensDetails;
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Number of tokens in the prompt.
|
|
1102
|
-
*/
|
|
1103
|
-
prompt_tokens?: number;
|
|
1104
|
-
|
|
1105
|
-
/**
|
|
1106
|
-
* Detailed breakdown of input token usage.
|
|
1107
|
-
*/
|
|
1108
|
-
prompt_tokens_details?: Usage.PromptTokensDetails;
|
|
1109
|
-
|
|
1110
|
-
/**
|
|
1111
|
-
* Total tokens used (prompt + completion).
|
|
1112
|
-
*/
|
|
1113
|
-
total_tokens?: number;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
export namespace Usage {
|
|
1117
|
-
/**
|
|
1118
|
-
* Detailed breakdown of output token usage.
|
|
1119
|
-
*/
|
|
1120
|
-
export interface CompletionTokensDetails {
|
|
1121
|
-
/**
|
|
1122
|
-
* Number of tokens used for reasoning (o1/o3 models).
|
|
1123
|
-
*/
|
|
1124
|
-
reasoning_tokens?: number;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
* Detailed breakdown of input token usage.
|
|
1129
|
-
*/
|
|
1130
|
-
export interface PromptTokensDetails {
|
|
1131
|
-
/**
|
|
1132
|
-
* Number of tokens retrieved from cache.
|
|
1133
|
-
*/
|
|
1134
|
-
cached_tokens?: number;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* Response from listing OpenAI-compatible chat completions.
|
|
1141
|
-
*/
|
|
1142
|
-
export interface CompletionListResponse {
|
|
1143
|
-
/**
|
|
1144
|
-
* List of chat completion objects with their input messages.
|
|
1145
|
-
*/
|
|
1146
|
-
data: Array<CompletionListResponse.Data>;
|
|
1147
|
-
|
|
1148
|
-
/**
|
|
1149
|
-
* ID of the first completion in this list.
|
|
1150
|
-
*/
|
|
1151
|
-
first_id: string;
|
|
1152
|
-
|
|
1153
|
-
/**
|
|
1154
|
-
* Whether there are more completions available beyond this list.
|
|
1155
|
-
*/
|
|
1156
|
-
has_more: boolean;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* ID of the last completion in this list.
|
|
1160
|
-
*/
|
|
1161
|
-
last_id: string;
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* Must be 'list' to identify this as a list response.
|
|
1165
|
-
*/
|
|
1166
|
-
object?: 'list';
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
export namespace CompletionListResponse {
|
|
1170
|
-
/**
|
|
1171
|
-
* Chat completion response extended with the original input messages.
|
|
1172
|
-
*/
|
|
1173
|
-
export interface Data {
|
|
1174
|
-
/**
|
|
1175
|
-
* The ID of the chat completion.
|
|
1176
|
-
*/
|
|
1177
|
-
id: string;
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* List of choices.
|
|
1181
|
-
*/
|
|
1182
|
-
choices: Array<Data.Choice>;
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
* The Unix timestamp in seconds when the chat completion was created.
|
|
1186
|
-
*/
|
|
1187
|
-
created: number;
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* The input messages used to generate this completion.
|
|
1191
|
-
*/
|
|
1192
|
-
input_messages: Array<
|
|
1193
|
-
| Data.OpenAIUserMessageParamOutput
|
|
1194
|
-
| Data.OpenAISystemMessageParam
|
|
1195
|
-
| Data.OpenAIAssistantMessageParamOutput
|
|
1196
|
-
| Data.OpenAIToolMessageParam
|
|
1197
|
-
| Data.OpenAIDeveloperMessageParam
|
|
1198
|
-
>;
|
|
1199
|
-
|
|
1200
|
-
/**
|
|
1201
|
-
* The model that was used to generate the chat completion.
|
|
1202
|
-
*/
|
|
1203
|
-
model: string;
|
|
1204
|
-
|
|
1205
|
-
/**
|
|
1206
|
-
* The object type.
|
|
1207
|
-
*/
|
|
1208
|
-
object?: 'chat.completion';
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* The service tier that was used for this response.
|
|
1212
|
-
*/
|
|
1213
|
-
service_tier?: string | null;
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* System fingerprint for this completion.
|
|
1217
|
-
*/
|
|
1218
|
-
system_fingerprint?: string;
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* Token usage information for the completion.
|
|
1222
|
-
*/
|
|
1223
|
-
usage?: Data.Usage;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
export namespace Data {
|
|
1227
|
-
/**
|
|
1228
|
-
* A choice from an OpenAI-compatible chat completion response.
|
|
1229
|
-
*/
|
|
1230
|
-
export interface Choice {
|
|
1231
|
-
/**
|
|
1232
|
-
* The reason the model stopped generating.
|
|
1233
|
-
*/
|
|
1234
|
-
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
|
|
1235
|
-
|
|
1236
|
-
/**
|
|
1237
|
-
* The index of the choice.
|
|
1238
|
-
*/
|
|
1239
|
-
index: number;
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* The message from the model.
|
|
1243
|
-
*/
|
|
1244
|
-
message: Choice.Message;
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* The log probabilities for the tokens in the message.
|
|
1248
|
-
*/
|
|
1249
|
-
logprobs?: Choice.Logprobs | null;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
export namespace Choice {
|
|
1253
|
-
/**
|
|
1254
|
-
* The message from the model.
|
|
1255
|
-
*/
|
|
1256
|
-
export interface Message {
|
|
1257
|
-
/**
|
|
1258
|
-
* Annotations for the message, when applicable.
|
|
1259
|
-
*/
|
|
1260
|
-
annotations?: Array<{ [key: string]: unknown }>;
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* Audio response data when using audio output modality.
|
|
1264
|
-
*/
|
|
1265
|
-
audio?: { [key: string]: unknown } | null;
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
* The content of the message.
|
|
1269
|
-
*/
|
|
1270
|
-
content?: string | null;
|
|
1271
|
-
|
|
1272
|
-
/**
|
|
1273
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
1274
|
-
*/
|
|
1275
|
-
function_call?: Message.FunctionCall;
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* The refusal message generated by the model.
|
|
1279
|
-
*/
|
|
1280
|
-
refusal?: string | null;
|
|
1281
|
-
|
|
1282
|
-
/**
|
|
1283
|
-
* The role of the message author, always 'assistant' in responses.
|
|
1284
|
-
*/
|
|
1285
|
-
role?: 'assistant';
|
|
1286
|
-
|
|
1287
|
-
/**
|
|
1288
|
-
* The tool calls generated by the model.
|
|
1289
|
-
*/
|
|
1290
|
-
tool_calls?: Array<Message.Function | Message.Custom>;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
export namespace Message {
|
|
1294
|
-
/**
|
|
1295
|
-
* Deprecated: the name and arguments of a function that should be called.
|
|
1296
|
-
*/
|
|
1297
|
-
export interface FunctionCall {
|
|
1298
|
-
/**
|
|
1299
|
-
* Arguments to pass to the function as a JSON string.
|
|
1300
|
-
*/
|
|
1301
|
-
arguments: string;
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* Name of the function to call.
|
|
1305
|
-
*/
|
|
1306
|
-
name: string;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
/**
|
|
1310
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
1311
|
-
*/
|
|
1312
|
-
export interface Function {
|
|
1313
|
-
/**
|
|
1314
|
-
* Unique identifier for the tool call.
|
|
1315
|
-
*/
|
|
1316
|
-
id: string;
|
|
1317
|
-
|
|
1318
|
-
/**
|
|
1319
|
-
* Function call details.
|
|
1320
|
-
*/
|
|
1321
|
-
function: Function.Function;
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* Must be 'function' to identify this as a function call.
|
|
1325
|
-
*/
|
|
1326
|
-
type: 'function';
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
export namespace Function {
|
|
1330
|
-
/**
|
|
1331
|
-
* Function call details.
|
|
1332
|
-
*/
|
|
1333
|
-
export interface Function {
|
|
1334
|
-
/**
|
|
1335
|
-
* Arguments to pass to the function as a JSON string.
|
|
1336
|
-
*/
|
|
1337
|
-
arguments: string;
|
|
1338
|
-
|
|
1339
|
-
/**
|
|
1340
|
-
* Name of the function to call.
|
|
1341
|
-
*/
|
|
1342
|
-
name: string;
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* A call to a custom tool created by the model.
|
|
1348
|
-
*/
|
|
1349
|
-
export interface Custom {
|
|
1350
|
-
/**
|
|
1351
|
-
* The ID of the tool call.
|
|
1352
|
-
*/
|
|
1353
|
-
id: string;
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* The custom tool that the model called.
|
|
1357
|
-
*/
|
|
1358
|
-
custom: Custom.Custom;
|
|
1359
|
-
|
|
1360
|
-
/**
|
|
1361
|
-
* The type of the tool. Always 'custom'.
|
|
1362
|
-
*/
|
|
1363
|
-
type: 'custom';
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
export namespace Custom {
|
|
1367
|
-
/**
|
|
1368
|
-
* The custom tool that the model called.
|
|
1369
|
-
*/
|
|
1370
|
-
export interface Custom {
|
|
1371
|
-
/**
|
|
1372
|
-
* The input for the custom tool call generated by the model.
|
|
1373
|
-
*/
|
|
1374
|
-
input: string;
|
|
1375
|
-
|
|
1376
|
-
/**
|
|
1377
|
-
* The name of the custom tool to call.
|
|
1378
|
-
*/
|
|
1379
|
-
name: string;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
/**
|
|
1385
|
-
* The log probabilities for the tokens in the message.
|
|
1386
|
-
*/
|
|
1387
|
-
export interface Logprobs {
|
|
1388
|
-
/**
|
|
1389
|
-
* The log probabilities for the tokens in the message.
|
|
1390
|
-
*/
|
|
1391
|
-
content?: Array<Logprobs.Content> | null;
|
|
1392
|
-
|
|
1393
|
-
/**
|
|
1394
|
-
* The log probabilities for the refusal tokens.
|
|
1395
|
-
*/
|
|
1396
|
-
refusal?: Array<Logprobs.Refusal> | null;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
export namespace Logprobs {
|
|
1400
|
-
/**
|
|
1401
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
1402
|
-
* response.
|
|
1403
|
-
*/
|
|
1404
|
-
export interface Content {
|
|
1405
|
-
/**
|
|
1406
|
-
* The token.
|
|
1407
|
-
*/
|
|
1408
|
-
token: string;
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
* The log probability of the token.
|
|
1412
|
-
*/
|
|
1413
|
-
logprob: number;
|
|
1414
|
-
|
|
1415
|
-
/**
|
|
1416
|
-
* The bytes for the token.
|
|
1417
|
-
*/
|
|
1418
|
-
bytes?: Array<number> | null;
|
|
1419
|
-
|
|
1420
|
-
/**
|
|
1421
|
-
* The top log probabilities for the token.
|
|
1422
|
-
*/
|
|
1423
|
-
top_logprobs?: Array<Content.TopLogprob> | null;
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
export namespace Content {
|
|
1427
|
-
/**
|
|
1428
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
1429
|
-
* response.
|
|
1430
|
-
*/
|
|
1431
|
-
export interface TopLogprob {
|
|
1432
|
-
/**
|
|
1433
|
-
* The token.
|
|
1434
|
-
*/
|
|
1435
|
-
token: string;
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* The log probability of the token.
|
|
1439
|
-
*/
|
|
1440
|
-
logprob: number;
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* The bytes for the token.
|
|
1444
|
-
*/
|
|
1445
|
-
bytes?: Array<number> | null;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
/**
|
|
1450
|
-
* The log probability for a token from an OpenAI-compatible chat completion
|
|
1451
|
-
* response.
|
|
1452
|
-
*/
|
|
1453
|
-
export interface Refusal {
|
|
1454
|
-
/**
|
|
1455
|
-
* The token.
|
|
1456
|
-
*/
|
|
1457
|
-
token: string;
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1460
|
-
* The log probability of the token.
|
|
1461
|
-
*/
|
|
1462
|
-
logprob: number;
|
|
1463
|
-
|
|
1464
|
-
/**
|
|
1465
|
-
* The bytes for the token.
|
|
1466
|
-
*/
|
|
1467
|
-
bytes?: Array<number> | null;
|
|
1468
|
-
|
|
1469
|
-
/**
|
|
1470
|
-
* The top log probabilities for the token.
|
|
1471
|
-
*/
|
|
1472
|
-
top_logprobs?: Array<Refusal.TopLogprob> | null;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
export namespace Refusal {
|
|
1476
|
-
/**
|
|
1477
|
-
* The top log probability for a token from an OpenAI-compatible chat completion
|
|
1478
|
-
* response.
|
|
1479
|
-
*/
|
|
1480
|
-
export interface TopLogprob {
|
|
1481
|
-
/**
|
|
1482
|
-
* The token.
|
|
1483
|
-
*/
|
|
1484
|
-
token: string;
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* The log probability of the token.
|
|
1488
|
-
*/
|
|
1489
|
-
logprob: number;
|
|
1490
|
-
|
|
1491
|
-
/**
|
|
1492
|
-
* The bytes for the token.
|
|
1493
|
-
*/
|
|
1494
|
-
bytes?: Array<number> | null;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
/**
|
|
1501
|
-
* A message from the user in an OpenAI-compatible chat completion request.
|
|
1502
|
-
*/
|
|
1503
|
-
export interface OpenAIUserMessageParamOutput {
|
|
1504
|
-
/**
|
|
1505
|
-
* The content of the message, which can include text and other media.
|
|
1506
|
-
*/
|
|
1507
|
-
content:
|
|
1508
|
-
| string
|
|
1509
|
-
| Array<
|
|
1510
|
-
| OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam
|
|
1511
|
-
| OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam
|
|
1512
|
-
| OpenAIUserMessageParamOutput.OpenAIFile
|
|
1513
|
-
>;
|
|
1514
|
-
|
|
1515
|
-
/**
|
|
1516
|
-
* The name of the user message participant.
|
|
1517
|
-
*/
|
|
1518
|
-
name?: string | null;
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Must be 'user' to identify this as a user message.
|
|
1522
|
-
*/
|
|
1523
|
-
role?: 'user';
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
export namespace OpenAIUserMessageParamOutput {
|
|
1527
|
-
/**
|
|
1528
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1529
|
-
*/
|
|
1530
|
-
export interface OpenAIChatCompletionContentPartTextParam {
|
|
1531
|
-
/**
|
|
1532
|
-
* The text content of the message.
|
|
1533
|
-
*/
|
|
1534
|
-
text: string;
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* Must be 'text' to identify this as text content.
|
|
1538
|
-
*/
|
|
1539
|
-
type?: 'text';
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
/**
|
|
1543
|
-
* Image content part for OpenAI-compatible chat completion messages.
|
|
1544
|
-
*/
|
|
1545
|
-
export interface OpenAIChatCompletionContentPartImageParam {
|
|
1546
|
-
/**
|
|
1547
|
-
* Image URL specification and processing details.
|
|
1548
|
-
*/
|
|
1549
|
-
image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
|
|
1550
|
-
|
|
1551
|
-
/**
|
|
1552
|
-
* Must be 'image_url' to identify this as image content.
|
|
1553
|
-
*/
|
|
1554
|
-
type?: 'image_url';
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
export namespace OpenAIChatCompletionContentPartImageParam {
|
|
1558
|
-
/**
|
|
1559
|
-
* Image URL specification and processing details.
|
|
1560
|
-
*/
|
|
1561
|
-
export interface ImageURL {
|
|
1562
|
-
/**
|
|
1563
|
-
* URL of the image to include in the message.
|
|
1564
|
-
*/
|
|
1565
|
-
url: string;
|
|
1566
|
-
|
|
1567
|
-
/**
|
|
1568
|
-
* Level of detail for image processing. Can be 'low', 'high', or 'auto'.
|
|
1569
|
-
*/
|
|
1570
|
-
detail?: 'low' | 'high' | 'auto' | null;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
/**
|
|
1575
|
-
* File content part for OpenAI-compatible chat completion messages.
|
|
1576
|
-
*/
|
|
1577
|
-
export interface OpenAIFile {
|
|
1578
|
-
/**
|
|
1579
|
-
* File specification.
|
|
1580
|
-
*/
|
|
1581
|
-
file: OpenAIFile.File;
|
|
1582
|
-
|
|
1583
|
-
/**
|
|
1584
|
-
* Must be 'file' to identify this as file content.
|
|
1585
|
-
*/
|
|
1586
|
-
type?: 'file';
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
export namespace OpenAIFile {
|
|
1590
|
-
/**
|
|
1591
|
-
* File specification.
|
|
1592
|
-
*/
|
|
1593
|
-
export interface File {
|
|
1594
|
-
/**
|
|
1595
|
-
* Base64-encoded file data.
|
|
1596
|
-
*/
|
|
1597
|
-
file_data?: string | null;
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
* ID of an uploaded file.
|
|
1601
|
-
*/
|
|
1602
|
-
file_id?: string | null;
|
|
1603
|
-
|
|
1604
|
-
/**
|
|
1605
|
-
* Name of the file.
|
|
1606
|
-
*/
|
|
1607
|
-
filename?: string | null;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
/**
|
|
1613
|
-
* A system message providing instructions or context to the model.
|
|
1614
|
-
*/
|
|
1615
|
-
export interface OpenAISystemMessageParam {
|
|
1616
|
-
/**
|
|
1617
|
-
* The content of the 'system prompt'. If multiple system messages are provided,
|
|
1618
|
-
* they are concatenated.
|
|
1619
|
-
*/
|
|
1620
|
-
content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
1621
|
-
|
|
1622
|
-
/**
|
|
1623
|
-
* The name of the system message participant.
|
|
1624
|
-
*/
|
|
1625
|
-
name?: string | null;
|
|
1626
|
-
|
|
1627
|
-
/**
|
|
1628
|
-
* Must be 'system' to identify this as a system message.
|
|
1629
|
-
*/
|
|
1630
|
-
role?: 'system';
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
export namespace OpenAISystemMessageParam {
|
|
1634
|
-
/**
|
|
1635
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1636
|
-
*/
|
|
1637
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1638
|
-
/**
|
|
1639
|
-
* The text content of the message.
|
|
1640
|
-
*/
|
|
1641
|
-
text: string;
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* Must be 'text' to identify this as text content.
|
|
1645
|
-
*/
|
|
1646
|
-
type?: 'text';
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
/**
|
|
1651
|
-
* A message containing the model's (assistant) response in an OpenAI-compatible
|
|
1652
|
-
* chat completion request.
|
|
1653
|
-
*/
|
|
1654
|
-
export interface OpenAIAssistantMessageParamOutput {
|
|
1655
|
-
/**
|
|
1656
|
-
* The content of the model's response.
|
|
1657
|
-
*/
|
|
1658
|
-
content?:
|
|
1659
|
-
| string
|
|
1660
|
-
| Array<OpenAIAssistantMessageParamOutput.ListOpenAIChatCompletionContentPartTextParam>
|
|
1661
|
-
| null;
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1664
|
-
* The name of the assistant message participant.
|
|
1665
|
-
*/
|
|
1666
|
-
name?: string | null;
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Must be 'assistant' to identify this as the model's response.
|
|
1670
|
-
*/
|
|
1671
|
-
role?: 'assistant';
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
|
|
1675
|
-
*/
|
|
1676
|
-
tool_calls?: Array<OpenAIAssistantMessageParamOutput.ToolCall> | null;
|
|
1677
|
-
|
|
1678
|
-
[k: string]: unknown;
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
export namespace OpenAIAssistantMessageParamOutput {
|
|
1682
|
-
/**
|
|
1683
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1684
|
-
*/
|
|
1685
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1686
|
-
/**
|
|
1687
|
-
* The text content of the message.
|
|
1688
|
-
*/
|
|
1689
|
-
text: string;
|
|
1690
|
-
|
|
1691
|
-
/**
|
|
1692
|
-
* Must be 'text' to identify this as text content.
|
|
1693
|
-
*/
|
|
1694
|
-
type?: 'text';
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
/**
|
|
1698
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
1699
|
-
*/
|
|
1700
|
-
export interface ToolCall {
|
|
1701
|
-
/**
|
|
1702
|
-
* Unique identifier for the tool call.
|
|
1703
|
-
*/
|
|
1704
|
-
id: string;
|
|
1705
|
-
|
|
1706
|
-
/**
|
|
1707
|
-
* Function call details.
|
|
1708
|
-
*/
|
|
1709
|
-
function: ToolCall.Function;
|
|
1710
|
-
|
|
1711
|
-
/**
|
|
1712
|
-
* Must be 'function' to identify this as a function call.
|
|
1713
|
-
*/
|
|
1714
|
-
type: 'function';
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
export namespace ToolCall {
|
|
1718
|
-
/**
|
|
1719
|
-
* Function call details.
|
|
1720
|
-
*/
|
|
1721
|
-
export interface Function {
|
|
1722
|
-
/**
|
|
1723
|
-
* Arguments to pass to the function as a JSON string.
|
|
1724
|
-
*/
|
|
1725
|
-
arguments: string;
|
|
1726
|
-
|
|
1727
|
-
/**
|
|
1728
|
-
* Name of the function to call.
|
|
1729
|
-
*/
|
|
1730
|
-
name: string;
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
/**
|
|
1736
|
-
* A message representing the result of a tool invocation in an OpenAI-compatible
|
|
1737
|
-
* chat completion request.
|
|
1738
|
-
*/
|
|
1739
|
-
export interface OpenAIToolMessageParam {
|
|
1740
|
-
/**
|
|
1741
|
-
* The response content from the tool.
|
|
1742
|
-
*/
|
|
1743
|
-
content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* Unique identifier for the tool call this response is for.
|
|
1747
|
-
*/
|
|
1748
|
-
tool_call_id: string;
|
|
1749
|
-
|
|
1750
|
-
/**
|
|
1751
|
-
* Must be 'tool' to identify this as a tool response.
|
|
1752
|
-
*/
|
|
1753
|
-
role?: 'tool';
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
export namespace OpenAIToolMessageParam {
|
|
1757
|
-
/**
|
|
1758
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1759
|
-
*/
|
|
1760
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1761
|
-
/**
|
|
1762
|
-
* The text content of the message.
|
|
1763
|
-
*/
|
|
1764
|
-
text: string;
|
|
1765
|
-
|
|
1766
|
-
/**
|
|
1767
|
-
* Must be 'text' to identify this as text content.
|
|
1768
|
-
*/
|
|
1769
|
-
type?: 'text';
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
/**
|
|
1774
|
-
* A message from the developer in an OpenAI-compatible chat completion request.
|
|
1775
|
-
*/
|
|
1776
|
-
export interface OpenAIDeveloperMessageParam {
|
|
1777
|
-
/**
|
|
1778
|
-
* The content of the developer message.
|
|
1779
|
-
*/
|
|
1780
|
-
content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
1781
|
-
|
|
1782
|
-
/**
|
|
1783
|
-
* The name of the developer message participant.
|
|
1784
|
-
*/
|
|
1785
|
-
name?: string | null;
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* Must be 'developer' to identify this as a developer message.
|
|
1789
|
-
*/
|
|
1790
|
-
role?: 'developer';
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
export namespace OpenAIDeveloperMessageParam {
|
|
1794
|
-
/**
|
|
1795
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
1796
|
-
*/
|
|
1797
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
1798
|
-
/**
|
|
1799
|
-
* The text content of the message.
|
|
1800
|
-
*/
|
|
1801
|
-
text: string;
|
|
1802
|
-
|
|
1803
|
-
/**
|
|
1804
|
-
* Must be 'text' to identify this as text content.
|
|
1805
|
-
*/
|
|
1806
|
-
type?: 'text';
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
/**
|
|
1811
|
-
* Token usage information for the completion.
|
|
1812
|
-
*/
|
|
1813
|
-
export interface Usage {
|
|
1814
|
-
/**
|
|
1815
|
-
* Number of tokens in the completion.
|
|
1816
|
-
*/
|
|
1817
|
-
completion_tokens?: number;
|
|
1818
|
-
|
|
1819
|
-
/**
|
|
1820
|
-
* Detailed breakdown of output token usage.
|
|
1821
|
-
*/
|
|
1822
|
-
completion_tokens_details?: Usage.CompletionTokensDetails;
|
|
1823
|
-
|
|
1824
|
-
/**
|
|
1825
|
-
* Number of tokens in the prompt.
|
|
1826
|
-
*/
|
|
1827
|
-
prompt_tokens?: number;
|
|
1828
|
-
|
|
1829
|
-
/**
|
|
1830
|
-
* Detailed breakdown of input token usage.
|
|
1831
|
-
*/
|
|
1832
|
-
prompt_tokens_details?: Usage.PromptTokensDetails;
|
|
1833
|
-
|
|
1834
|
-
/**
|
|
1835
|
-
* Total tokens used (prompt + completion).
|
|
1836
|
-
*/
|
|
1837
|
-
total_tokens?: number;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
export namespace Usage {
|
|
1841
|
-
/**
|
|
1842
|
-
* Detailed breakdown of output token usage.
|
|
1843
|
-
*/
|
|
1844
|
-
export interface CompletionTokensDetails {
|
|
1845
|
-
/**
|
|
1846
|
-
* Number of tokens used for reasoning (o1/o3 models).
|
|
1847
|
-
*/
|
|
1848
|
-
reasoning_tokens?: number;
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1852
|
-
* Detailed breakdown of input token usage.
|
|
1853
|
-
*/
|
|
1854
|
-
export interface PromptTokensDetails {
|
|
1855
|
-
/**
|
|
1856
|
-
* Number of tokens retrieved from cache.
|
|
1857
|
-
*/
|
|
1858
|
-
cached_tokens?: number;
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
1865
|
-
|
|
1866
|
-
export interface CompletionCreateParamsBase {
|
|
1867
|
-
/**
|
|
1868
|
-
* List of messages in the conversation.
|
|
1869
|
-
*/
|
|
1870
|
-
messages: Array<
|
|
1871
|
-
| CompletionCreateParams.OpenAIUserMessageParamInput
|
|
1872
|
-
| CompletionCreateParams.OpenAISystemMessageParam
|
|
1873
|
-
| CompletionCreateParams.OpenAIAssistantMessageParamInput
|
|
1874
|
-
| CompletionCreateParams.OpenAIToolMessageParam
|
|
1875
|
-
| CompletionCreateParams.OpenAIDeveloperMessageParam
|
|
1876
|
-
>;
|
|
1877
|
-
|
|
1878
|
-
/**
|
|
1879
|
-
* The identifier of the model to use.
|
|
1880
|
-
*/
|
|
1881
|
-
model: string;
|
|
1882
|
-
|
|
1883
|
-
/**
|
|
1884
|
-
* The penalty for repeated tokens.
|
|
1885
|
-
*/
|
|
1886
|
-
frequency_penalty?: number | null;
|
|
1887
|
-
|
|
1888
|
-
/**
|
|
1889
|
-
* The function call to use.
|
|
1890
|
-
*/
|
|
1891
|
-
function_call?: string | { [key: string]: unknown } | null;
|
|
1892
|
-
|
|
1893
|
-
/**
|
|
1894
|
-
* List of functions to use.
|
|
1895
|
-
*/
|
|
1896
|
-
functions?: Array<{ [key: string]: unknown }> | null;
|
|
1897
|
-
|
|
1898
|
-
/**
|
|
1899
|
-
* The logit bias to use.
|
|
1900
|
-
*/
|
|
1901
|
-
logit_bias?: { [key: string]: number } | null;
|
|
1902
|
-
|
|
1903
|
-
/**
|
|
1904
|
-
* The log probabilities to use.
|
|
1905
|
-
*/
|
|
1906
|
-
logprobs?: boolean | null;
|
|
1907
|
-
|
|
1908
|
-
/**
|
|
1909
|
-
* The maximum number of tokens to generate.
|
|
1910
|
-
*/
|
|
1911
|
-
max_completion_tokens?: number | null;
|
|
1912
|
-
|
|
1913
|
-
/**
|
|
1914
|
-
* The maximum number of tokens to generate.
|
|
1915
|
-
*/
|
|
1916
|
-
max_tokens?: number | null;
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* The number of completions to generate.
|
|
1920
|
-
*/
|
|
1921
|
-
n?: number | null;
|
|
1922
|
-
|
|
1923
|
-
/**
|
|
1924
|
-
* Whether to parallelize tool calls.
|
|
1925
|
-
*/
|
|
1926
|
-
parallel_tool_calls?: boolean | null;
|
|
1927
|
-
|
|
1928
|
-
/**
|
|
1929
|
-
* The penalty for repeated tokens.
|
|
1930
|
-
*/
|
|
1931
|
-
presence_penalty?: number | null;
|
|
1932
|
-
|
|
1933
|
-
/**
|
|
1934
|
-
* A key to use when reading from or writing to the prompt cache.
|
|
1935
|
-
*/
|
|
1936
|
-
prompt_cache_key?: string | null;
|
|
1937
|
-
|
|
1938
|
-
/**
|
|
1939
|
-
* The effort level for reasoning models.
|
|
1940
|
-
*/
|
|
1941
|
-
reasoning_effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | null;
|
|
1942
|
-
|
|
1943
|
-
/**
|
|
1944
|
-
* The response format to use.
|
|
1945
|
-
*/
|
|
1946
|
-
response_format?:
|
|
1947
|
-
| CompletionCreateParams.OpenAIResponseFormatText
|
|
1948
|
-
| CompletionCreateParams.OpenAIResponseFormatJsonSchema
|
|
1949
|
-
| CompletionCreateParams.OpenAIResponseFormatJsonObject
|
|
1950
|
-
| null;
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* A stable identifier used for safety monitoring and abuse detection.
|
|
1954
|
-
*/
|
|
1955
|
-
safety_identifier?: string | null;
|
|
1956
|
-
|
|
1957
|
-
/**
|
|
1958
|
-
* The seed to use.
|
|
1959
|
-
*/
|
|
1960
|
-
seed?: number | null;
|
|
1961
|
-
|
|
1962
|
-
/**
|
|
1963
|
-
* The service tier for the request.
|
|
1964
|
-
*/
|
|
1965
|
-
service_tier?: 'auto' | 'default' | 'flex' | 'priority' | null;
|
|
1966
|
-
|
|
1967
|
-
/**
|
|
1968
|
-
* The stop tokens to use.
|
|
1969
|
-
*/
|
|
1970
|
-
stop?: string | Array<string> | null;
|
|
1971
|
-
|
|
1972
|
-
/**
|
|
1973
|
-
* Whether to stream the response.
|
|
1974
|
-
*/
|
|
1975
|
-
stream?: boolean | null;
|
|
1976
|
-
|
|
1977
|
-
/**
|
|
1978
|
-
* The stream options to use.
|
|
1979
|
-
*/
|
|
1980
|
-
stream_options?: { [key: string]: unknown } | null;
|
|
1981
|
-
|
|
1982
|
-
/**
|
|
1983
|
-
* The temperature to use.
|
|
1984
|
-
*/
|
|
1985
|
-
temperature?: number | null;
|
|
1986
|
-
|
|
1987
|
-
/**
|
|
1988
|
-
* The tool choice to use.
|
|
1989
|
-
*/
|
|
1990
|
-
tool_choice?: string | { [key: string]: unknown } | null;
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* The tools to use.
|
|
1994
|
-
*/
|
|
1995
|
-
tools?: Array<{ [key: string]: unknown }> | null;
|
|
1996
|
-
|
|
1997
|
-
/**
|
|
1998
|
-
* The number of most likely tokens to return at each position.
|
|
1999
|
-
*/
|
|
2000
|
-
top_logprobs?: number | null;
|
|
2001
|
-
|
|
2002
|
-
/**
|
|
2003
|
-
* The top p to use.
|
|
2004
|
-
*/
|
|
2005
|
-
top_p?: number | null;
|
|
2006
|
-
|
|
2007
|
-
/**
|
|
2008
|
-
* The user to use.
|
|
2009
|
-
*/
|
|
2010
|
-
user?: string | null;
|
|
2011
|
-
|
|
2012
|
-
[k: string]: unknown;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
export namespace CompletionCreateParams {
|
|
2016
|
-
/**
|
|
2017
|
-
* A message from the user in an OpenAI-compatible chat completion request.
|
|
2018
|
-
*/
|
|
2019
|
-
export interface OpenAIUserMessageParamInput {
|
|
2020
|
-
/**
|
|
2021
|
-
* The content of the message, which can include text and other media.
|
|
2022
|
-
*/
|
|
2023
|
-
content:
|
|
2024
|
-
| string
|
|
2025
|
-
| Array<
|
|
2026
|
-
| OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartTextParam
|
|
2027
|
-
| OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartImageParam
|
|
2028
|
-
| OpenAIUserMessageParamInput.OpenAIFile
|
|
2029
|
-
>;
|
|
2030
|
-
|
|
2031
|
-
/**
|
|
2032
|
-
* The name of the user message participant.
|
|
2033
|
-
*/
|
|
2034
|
-
name?: string | null;
|
|
2035
|
-
|
|
2036
|
-
/**
|
|
2037
|
-
* Must be 'user' to identify this as a user message.
|
|
2038
|
-
*/
|
|
2039
|
-
role?: 'user';
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
export namespace OpenAIUserMessageParamInput {
|
|
2043
|
-
/**
|
|
2044
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
2045
|
-
*/
|
|
2046
|
-
export interface OpenAIChatCompletionContentPartTextParam {
|
|
2047
|
-
/**
|
|
2048
|
-
* The text content of the message.
|
|
2049
|
-
*/
|
|
2050
|
-
text: string;
|
|
2051
|
-
|
|
2052
|
-
/**
|
|
2053
|
-
* Must be 'text' to identify this as text content.
|
|
2054
|
-
*/
|
|
2055
|
-
type?: 'text';
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
/**
|
|
2059
|
-
* Image content part for OpenAI-compatible chat completion messages.
|
|
2060
|
-
*/
|
|
2061
|
-
export interface OpenAIChatCompletionContentPartImageParam {
|
|
2062
|
-
/**
|
|
2063
|
-
* Image URL specification and processing details.
|
|
2064
|
-
*/
|
|
2065
|
-
image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* Must be 'image_url' to identify this as image content.
|
|
2069
|
-
*/
|
|
2070
|
-
type?: 'image_url';
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
export namespace OpenAIChatCompletionContentPartImageParam {
|
|
2074
|
-
/**
|
|
2075
|
-
* Image URL specification and processing details.
|
|
2076
|
-
*/
|
|
2077
|
-
export interface ImageURL {
|
|
2078
|
-
/**
|
|
2079
|
-
* URL of the image to include in the message.
|
|
2080
|
-
*/
|
|
2081
|
-
url: string;
|
|
2082
|
-
|
|
2083
|
-
/**
|
|
2084
|
-
* Level of detail for image processing. Can be 'low', 'high', or 'auto'.
|
|
2085
|
-
*/
|
|
2086
|
-
detail?: 'low' | 'high' | 'auto' | null;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* File content part for OpenAI-compatible chat completion messages.
|
|
2092
|
-
*/
|
|
2093
|
-
export interface OpenAIFile {
|
|
2094
|
-
/**
|
|
2095
|
-
* File specification.
|
|
2096
|
-
*/
|
|
2097
|
-
file: OpenAIFile.File;
|
|
2098
|
-
|
|
2099
|
-
/**
|
|
2100
|
-
* Must be 'file' to identify this as file content.
|
|
2101
|
-
*/
|
|
2102
|
-
type?: 'file';
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
export namespace OpenAIFile {
|
|
2106
|
-
/**
|
|
2107
|
-
* File specification.
|
|
2108
|
-
*/
|
|
2109
|
-
export interface File {
|
|
2110
|
-
/**
|
|
2111
|
-
* Base64-encoded file data.
|
|
2112
|
-
*/
|
|
2113
|
-
file_data?: string | null;
|
|
2114
|
-
|
|
2115
|
-
/**
|
|
2116
|
-
* ID of an uploaded file.
|
|
2117
|
-
*/
|
|
2118
|
-
file_id?: string | null;
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* Name of the file.
|
|
2122
|
-
*/
|
|
2123
|
-
filename?: string | null;
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* A system message providing instructions or context to the model.
|
|
2130
|
-
*/
|
|
2131
|
-
export interface OpenAISystemMessageParam {
|
|
2132
|
-
/**
|
|
2133
|
-
* The content of the 'system prompt'. If multiple system messages are provided,
|
|
2134
|
-
* they are concatenated.
|
|
2135
|
-
*/
|
|
2136
|
-
content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* The name of the system message participant.
|
|
2140
|
-
*/
|
|
2141
|
-
name?: string | null;
|
|
2142
|
-
|
|
2143
|
-
/**
|
|
2144
|
-
* Must be 'system' to identify this as a system message.
|
|
2145
|
-
*/
|
|
2146
|
-
role?: 'system';
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
export namespace OpenAISystemMessageParam {
|
|
2150
|
-
/**
|
|
2151
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
2152
|
-
*/
|
|
2153
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
2154
|
-
/**
|
|
2155
|
-
* The text content of the message.
|
|
2156
|
-
*/
|
|
2157
|
-
text: string;
|
|
2158
|
-
|
|
2159
|
-
/**
|
|
2160
|
-
* Must be 'text' to identify this as text content.
|
|
2161
|
-
*/
|
|
2162
|
-
type?: 'text';
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
/**
|
|
2167
|
-
* A message containing the model's (assistant) response in an OpenAI-compatible
|
|
2168
|
-
* chat completion request.
|
|
2169
|
-
*/
|
|
2170
|
-
export interface OpenAIAssistantMessageParamInput {
|
|
2171
|
-
/**
|
|
2172
|
-
* The content of the model's response.
|
|
2173
|
-
*/
|
|
2174
|
-
content?:
|
|
2175
|
-
| string
|
|
2176
|
-
| Array<OpenAIAssistantMessageParamInput.ListOpenAIChatCompletionContentPartTextParam>
|
|
2177
|
-
| null;
|
|
2178
|
-
|
|
2179
|
-
/**
|
|
2180
|
-
* The name of the assistant message participant.
|
|
2181
|
-
*/
|
|
2182
|
-
name?: string | null;
|
|
2183
|
-
|
|
2184
|
-
/**
|
|
2185
|
-
* Must be 'assistant' to identify this as the model's response.
|
|
2186
|
-
*/
|
|
2187
|
-
role?: 'assistant';
|
|
2188
|
-
|
|
2189
|
-
/**
|
|
2190
|
-
* List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
|
|
2191
|
-
*/
|
|
2192
|
-
tool_calls?: Array<OpenAIAssistantMessageParamInput.ToolCall> | null;
|
|
2193
|
-
|
|
2194
|
-
[k: string]: unknown;
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
export namespace OpenAIAssistantMessageParamInput {
|
|
2198
|
-
/**
|
|
2199
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
2200
|
-
*/
|
|
2201
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
2202
|
-
/**
|
|
2203
|
-
* The text content of the message.
|
|
2204
|
-
*/
|
|
2205
|
-
text: string;
|
|
2206
|
-
|
|
2207
|
-
/**
|
|
2208
|
-
* Must be 'text' to identify this as text content.
|
|
2209
|
-
*/
|
|
2210
|
-
type?: 'text';
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
/**
|
|
2214
|
-
* Tool call specification for OpenAI-compatible chat completion responses.
|
|
2215
|
-
*/
|
|
2216
|
-
export interface ToolCall {
|
|
2217
|
-
/**
|
|
2218
|
-
* Unique identifier for the tool call.
|
|
2219
|
-
*/
|
|
2220
|
-
id: string;
|
|
2221
|
-
|
|
2222
|
-
/**
|
|
2223
|
-
* Function call details.
|
|
2224
|
-
*/
|
|
2225
|
-
function: ToolCall.Function;
|
|
2226
|
-
|
|
2227
|
-
/**
|
|
2228
|
-
* Must be 'function' to identify this as a function call.
|
|
2229
|
-
*/
|
|
2230
|
-
type: 'function';
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
export namespace ToolCall {
|
|
2234
|
-
/**
|
|
2235
|
-
* Function call details.
|
|
2236
|
-
*/
|
|
2237
|
-
export interface Function {
|
|
2238
|
-
/**
|
|
2239
|
-
* Arguments to pass to the function as a JSON string.
|
|
2240
|
-
*/
|
|
2241
|
-
arguments: string;
|
|
2242
|
-
|
|
2243
|
-
/**
|
|
2244
|
-
* Name of the function to call.
|
|
2245
|
-
*/
|
|
2246
|
-
name: string;
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
/**
|
|
2252
|
-
* A message representing the result of a tool invocation in an OpenAI-compatible
|
|
2253
|
-
* chat completion request.
|
|
2254
|
-
*/
|
|
2255
|
-
export interface OpenAIToolMessageParam {
|
|
2256
|
-
/**
|
|
2257
|
-
* The response content from the tool.
|
|
2258
|
-
*/
|
|
2259
|
-
content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
2260
|
-
|
|
2261
|
-
/**
|
|
2262
|
-
* Unique identifier for the tool call this response is for.
|
|
2263
|
-
*/
|
|
2264
|
-
tool_call_id: string;
|
|
2265
|
-
|
|
2266
|
-
/**
|
|
2267
|
-
* Must be 'tool' to identify this as a tool response.
|
|
2268
|
-
*/
|
|
2269
|
-
role?: 'tool';
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
export namespace OpenAIToolMessageParam {
|
|
2273
|
-
/**
|
|
2274
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
2275
|
-
*/
|
|
2276
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
2277
|
-
/**
|
|
2278
|
-
* The text content of the message.
|
|
2279
|
-
*/
|
|
2280
|
-
text: string;
|
|
2281
|
-
|
|
2282
|
-
/**
|
|
2283
|
-
* Must be 'text' to identify this as text content.
|
|
2284
|
-
*/
|
|
2285
|
-
type?: 'text';
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
/**
|
|
2290
|
-
* A message from the developer in an OpenAI-compatible chat completion request.
|
|
2291
|
-
*/
|
|
2292
|
-
export interface OpenAIDeveloperMessageParam {
|
|
2293
|
-
/**
|
|
2294
|
-
* The content of the developer message.
|
|
2295
|
-
*/
|
|
2296
|
-
content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
|
|
2297
|
-
|
|
2298
|
-
/**
|
|
2299
|
-
* The name of the developer message participant.
|
|
2300
|
-
*/
|
|
2301
|
-
name?: string | null;
|
|
2302
|
-
|
|
2303
|
-
/**
|
|
2304
|
-
* Must be 'developer' to identify this as a developer message.
|
|
2305
|
-
*/
|
|
2306
|
-
role?: 'developer';
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
export namespace OpenAIDeveloperMessageParam {
|
|
2310
|
-
/**
|
|
2311
|
-
* Text content part for OpenAI-compatible chat completion messages.
|
|
2312
|
-
*/
|
|
2313
|
-
export interface ListOpenAIChatCompletionContentPartTextParam {
|
|
2314
|
-
/**
|
|
2315
|
-
* The text content of the message.
|
|
2316
|
-
*/
|
|
2317
|
-
text: string;
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* Must be 'text' to identify this as text content.
|
|
2321
|
-
*/
|
|
2322
|
-
type?: 'text';
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
/**
|
|
2327
|
-
* Text response format for OpenAI-compatible chat completion requests.
|
|
2328
|
-
*/
|
|
2329
|
-
export interface OpenAIResponseFormatText {
|
|
2330
|
-
/**
|
|
2331
|
-
* Must be 'text' to indicate plain text response format.
|
|
2332
|
-
*/
|
|
2333
|
-
type?: 'text';
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
/**
|
|
2337
|
-
* JSON schema response format for OpenAI-compatible chat completion requests.
|
|
2338
|
-
*/
|
|
2339
|
-
export interface OpenAIResponseFormatJsonSchema {
|
|
2340
|
-
/**
|
|
2341
|
-
* The JSON schema specification for the response.
|
|
2342
|
-
*/
|
|
2343
|
-
json_schema: OpenAIResponseFormatJsonSchema.JsonSchema;
|
|
2344
|
-
|
|
2345
|
-
/**
|
|
2346
|
-
* Must be 'json_schema' to indicate structured JSON response format.
|
|
2347
|
-
*/
|
|
2348
|
-
type?: 'json_schema';
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
export namespace OpenAIResponseFormatJsonSchema {
|
|
2352
|
-
/**
|
|
2353
|
-
* The JSON schema specification for the response.
|
|
2354
|
-
*/
|
|
2355
|
-
export interface JsonSchema {
|
|
2356
|
-
description?: string | null;
|
|
2357
|
-
|
|
2358
|
-
name?: string;
|
|
2359
|
-
|
|
2360
|
-
schema?: { [key: string]: unknown } | null;
|
|
2361
|
-
|
|
2362
|
-
strict?: boolean | null;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
/**
|
|
2367
|
-
* JSON object response format for OpenAI-compatible chat completion requests.
|
|
2368
|
-
*/
|
|
2369
|
-
export interface OpenAIResponseFormatJsonObject {
|
|
2370
|
-
/**
|
|
2371
|
-
* Must be 'json_object' to indicate generic JSON object response format.
|
|
2372
|
-
*/
|
|
2373
|
-
type?: 'json_object';
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
|
|
2377
|
-
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
|
-
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
2381
|
-
/**
|
|
2382
|
-
* Whether to stream the response.
|
|
2383
|
-
*/
|
|
2384
|
-
stream?: false | null;
|
|
2385
|
-
|
|
2386
|
-
[k: string]: unknown;
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
2390
|
-
/**
|
|
2391
|
-
* Whether to stream the response.
|
|
2392
|
-
*/
|
|
2393
|
-
stream: true;
|
|
2394
|
-
|
|
2395
|
-
[k: string]: unknown;
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
export interface CompletionListParams {
|
|
2399
|
-
/**
|
|
2400
|
-
* The ID of the last chat completion to return.
|
|
2401
|
-
*/
|
|
2402
|
-
after?: string | null;
|
|
2403
|
-
|
|
2404
|
-
/**
|
|
2405
|
-
* The maximum number of chat completions to return.
|
|
2406
|
-
*/
|
|
2407
|
-
limit?: number | null;
|
|
2408
|
-
|
|
2409
|
-
/**
|
|
2410
|
-
* The model to filter by.
|
|
2411
|
-
*/
|
|
2412
|
-
model?: string | null;
|
|
2413
|
-
|
|
2414
|
-
/**
|
|
2415
|
-
* The order to sort the chat completions by: "asc" or "desc". Defaults to "desc".
|
|
2416
|
-
*/
|
|
2417
|
-
order?: 'asc' | 'desc' | null;
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
export declare namespace Completions {
|
|
2421
|
-
export {
|
|
2422
|
-
type CompletionCreateResponse as CompletionCreateResponse,
|
|
2423
|
-
type CompletionRetrieveResponse as CompletionRetrieveResponse,
|
|
2424
|
-
type CompletionListResponse as CompletionListResponse,
|
|
2425
|
-
type CompletionCreateParams as CompletionCreateParams,
|
|
2426
|
-
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
|
|
2427
|
-
type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
|
|
2428
|
-
type CompletionListParams as CompletionListParams,
|
|
2429
|
-
};
|
|
2430
|
-
}
|
|
9
|
+
export * from './completions/index';
|