objectiveai 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/LICENSE +21 -0
- package/dist/index.d.ts +1238 -0
- package/dist/index.js +1207 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1238 @@
|
|
|
1
|
+
import OpenAI from "openai";
|
|
2
|
+
import { Stream } from "openai/streaming";
|
|
3
|
+
export declare namespace Chat {
|
|
4
|
+
namespace Completions {
|
|
5
|
+
namespace Request {
|
|
6
|
+
interface ChatCompletionCreateParamsBase {
|
|
7
|
+
messages: Message[];
|
|
8
|
+
model: string;
|
|
9
|
+
frequency_penalty?: number | null;
|
|
10
|
+
logit_bias?: Record<string, number> | null;
|
|
11
|
+
logprobs?: boolean | null;
|
|
12
|
+
max_completion_tokens?: number | null;
|
|
13
|
+
modalities?: string[] | null;
|
|
14
|
+
n?: number | null;
|
|
15
|
+
parallel_tool_calls?: boolean | null;
|
|
16
|
+
prediction?: Prediction | null;
|
|
17
|
+
presence_penalty?: number | null;
|
|
18
|
+
reasoning_effort?: ReasoningEffort | null;
|
|
19
|
+
response_format?: ResponseFormat | null;
|
|
20
|
+
seed?: number | null;
|
|
21
|
+
service_tier?: ServiceTier | null;
|
|
22
|
+
stop?: Stop | null;
|
|
23
|
+
stream_options?: StreamOptions | null;
|
|
24
|
+
temperature?: number | null;
|
|
25
|
+
tool_choice?: ToolChoice | null;
|
|
26
|
+
tools?: Tool[] | null;
|
|
27
|
+
top_logprobs?: number | null;
|
|
28
|
+
top_p?: number | null;
|
|
29
|
+
web_search_options?: WebSearchOptions | null;
|
|
30
|
+
max_tokens?: number | null;
|
|
31
|
+
min_p?: number | null;
|
|
32
|
+
plugins?: Plugin[] | null;
|
|
33
|
+
provider?: ProviderPreferences | null;
|
|
34
|
+
reasoning?: Reasoning | null;
|
|
35
|
+
repetition_penalty?: number | null;
|
|
36
|
+
top_a?: number | null;
|
|
37
|
+
top_k?: number | null;
|
|
38
|
+
usage?: Usage | null;
|
|
39
|
+
verbosity?: Verbosity | null;
|
|
40
|
+
models?: string[] | null;
|
|
41
|
+
}
|
|
42
|
+
interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
43
|
+
stream: true;
|
|
44
|
+
}
|
|
45
|
+
interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
46
|
+
stream?: false | null;
|
|
47
|
+
}
|
|
48
|
+
type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
|
|
49
|
+
type ServiceTier = "auto" | "default" | "flex";
|
|
50
|
+
type Stop = string | string[];
|
|
51
|
+
interface Prediction {
|
|
52
|
+
content: Prediction.Content;
|
|
53
|
+
type: "content";
|
|
54
|
+
}
|
|
55
|
+
namespace Prediction {
|
|
56
|
+
type Content = string | Content.Part[];
|
|
57
|
+
namespace Content {
|
|
58
|
+
interface Part {
|
|
59
|
+
text: string;
|
|
60
|
+
type: "text";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
type ReasoningEffort = "low" | "medium" | "high";
|
|
65
|
+
type ResponseFormat = ResponseFormat.Text | ResponseFormat.JsonObject | ResponseFormat.JsonSchema;
|
|
66
|
+
namespace ResponseFormat {
|
|
67
|
+
interface Text {
|
|
68
|
+
type: "text";
|
|
69
|
+
}
|
|
70
|
+
interface JsonObject {
|
|
71
|
+
type: "json_object";
|
|
72
|
+
}
|
|
73
|
+
interface JsonSchema {
|
|
74
|
+
type: "json_schema";
|
|
75
|
+
json_schema: JsonSchema.JsonSchema;
|
|
76
|
+
}
|
|
77
|
+
namespace JsonSchema {
|
|
78
|
+
interface JsonSchema {
|
|
79
|
+
name: string;
|
|
80
|
+
description?: string | null;
|
|
81
|
+
schema?: JsonValue;
|
|
82
|
+
strict?: boolean | null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
interface StreamOptions {
|
|
87
|
+
include_usage?: boolean;
|
|
88
|
+
}
|
|
89
|
+
type ToolChoice = "none" | "auto" | "required" | ToolChoice.Function;
|
|
90
|
+
namespace ToolChoice {
|
|
91
|
+
interface Function {
|
|
92
|
+
type: "function";
|
|
93
|
+
function: Function.Function;
|
|
94
|
+
}
|
|
95
|
+
namespace Function {
|
|
96
|
+
interface Function {
|
|
97
|
+
name: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
interface WebSearchOptions {
|
|
102
|
+
search_context_size?: WebSearchOptions.SearchContextSize | null;
|
|
103
|
+
user_location?: WebSearchOptions.UserLocation | null;
|
|
104
|
+
}
|
|
105
|
+
namespace WebSearchOptions {
|
|
106
|
+
type SearchContextSize = "low" | "medium" | "high";
|
|
107
|
+
interface UserLocation {
|
|
108
|
+
approximate: UserLocation.Approximate;
|
|
109
|
+
type: "approximate";
|
|
110
|
+
}
|
|
111
|
+
namespace UserLocation {
|
|
112
|
+
interface Approximate {
|
|
113
|
+
city?: string | null;
|
|
114
|
+
country?: string | null;
|
|
115
|
+
region?: string | null;
|
|
116
|
+
timezone?: string | null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
type Tool = Tool.Function;
|
|
121
|
+
namespace Tool {
|
|
122
|
+
interface Function {
|
|
123
|
+
function: Function.Definition;
|
|
124
|
+
type: "function";
|
|
125
|
+
}
|
|
126
|
+
namespace Function {
|
|
127
|
+
interface Definition {
|
|
128
|
+
name: string;
|
|
129
|
+
description?: string | null;
|
|
130
|
+
parameters?: JsonValue;
|
|
131
|
+
strict?: boolean | null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
type Message = Message.Developer | Message.System | Message.User | Message.Assistant | Message.Tool;
|
|
136
|
+
namespace Message {
|
|
137
|
+
interface Developer {
|
|
138
|
+
role: "developer";
|
|
139
|
+
content: Developer.Content;
|
|
140
|
+
name?: string;
|
|
141
|
+
}
|
|
142
|
+
namespace Developer {
|
|
143
|
+
type Content = string | Content.Part[];
|
|
144
|
+
namespace Content {
|
|
145
|
+
interface Part {
|
|
146
|
+
text: string;
|
|
147
|
+
type: "text";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
interface System {
|
|
152
|
+
role: "system";
|
|
153
|
+
content: System.Content;
|
|
154
|
+
name?: string;
|
|
155
|
+
}
|
|
156
|
+
namespace System {
|
|
157
|
+
type Content = string | Content.Part[];
|
|
158
|
+
namespace Content {
|
|
159
|
+
interface Part {
|
|
160
|
+
text: string;
|
|
161
|
+
type: "text";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
interface User {
|
|
166
|
+
role: "user";
|
|
167
|
+
content: User.Content;
|
|
168
|
+
name?: string;
|
|
169
|
+
}
|
|
170
|
+
namespace User {
|
|
171
|
+
type Content = string | Content.Part[];
|
|
172
|
+
namespace Content {
|
|
173
|
+
type Part = Part.Text | Part.ImageUrl | Part.InputAudio | Part.File;
|
|
174
|
+
namespace Part {
|
|
175
|
+
interface Text {
|
|
176
|
+
text: string;
|
|
177
|
+
type: "text";
|
|
178
|
+
}
|
|
179
|
+
interface ImageUrl {
|
|
180
|
+
image_url: ImageUrl.Definition;
|
|
181
|
+
type: "image_url";
|
|
182
|
+
}
|
|
183
|
+
namespace ImageUrl {
|
|
184
|
+
interface Definition {
|
|
185
|
+
url: string;
|
|
186
|
+
detail?: ImageUrl.Detail | null;
|
|
187
|
+
}
|
|
188
|
+
type Detail = "auto" | "low" | "high";
|
|
189
|
+
}
|
|
190
|
+
interface InputAudio {
|
|
191
|
+
input_audio: InputAudio.Definition;
|
|
192
|
+
type: "input_audio";
|
|
193
|
+
}
|
|
194
|
+
namespace InputAudio {
|
|
195
|
+
interface Definition {
|
|
196
|
+
data: string;
|
|
197
|
+
format: Format;
|
|
198
|
+
}
|
|
199
|
+
type Format = "wav" | "mp3";
|
|
200
|
+
}
|
|
201
|
+
interface File {
|
|
202
|
+
file: File.Definition;
|
|
203
|
+
type: "file";
|
|
204
|
+
}
|
|
205
|
+
namespace File {
|
|
206
|
+
interface Definition {
|
|
207
|
+
file_data?: string | null;
|
|
208
|
+
file_id?: string | null;
|
|
209
|
+
filename?: string | null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
interface Assistant {
|
|
216
|
+
role: "assistant";
|
|
217
|
+
content?: Assistant.Content | null;
|
|
218
|
+
name?: string | null;
|
|
219
|
+
refusal?: string | null;
|
|
220
|
+
tool_calls?: Assistant.ToolCall[] | null;
|
|
221
|
+
}
|
|
222
|
+
namespace Assistant {
|
|
223
|
+
type Content = string | Content.Part[];
|
|
224
|
+
namespace Content {
|
|
225
|
+
type Part = Part.Text | Part.Refusal;
|
|
226
|
+
namespace Part {
|
|
227
|
+
interface Text {
|
|
228
|
+
text: string;
|
|
229
|
+
type: "text";
|
|
230
|
+
}
|
|
231
|
+
interface Refusal {
|
|
232
|
+
refusal: string;
|
|
233
|
+
type: "refusal";
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
type ToolCall = ToolCall.Function;
|
|
238
|
+
namespace ToolCall {
|
|
239
|
+
interface Function {
|
|
240
|
+
id: string;
|
|
241
|
+
function: Function.Definition;
|
|
242
|
+
type: "function";
|
|
243
|
+
}
|
|
244
|
+
namespace Function {
|
|
245
|
+
interface Definition {
|
|
246
|
+
name: string;
|
|
247
|
+
arguments: string;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
interface Tool {
|
|
253
|
+
role: "tool";
|
|
254
|
+
content?: Tool.Content | null;
|
|
255
|
+
tool_call_id: string;
|
|
256
|
+
}
|
|
257
|
+
namespace Tool {
|
|
258
|
+
type Content = string | Content.Part[];
|
|
259
|
+
namespace Content {
|
|
260
|
+
interface Part {
|
|
261
|
+
text: string;
|
|
262
|
+
type: "text";
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
interface ProviderPreferences {
|
|
268
|
+
order?: string[] | null;
|
|
269
|
+
allow_fallbacks?: boolean | null;
|
|
270
|
+
require_parameters?: boolean | null;
|
|
271
|
+
data_collection?: ProviderPreferences.DataCollection | null;
|
|
272
|
+
only?: string[] | null;
|
|
273
|
+
ignore?: string[] | null;
|
|
274
|
+
quantizations?: string[] | null;
|
|
275
|
+
sort?: string | null;
|
|
276
|
+
}
|
|
277
|
+
namespace ProviderPreferences {
|
|
278
|
+
type DataCollection = "allow" | "deny";
|
|
279
|
+
}
|
|
280
|
+
interface Plugin {
|
|
281
|
+
id: string;
|
|
282
|
+
[key: string]: JsonValue;
|
|
283
|
+
}
|
|
284
|
+
interface Reasoning {
|
|
285
|
+
max_tokens?: number | null;
|
|
286
|
+
effort?: ReasoningEffort | null;
|
|
287
|
+
enabled?: boolean | null;
|
|
288
|
+
}
|
|
289
|
+
interface Usage {
|
|
290
|
+
include: boolean;
|
|
291
|
+
}
|
|
292
|
+
type Verbosity = "low" | "medium" | "high";
|
|
293
|
+
}
|
|
294
|
+
namespace Response {
|
|
295
|
+
namespace Streaming {
|
|
296
|
+
interface ChatCompletionChunk {
|
|
297
|
+
id: string;
|
|
298
|
+
choices: Choice[];
|
|
299
|
+
created: number;
|
|
300
|
+
model: string;
|
|
301
|
+
object: "chat.completion.chunk";
|
|
302
|
+
service_tier?: ServiceTier;
|
|
303
|
+
system_fingerprint?: string;
|
|
304
|
+
usage?: Usage;
|
|
305
|
+
provider?: string;
|
|
306
|
+
}
|
|
307
|
+
namespace ChatCompletionChunk {
|
|
308
|
+
function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
|
|
309
|
+
}
|
|
310
|
+
interface Choice {
|
|
311
|
+
delta: Delta;
|
|
312
|
+
finish_reason: FinishReason | null;
|
|
313
|
+
index: number;
|
|
314
|
+
logprobs?: Logprobs;
|
|
315
|
+
}
|
|
316
|
+
namespace Choice {
|
|
317
|
+
function merged(a: Choice, b: Choice): [Choice, boolean];
|
|
318
|
+
function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
|
|
319
|
+
}
|
|
320
|
+
interface Delta {
|
|
321
|
+
content?: string;
|
|
322
|
+
refusal?: string;
|
|
323
|
+
role?: Role;
|
|
324
|
+
tool_calls?: ToolCall[];
|
|
325
|
+
reasoning?: string;
|
|
326
|
+
images?: Image[];
|
|
327
|
+
}
|
|
328
|
+
namespace Delta {
|
|
329
|
+
function merged(a: Delta, b: Delta): [Delta, boolean];
|
|
330
|
+
}
|
|
331
|
+
type ToolCall = ToolCall.Function;
|
|
332
|
+
namespace ToolCall {
|
|
333
|
+
function merged(a: ToolCall, b: ToolCall): [ToolCall, boolean];
|
|
334
|
+
function mergedList(a: ToolCall[], b: ToolCall[]): [ToolCall[], boolean];
|
|
335
|
+
interface Function {
|
|
336
|
+
index: number;
|
|
337
|
+
id?: string;
|
|
338
|
+
function?: Function.Definition;
|
|
339
|
+
type?: "function";
|
|
340
|
+
}
|
|
341
|
+
namespace Function {
|
|
342
|
+
function merged(a: Function, b: Function): [Function, boolean];
|
|
343
|
+
interface Definition {
|
|
344
|
+
name?: string;
|
|
345
|
+
arguments?: string;
|
|
346
|
+
}
|
|
347
|
+
namespace Definition {
|
|
348
|
+
function merged(a: Definition, b: Definition): [Definition, boolean];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
namespace Unary {
|
|
354
|
+
interface ChatCompletion {
|
|
355
|
+
id: string;
|
|
356
|
+
choices: Choice[];
|
|
357
|
+
created: number;
|
|
358
|
+
model: string;
|
|
359
|
+
object: "chat.completion";
|
|
360
|
+
service_tier?: ServiceTier;
|
|
361
|
+
system_fingerprint?: string;
|
|
362
|
+
usage?: Usage;
|
|
363
|
+
provider?: string;
|
|
364
|
+
}
|
|
365
|
+
interface Choice {
|
|
366
|
+
message: Message;
|
|
367
|
+
finish_reason: FinishReason;
|
|
368
|
+
index: number;
|
|
369
|
+
logprobs: Logprobs | null;
|
|
370
|
+
}
|
|
371
|
+
interface Message {
|
|
372
|
+
content: string | null;
|
|
373
|
+
refusal: string | null;
|
|
374
|
+
role: Role;
|
|
375
|
+
annotations?: Annotation[];
|
|
376
|
+
audio?: Audio;
|
|
377
|
+
tool_calls?: ToolCall[];
|
|
378
|
+
reasoning?: string;
|
|
379
|
+
images?: Image[];
|
|
380
|
+
}
|
|
381
|
+
type Annotation = Annotation.UrlCitation;
|
|
382
|
+
namespace Annotation {
|
|
383
|
+
interface UrlCitation {
|
|
384
|
+
url_citation: UrlCitation.Definition;
|
|
385
|
+
}
|
|
386
|
+
namespace UrlCitation {
|
|
387
|
+
interface Definition {
|
|
388
|
+
end_index: number;
|
|
389
|
+
start_index: number;
|
|
390
|
+
title: string;
|
|
391
|
+
url: string;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
interface Audio {
|
|
396
|
+
id: string;
|
|
397
|
+
data: string;
|
|
398
|
+
expires_at: number;
|
|
399
|
+
transcript: string;
|
|
400
|
+
}
|
|
401
|
+
type ToolCall = ToolCall.Function;
|
|
402
|
+
namespace ToolCall {
|
|
403
|
+
interface Function {
|
|
404
|
+
id: string;
|
|
405
|
+
function: Function.Definition;
|
|
406
|
+
type: "function";
|
|
407
|
+
}
|
|
408
|
+
namespace Function {
|
|
409
|
+
interface Definition {
|
|
410
|
+
name: string;
|
|
411
|
+
arguments: string;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
type ServiceTier = "auto" | "default" | "flex";
|
|
417
|
+
type FinishReason = "stop" | "length" | "tool_calls" | "content_filter" | "error";
|
|
418
|
+
interface Usage {
|
|
419
|
+
completion_tokens: number;
|
|
420
|
+
prompt_tokens: number;
|
|
421
|
+
total_tokens: number;
|
|
422
|
+
completion_tokens_details?: Usage.CompletionTokensDetails;
|
|
423
|
+
prompt_tokens_details?: Usage.PromptTokensDetails;
|
|
424
|
+
cost?: number;
|
|
425
|
+
cost_details?: Usage.CostDetails;
|
|
426
|
+
}
|
|
427
|
+
namespace Usage {
|
|
428
|
+
function merged(a: Usage, b: Usage): [Usage, boolean];
|
|
429
|
+
interface CompletionTokensDetails {
|
|
430
|
+
accepted_prediction_tokens?: number;
|
|
431
|
+
audio_tokens?: number;
|
|
432
|
+
reasoning_tokens?: number;
|
|
433
|
+
rejected_prediction_tokens?: number;
|
|
434
|
+
}
|
|
435
|
+
namespace CompletionTokensDetails {
|
|
436
|
+
function merged(a: CompletionTokensDetails, b: CompletionTokensDetails): [CompletionTokensDetails, boolean];
|
|
437
|
+
}
|
|
438
|
+
interface PromptTokensDetails {
|
|
439
|
+
audio_tokens?: number;
|
|
440
|
+
cached_tokens?: number;
|
|
441
|
+
}
|
|
442
|
+
namespace PromptTokensDetails {
|
|
443
|
+
function merged(a: PromptTokensDetails, b: PromptTokensDetails): [PromptTokensDetails, boolean];
|
|
444
|
+
}
|
|
445
|
+
interface CostDetails {
|
|
446
|
+
upstream_inference_cost?: number;
|
|
447
|
+
upstream_upstream_inference_cost?: number;
|
|
448
|
+
}
|
|
449
|
+
namespace CostDetails {
|
|
450
|
+
function merged(a: CostDetails, b: CostDetails): [CostDetails, boolean];
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
interface Logprobs {
|
|
454
|
+
content: Logprobs.Logprob[];
|
|
455
|
+
refusal: Logprobs.Logprob[];
|
|
456
|
+
}
|
|
457
|
+
namespace Logprobs {
|
|
458
|
+
function merged(a: Logprobs, b: Logprobs): [Logprobs, boolean];
|
|
459
|
+
interface Logprob {
|
|
460
|
+
token: string;
|
|
461
|
+
bytes: number[];
|
|
462
|
+
logprob: number;
|
|
463
|
+
top_logprobs: Logprob.TopLogprob[];
|
|
464
|
+
}
|
|
465
|
+
namespace Logprob {
|
|
466
|
+
function mergedList(a: Logprob[], b: Logprob[]): [Logprob[], boolean];
|
|
467
|
+
interface TopLogprob {
|
|
468
|
+
token: string;
|
|
469
|
+
bytes: number[] | null;
|
|
470
|
+
logprob: number | null;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
type Role = "assistant";
|
|
475
|
+
type Image = Image.ImageUrl;
|
|
476
|
+
namespace Image {
|
|
477
|
+
function mergedList(a: Image[], b: Image[]): [Image[], boolean];
|
|
478
|
+
interface ImageUrl {
|
|
479
|
+
type: "image_url";
|
|
480
|
+
image_url: {
|
|
481
|
+
url: string;
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
interface ListOptions {
|
|
487
|
+
count?: number | null;
|
|
488
|
+
offset?: number | null;
|
|
489
|
+
}
|
|
490
|
+
interface ListItem {
|
|
491
|
+
id: string;
|
|
492
|
+
created: string;
|
|
493
|
+
}
|
|
494
|
+
function list(openai: OpenAI, listOptions?: ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
495
|
+
data: ListItem[];
|
|
496
|
+
}>;
|
|
497
|
+
function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
498
|
+
function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
|
|
499
|
+
request: Request.ChatCompletionCreateParams;
|
|
500
|
+
response: Response.Unary.ChatCompletion;
|
|
501
|
+
}>;
|
|
502
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
|
|
503
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
export declare namespace Query {
|
|
507
|
+
namespace Completions {
|
|
508
|
+
namespace Request {
|
|
509
|
+
interface ChatCompletionCreateParamsBase {
|
|
510
|
+
messages: Chat.Completions.Request.Message[];
|
|
511
|
+
model: Model;
|
|
512
|
+
logprobs?: boolean | null;
|
|
513
|
+
n?: number | null;
|
|
514
|
+
prediction?: Chat.Completions.Request.Prediction | null;
|
|
515
|
+
response_format?: Chat.Completions.Request.ResponseFormat | null;
|
|
516
|
+
seed?: number | null;
|
|
517
|
+
service_tier?: Chat.Completions.Request.ServiceTier | null;
|
|
518
|
+
stream_options?: Chat.Completions.Request.StreamOptions | null;
|
|
519
|
+
tools?: Chat.Completions.Request.Tool[] | null;
|
|
520
|
+
top_logprobs?: number | null;
|
|
521
|
+
usage?: Chat.Completions.Request.Usage | null;
|
|
522
|
+
embeddings?: string | null;
|
|
523
|
+
}
|
|
524
|
+
interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
525
|
+
stream: true;
|
|
526
|
+
}
|
|
527
|
+
interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
528
|
+
stream?: false | null;
|
|
529
|
+
}
|
|
530
|
+
type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
|
|
531
|
+
type Model = string | QueryModelBase;
|
|
532
|
+
}
|
|
533
|
+
namespace Response {
|
|
534
|
+
namespace Streaming {
|
|
535
|
+
interface ChatCompletionChunk {
|
|
536
|
+
id: string;
|
|
537
|
+
choices: Choice[];
|
|
538
|
+
created: number;
|
|
539
|
+
model: string;
|
|
540
|
+
object: "chat.completion.chunk";
|
|
541
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
542
|
+
system_fingerprint?: string;
|
|
543
|
+
usage?: Chat.Completions.Response.Usage;
|
|
544
|
+
training_table_data?: TrainingTableData;
|
|
545
|
+
}
|
|
546
|
+
namespace ChatCompletionChunk {
|
|
547
|
+
function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
|
|
548
|
+
}
|
|
549
|
+
interface Choice {
|
|
550
|
+
delta: Chat.Completions.Response.Streaming.Delta;
|
|
551
|
+
finish_reason: Chat.Completions.Response.FinishReason | null;
|
|
552
|
+
index: number;
|
|
553
|
+
logprobs?: Chat.Completions.Response.Logprobs;
|
|
554
|
+
generate_id?: string;
|
|
555
|
+
confidence_id?: ConfidenceId;
|
|
556
|
+
confidence_weight?: number;
|
|
557
|
+
confidence?: number;
|
|
558
|
+
embedding?: EmbeddingsResponse | ObjectiveAIError;
|
|
559
|
+
error?: ObjectiveAIError;
|
|
560
|
+
model: string;
|
|
561
|
+
model_index: number | null;
|
|
562
|
+
completion_metadata: CompletionMetadata;
|
|
563
|
+
}
|
|
564
|
+
namespace Choice {
|
|
565
|
+
function merged(a: Choice, b: Choice): [Choice, boolean];
|
|
566
|
+
function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
namespace Unary {
|
|
570
|
+
interface ChatCompletion {
|
|
571
|
+
id: string;
|
|
572
|
+
choices: Choice[];
|
|
573
|
+
created: number;
|
|
574
|
+
model: string;
|
|
575
|
+
object: "chat.completion";
|
|
576
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
577
|
+
system_fingerprint?: string;
|
|
578
|
+
usage?: Chat.Completions.Response.Usage;
|
|
579
|
+
training_table_data?: TrainingTableData;
|
|
580
|
+
}
|
|
581
|
+
interface Choice {
|
|
582
|
+
message: Chat.Completions.Response.Unary.Message;
|
|
583
|
+
finish_reason: Chat.Completions.Response.FinishReason;
|
|
584
|
+
index: number;
|
|
585
|
+
logprobs: Chat.Completions.Response.Logprobs | null;
|
|
586
|
+
generate_id: string | null;
|
|
587
|
+
confidence_id: ConfidenceId | null;
|
|
588
|
+
confidence_weight: number | null;
|
|
589
|
+
confidence: number | null;
|
|
590
|
+
embedding?: EmbeddingsResponse | ObjectiveAIError;
|
|
591
|
+
error?: ObjectiveAIError;
|
|
592
|
+
model: string;
|
|
593
|
+
model_index: number | null;
|
|
594
|
+
completion_metadata: CompletionMetadata;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
interface TrainingTableData {
|
|
598
|
+
response_format_hash: string;
|
|
599
|
+
embeddings_response: EmbeddingsResponse;
|
|
600
|
+
}
|
|
601
|
+
interface EmbeddingsResponse {
|
|
602
|
+
data: EmbeddingsResponse.Embedding[];
|
|
603
|
+
model: string;
|
|
604
|
+
object: "list";
|
|
605
|
+
usage?: Chat.Completions.Response.Usage;
|
|
606
|
+
}
|
|
607
|
+
namespace EmbeddingsResponse {
|
|
608
|
+
interface Embedding {
|
|
609
|
+
embedding: number[];
|
|
610
|
+
index: number;
|
|
611
|
+
object: "embedding";
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
interface CompletionMetadata {
|
|
615
|
+
id: string;
|
|
616
|
+
created: number;
|
|
617
|
+
model: string;
|
|
618
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
619
|
+
system_fingerprint?: string;
|
|
620
|
+
usage?: Chat.Completions.Response.Usage;
|
|
621
|
+
provider?: string;
|
|
622
|
+
}
|
|
623
|
+
namespace CompletionMetadata {
|
|
624
|
+
function merged(a: CompletionMetadata, b: CompletionMetadata): [CompletionMetadata, boolean];
|
|
625
|
+
}
|
|
626
|
+
type ConfidenceId = string | Record<string, number>;
|
|
627
|
+
}
|
|
628
|
+
function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
629
|
+
data: Chat.Completions.ListItem[];
|
|
630
|
+
}>;
|
|
631
|
+
function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
632
|
+
function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
|
|
633
|
+
request: Request.ChatCompletionCreateParams;
|
|
634
|
+
response: Response.Unary.ChatCompletion;
|
|
635
|
+
correct_confidence_id?: string;
|
|
636
|
+
}>;
|
|
637
|
+
function trainingTableMark(openai: OpenAI, id: string, correctConfidenceId: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
638
|
+
function trainingTableUnmark(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
639
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
|
|
640
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
export declare namespace QueryTool {
|
|
644
|
+
namespace Completions {
|
|
645
|
+
namespace Request {
|
|
646
|
+
interface ChatCompletionCreateParamsBase {
|
|
647
|
+
messages: Chat.Completions.Request.Message[];
|
|
648
|
+
model: Query.Completions.Request.Model;
|
|
649
|
+
logprobs?: boolean | null;
|
|
650
|
+
n?: number | null;
|
|
651
|
+
prediction?: Chat.Completions.Request.Prediction | null;
|
|
652
|
+
response_format: ResponseFormat;
|
|
653
|
+
seed?: number | null;
|
|
654
|
+
service_tier?: Chat.Completions.Request.ServiceTier | null;
|
|
655
|
+
stream_options?: Chat.Completions.Request.StreamOptions | null;
|
|
656
|
+
tools?: Chat.Completions.Request.Tool[] | null;
|
|
657
|
+
top_logprobs?: number | null;
|
|
658
|
+
usage?: Chat.Completions.Request.Usage | null;
|
|
659
|
+
embeddings?: string | null;
|
|
660
|
+
select_deterministic?: boolean | null;
|
|
661
|
+
}
|
|
662
|
+
interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
663
|
+
stream: true;
|
|
664
|
+
}
|
|
665
|
+
interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
666
|
+
stream?: false | null;
|
|
667
|
+
}
|
|
668
|
+
type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
|
|
669
|
+
type ResponseFormat = ResponseFormat.Simple | ResponseFormat.NumberQuery | ResponseFormat.MultipleChoiceQuery | ResponseFormat.MultipleChoiceOptionsQuery | ResponseFormat.WeightedAverageChoiceQuery;
|
|
670
|
+
namespace ResponseFormat {
|
|
671
|
+
type Simple = {
|
|
672
|
+
tool: "simple_query";
|
|
673
|
+
top?: number | null;
|
|
674
|
+
select_deterministic?: boolean | null;
|
|
675
|
+
} | ({
|
|
676
|
+
tool: "simple_query";
|
|
677
|
+
top?: number | null;
|
|
678
|
+
select_deterministic?: boolean | null;
|
|
679
|
+
} & Chat.Completions.Request.ResponseFormat);
|
|
680
|
+
interface NumberQuery {
|
|
681
|
+
tool: "number_query";
|
|
682
|
+
}
|
|
683
|
+
interface MultipleChoiceQuery {
|
|
684
|
+
tool: "multiple_choice_query";
|
|
685
|
+
choices: string[];
|
|
686
|
+
}
|
|
687
|
+
interface MultipleChoiceOptionsQuery {
|
|
688
|
+
tool: "multiple_choice_options_query";
|
|
689
|
+
min_items: number;
|
|
690
|
+
max_items: number;
|
|
691
|
+
}
|
|
692
|
+
type WeightedAverageChoiceQuery = {
|
|
693
|
+
tool: "weighted_average_choice_query";
|
|
694
|
+
embeddings_model: string;
|
|
695
|
+
select_deterministic?: boolean | null;
|
|
696
|
+
} | ({
|
|
697
|
+
tool: "weighted_average_choice_query";
|
|
698
|
+
embeddings_model: string;
|
|
699
|
+
select_deterministic?: boolean | null;
|
|
700
|
+
} & Chat.Completions.Request.ResponseFormat);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
namespace Response {
|
|
704
|
+
namespace Streaming {
|
|
705
|
+
interface ChatCompletionChunk {
|
|
706
|
+
id: string;
|
|
707
|
+
choices: Choice[];
|
|
708
|
+
created: number;
|
|
709
|
+
model: Model;
|
|
710
|
+
object: "chat.completion.chunk";
|
|
711
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
712
|
+
system_fingerprint?: string;
|
|
713
|
+
usage?: Chat.Completions.Response.Usage;
|
|
714
|
+
}
|
|
715
|
+
namespace ChatCompletionChunk {
|
|
716
|
+
function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
|
|
717
|
+
}
|
|
718
|
+
interface Choice {
|
|
719
|
+
delta: Delta;
|
|
720
|
+
finish_reason: Chat.Completions.Response.FinishReason | null;
|
|
721
|
+
index: number;
|
|
722
|
+
logprobs?: Chat.Completions.Response.Logprobs;
|
|
723
|
+
}
|
|
724
|
+
namespace Choice {
|
|
725
|
+
function merged(a: Choice, b: Choice): [Choice, boolean];
|
|
726
|
+
function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
|
|
727
|
+
}
|
|
728
|
+
interface Delta {
|
|
729
|
+
content?: string;
|
|
730
|
+
refusal?: string;
|
|
731
|
+
role?: Chat.Completions.Response.Role;
|
|
732
|
+
tool_calls?: Chat.Completions.Response.Streaming.ToolCall[];
|
|
733
|
+
reasoning?: Reasoning;
|
|
734
|
+
}
|
|
735
|
+
namespace Delta {
|
|
736
|
+
function merged(a: Delta, b: Delta): [Delta, boolean];
|
|
737
|
+
}
|
|
738
|
+
type Reasoning = ReasoningCompletion | ReasoningCompletion[];
|
|
739
|
+
namespace Reasoning {
|
|
740
|
+
function merged(a: Reasoning, b: Reasoning): [Reasoning, boolean];
|
|
741
|
+
}
|
|
742
|
+
type ReasoningCompletion = ReasoningCompletion.QueryCompletion | ReasoningCompletion.ChatCompletion;
|
|
743
|
+
namespace ReasoningCompletion {
|
|
744
|
+
type QueryCompletion = {
|
|
745
|
+
index: number;
|
|
746
|
+
type: "query";
|
|
747
|
+
error?: ObjectiveAIError;
|
|
748
|
+
} & Query.Completions.Response.Streaming.ChatCompletionChunk;
|
|
749
|
+
namespace QueryCompletion {
|
|
750
|
+
function merged(a: QueryCompletion, b: QueryCompletion): [QueryCompletion, boolean];
|
|
751
|
+
}
|
|
752
|
+
type ChatCompletion = {
|
|
753
|
+
index: number;
|
|
754
|
+
type: "chat";
|
|
755
|
+
error?: ObjectiveAIError;
|
|
756
|
+
} & Chat.Completions.Response.Streaming.ChatCompletionChunk;
|
|
757
|
+
namespace ChatCompletion {
|
|
758
|
+
function merged(a: ChatCompletion, b: ChatCompletion): [ChatCompletion, boolean];
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
namespace Unary {
|
|
763
|
+
interface ChatCompletion {
|
|
764
|
+
id: string;
|
|
765
|
+
choices: Choice[];
|
|
766
|
+
created: number;
|
|
767
|
+
model: Model;
|
|
768
|
+
object: "chat.completion";
|
|
769
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
770
|
+
system_fingerprint?: string;
|
|
771
|
+
usage?: Chat.Completions.Response.Usage;
|
|
772
|
+
}
|
|
773
|
+
interface Choice {
|
|
774
|
+
message: Message;
|
|
775
|
+
finish_reason: Chat.Completions.Response.FinishReason;
|
|
776
|
+
index: number;
|
|
777
|
+
logprobs: Chat.Completions.Response.Logprobs | null;
|
|
778
|
+
}
|
|
779
|
+
interface Message {
|
|
780
|
+
content: string | null;
|
|
781
|
+
refusal: string | null;
|
|
782
|
+
role: Chat.Completions.Response.Role;
|
|
783
|
+
annotations?: Chat.Completions.Response.Unary.Annotation[];
|
|
784
|
+
audio?: Chat.Completions.Response.Unary.Audio;
|
|
785
|
+
tool_calls?: Chat.Completions.Response.Unary.ToolCall[];
|
|
786
|
+
reasoning?: Reasoning;
|
|
787
|
+
}
|
|
788
|
+
type Reasoning = ReasoningCompletion | ReasoningCompletion[];
|
|
789
|
+
type ReasoningCompletion = ReasoningCompletion.QueryCompletion | ReasoningCompletion.ChatCompletion;
|
|
790
|
+
namespace ReasoningCompletion {
|
|
791
|
+
type QueryCompletion = {
|
|
792
|
+
index: number;
|
|
793
|
+
type: "query";
|
|
794
|
+
error?: ObjectiveAIError;
|
|
795
|
+
} & Query.Completions.Response.Unary.ChatCompletion;
|
|
796
|
+
type ChatCompletion = {
|
|
797
|
+
index: number;
|
|
798
|
+
type: "chat";
|
|
799
|
+
error?: ObjectiveAIError;
|
|
800
|
+
} & Chat.Completions.Response.Unary.ChatCompletion;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
type Model = "simple_query" | "number_query" | "multiple_choice_query" | "multiple_choice_options_query" | "weighted_average_choice_query";
|
|
804
|
+
}
|
|
805
|
+
function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
806
|
+
data: Chat.Completions.ListItem[];
|
|
807
|
+
}>;
|
|
808
|
+
function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
809
|
+
function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
|
|
810
|
+
request: Request.ChatCompletionCreateParams;
|
|
811
|
+
response: Response.Unary.ChatCompletion;
|
|
812
|
+
}>;
|
|
813
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
|
|
814
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
export declare namespace QueryChat {
|
|
818
|
+
namespace Completions {
|
|
819
|
+
namespace Request {
|
|
820
|
+
interface ChatCompletionCreateParamsBase {
|
|
821
|
+
messages: Chat.Completions.Request.Message[];
|
|
822
|
+
model: string;
|
|
823
|
+
frequency_penalty?: number | null;
|
|
824
|
+
logit_bias?: Record<string, number> | null;
|
|
825
|
+
logprobs?: boolean | null;
|
|
826
|
+
max_completion_tokens?: number | null;
|
|
827
|
+
modalities?: string[] | null;
|
|
828
|
+
parallel_tool_calls?: boolean | null;
|
|
829
|
+
prediction?: Chat.Completions.Request.Prediction | null;
|
|
830
|
+
presence_penalty?: number | null;
|
|
831
|
+
reasoning_effort?: Chat.Completions.Request.ReasoningEffort | null;
|
|
832
|
+
response_format?: Chat.Completions.Request.ResponseFormat | null;
|
|
833
|
+
seed?: number | null;
|
|
834
|
+
service_tier?: Chat.Completions.Request.ServiceTier | null;
|
|
835
|
+
stop?: Chat.Completions.Request.Stop | null;
|
|
836
|
+
stream_options?: Chat.Completions.Request.StreamOptions | null;
|
|
837
|
+
temperature?: number | null;
|
|
838
|
+
top_logprobs?: number | null;
|
|
839
|
+
top_p?: number | null;
|
|
840
|
+
max_tokens?: number | null;
|
|
841
|
+
min_p?: number | null;
|
|
842
|
+
provider?: Chat.Completions.Request.ProviderPreferences | null;
|
|
843
|
+
reasoning?: Chat.Completions.Request.Reasoning | null;
|
|
844
|
+
repetition_penalty?: number | null;
|
|
845
|
+
top_a?: number | null;
|
|
846
|
+
top_k?: number | null;
|
|
847
|
+
usage?: Chat.Completions.Request.Usage | null;
|
|
848
|
+
verbosity?: Chat.Completions.Request.Verbosity | null;
|
|
849
|
+
models?: string[] | null;
|
|
850
|
+
training_table_name?: string | null;
|
|
851
|
+
simple_query: QueryToolParams;
|
|
852
|
+
multiple_choice_query: QueryToolParams;
|
|
853
|
+
multiple_choice_options_query: QueryToolParams;
|
|
854
|
+
}
|
|
855
|
+
interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
856
|
+
stream: true;
|
|
857
|
+
}
|
|
858
|
+
interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
859
|
+
stream?: false | null;
|
|
860
|
+
}
|
|
861
|
+
type ChatCompletionCreateParams = ChatCompletionCreateParamsStreaming | ChatCompletionCreateParamsNonStreaming;
|
|
862
|
+
interface QueryToolParams {
|
|
863
|
+
model: Query.Completions.Request.Model;
|
|
864
|
+
logprobs?: boolean | null;
|
|
865
|
+
n?: number | null;
|
|
866
|
+
prediction?: Chat.Completions.Request.Prediction | null;
|
|
867
|
+
seed?: number | null;
|
|
868
|
+
service_tier?: Chat.Completions.Request.ServiceTier | null;
|
|
869
|
+
tools?: Chat.Completions.Request.Tool[] | null;
|
|
870
|
+
top_logprobs?: number | null;
|
|
871
|
+
embeddings?: string | null;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
namespace Response {
|
|
875
|
+
namespace Streaming {
|
|
876
|
+
interface ChatCompletionChunk {
|
|
877
|
+
id: string;
|
|
878
|
+
choices: Choice[];
|
|
879
|
+
created: number;
|
|
880
|
+
model: string;
|
|
881
|
+
object: "chat.completion.chunk";
|
|
882
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
883
|
+
system_fingerprint?: string;
|
|
884
|
+
usage?: Chat.Completions.Response.Usage;
|
|
885
|
+
}
|
|
886
|
+
namespace ChatCompletionChunk {
|
|
887
|
+
function merged(a: ChatCompletionChunk, b: ChatCompletionChunk): [ChatCompletionChunk, boolean];
|
|
888
|
+
}
|
|
889
|
+
interface Choice {
|
|
890
|
+
delta: Delta;
|
|
891
|
+
finish_reason: Chat.Completions.Response.FinishReason | null;
|
|
892
|
+
index: number;
|
|
893
|
+
logprobs?: Chat.Completions.Response.Logprobs;
|
|
894
|
+
}
|
|
895
|
+
namespace Choice {
|
|
896
|
+
function merged(a: Choice, b: Choice): [Choice, boolean];
|
|
897
|
+
function mergedList(a: Choice[], b: Choice[]): [Choice[], boolean];
|
|
898
|
+
}
|
|
899
|
+
interface Delta {
|
|
900
|
+
content?: string;
|
|
901
|
+
refusal?: string;
|
|
902
|
+
role?: Chat.Completions.Response.Role;
|
|
903
|
+
tool_calls?: Chat.Completions.Response.Streaming.ToolCall[];
|
|
904
|
+
images?: Chat.Completions.Response.Image[];
|
|
905
|
+
reasoning?: Reasoning;
|
|
906
|
+
}
|
|
907
|
+
namespace Delta {
|
|
908
|
+
function merged(a: Delta, b: Delta): [Delta, boolean];
|
|
909
|
+
}
|
|
910
|
+
type Reasoning = ReasoningCompletion | ReasoningCompletion[];
|
|
911
|
+
namespace Reasoning {
|
|
912
|
+
function merged(a: Reasoning, b: Reasoning): [Reasoning, boolean];
|
|
913
|
+
}
|
|
914
|
+
type ReasoningCompletion = ReasoningCompletion.QueryToolCompletion | ReasoningCompletion.ChatCompletion;
|
|
915
|
+
namespace ReasoningCompletion {
|
|
916
|
+
type QueryToolCompletion = {
|
|
917
|
+
index: number;
|
|
918
|
+
type: "query_tool";
|
|
919
|
+
tool_call_id: string;
|
|
920
|
+
error?: ObjectiveAIError;
|
|
921
|
+
} & QueryTool.Completions.Response.Streaming.ChatCompletionChunk;
|
|
922
|
+
namespace QueryToolCompletion {
|
|
923
|
+
function merged(a: QueryToolCompletion, b: QueryToolCompletion): [QueryToolCompletion, boolean];
|
|
924
|
+
}
|
|
925
|
+
type ChatCompletion = {
|
|
926
|
+
index: number;
|
|
927
|
+
type: "chat";
|
|
928
|
+
error?: ObjectiveAIError;
|
|
929
|
+
} & Chat.Completions.Response.Streaming.ChatCompletionChunk;
|
|
930
|
+
namespace ChatCompletion {
|
|
931
|
+
function merged(a: ChatCompletion, b: ChatCompletion): [ChatCompletion, boolean];
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
namespace Unary {
|
|
936
|
+
interface ChatCompletion {
|
|
937
|
+
id: string;
|
|
938
|
+
choices: Choice[];
|
|
939
|
+
created: number;
|
|
940
|
+
model: string;
|
|
941
|
+
object: "chat.completion";
|
|
942
|
+
service_tier?: Chat.Completions.Response.ServiceTier;
|
|
943
|
+
system_fingerprint?: string;
|
|
944
|
+
usage?: Chat.Completions.Response.Usage;
|
|
945
|
+
}
|
|
946
|
+
interface Choice {
|
|
947
|
+
message: Message;
|
|
948
|
+
finish_reason: Chat.Completions.Response.FinishReason;
|
|
949
|
+
index: number;
|
|
950
|
+
logprobs: Chat.Completions.Response.Logprobs | null;
|
|
951
|
+
}
|
|
952
|
+
interface Message {
|
|
953
|
+
content: string | null;
|
|
954
|
+
refusal: string | null;
|
|
955
|
+
role: Chat.Completions.Response.Role;
|
|
956
|
+
annotations?: Chat.Completions.Response.Unary.Annotation[];
|
|
957
|
+
audio?: Chat.Completions.Response.Unary.Audio;
|
|
958
|
+
tool_calls?: Chat.Completions.Response.Unary.ToolCall[];
|
|
959
|
+
images?: Chat.Completions.Response.Image[];
|
|
960
|
+
reasoning?: Reasoning;
|
|
961
|
+
}
|
|
962
|
+
type Reasoning = ReasoningCompletion | ReasoningCompletion[];
|
|
963
|
+
type ReasoningCompletion = ReasoningCompletion.QueryToolCompletion | ReasoningCompletion.ChatCompletion;
|
|
964
|
+
namespace ReasoningCompletion {
|
|
965
|
+
type QueryToolCompletion = {
|
|
966
|
+
index: number;
|
|
967
|
+
type: "query_tool";
|
|
968
|
+
tool_call_id: string;
|
|
969
|
+
error?: ObjectiveAIError;
|
|
970
|
+
} & QueryTool.Completions.Response.Unary.ChatCompletion;
|
|
971
|
+
type ChatCompletion = {
|
|
972
|
+
index: number;
|
|
973
|
+
type: "chat";
|
|
974
|
+
error?: ObjectiveAIError;
|
|
975
|
+
} & Chat.Completions.Response.Unary.ChatCompletion;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
function list(openai: OpenAI, listOptions?: Chat.Completions.ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
980
|
+
data: Chat.Completions.ListItem[];
|
|
981
|
+
}>;
|
|
982
|
+
function publish(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<void>;
|
|
983
|
+
function retrieve(openai: OpenAI, id: string, options?: OpenAI.RequestOptions): Promise<{
|
|
984
|
+
request: Request.ChatCompletionCreateParams;
|
|
985
|
+
response: Response.Unary.ChatCompletion;
|
|
986
|
+
}>;
|
|
987
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsStreaming, options?: OpenAI.RequestOptions): Promise<Stream<Response.Streaming.ChatCompletionChunk | ObjectiveAIError>>;
|
|
988
|
+
function create(openai: OpenAI, body: Request.ChatCompletionCreateParamsNonStreaming, options?: OpenAI.RequestOptions): Promise<Response.Unary.ChatCompletion>;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
export declare namespace Models {
|
|
992
|
+
interface Model {
|
|
993
|
+
id: string;
|
|
994
|
+
name: string;
|
|
995
|
+
created: number;
|
|
996
|
+
description: string;
|
|
997
|
+
architecture: Architecture;
|
|
998
|
+
top_provider: TopProvider;
|
|
999
|
+
pricing: Pricing;
|
|
1000
|
+
context_length?: number;
|
|
1001
|
+
hugging_face_id?: string;
|
|
1002
|
+
per_request_limits?: Record<string, unknown>;
|
|
1003
|
+
supported_parameters?: string[];
|
|
1004
|
+
}
|
|
1005
|
+
interface ModelWithProviders {
|
|
1006
|
+
id: string;
|
|
1007
|
+
name: string;
|
|
1008
|
+
created: number;
|
|
1009
|
+
description: string;
|
|
1010
|
+
architecture: Architecture;
|
|
1011
|
+
endpoints: Provider[];
|
|
1012
|
+
}
|
|
1013
|
+
interface Architecture {
|
|
1014
|
+
input_modalities: string[];
|
|
1015
|
+
output_modalities: string[];
|
|
1016
|
+
tokenizer: string;
|
|
1017
|
+
instruct_type?: string;
|
|
1018
|
+
}
|
|
1019
|
+
interface TopProvider {
|
|
1020
|
+
is_moderated: boolean;
|
|
1021
|
+
context_length?: number;
|
|
1022
|
+
max_completion_tokens?: number;
|
|
1023
|
+
}
|
|
1024
|
+
interface Pricing {
|
|
1025
|
+
prompt: number;
|
|
1026
|
+
completion: number;
|
|
1027
|
+
image?: number;
|
|
1028
|
+
request?: number;
|
|
1029
|
+
input_cache_read?: number;
|
|
1030
|
+
input_cache_write?: number;
|
|
1031
|
+
web_search?: number;
|
|
1032
|
+
internal_reasoning?: number;
|
|
1033
|
+
discount?: number;
|
|
1034
|
+
}
|
|
1035
|
+
interface Provider {
|
|
1036
|
+
name: string;
|
|
1037
|
+
tag: string;
|
|
1038
|
+
context_length?: number;
|
|
1039
|
+
pricing: Pricing;
|
|
1040
|
+
provider_name: string;
|
|
1041
|
+
supported_parameters?: string[];
|
|
1042
|
+
quantization?: string;
|
|
1043
|
+
max_completion_tokens?: number;
|
|
1044
|
+
max_prompt_tokens?: number;
|
|
1045
|
+
status?: unknown;
|
|
1046
|
+
}
|
|
1047
|
+
interface ListOptions {
|
|
1048
|
+
count?: number;
|
|
1049
|
+
offset?: number;
|
|
1050
|
+
me?: boolean;
|
|
1051
|
+
sort?: "created" | "tokens" | "completion_tokens" | "prompt_tokens" | "cost" | "requests";
|
|
1052
|
+
from?: string;
|
|
1053
|
+
to?: string;
|
|
1054
|
+
}
|
|
1055
|
+
interface RetrieveOptionsBase {
|
|
1056
|
+
me?: boolean | null;
|
|
1057
|
+
from?: string | null;
|
|
1058
|
+
to?: string | null;
|
|
1059
|
+
}
|
|
1060
|
+
interface RetrieveOptionsWithMetadata extends RetrieveOptionsBase {
|
|
1061
|
+
metadata: true;
|
|
1062
|
+
}
|
|
1063
|
+
interface RetrieveOptionsWithoutMetadata extends RetrieveOptionsBase {
|
|
1064
|
+
metadata?: false | null;
|
|
1065
|
+
}
|
|
1066
|
+
type RetrieveOptions = RetrieveOptionsWithMetadata | RetrieveOptionsWithoutMetadata;
|
|
1067
|
+
function list(openai: OpenAI, listOptions?: ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
1068
|
+
data: Model[];
|
|
1069
|
+
}>;
|
|
1070
|
+
function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
1071
|
+
data: ModelWithProviders;
|
|
1072
|
+
}>;
|
|
1073
|
+
}
|
|
1074
|
+
export declare namespace Auth {
|
|
1075
|
+
interface ApiKey {
|
|
1076
|
+
api_key: string;
|
|
1077
|
+
created: string;
|
|
1078
|
+
expires: string | null;
|
|
1079
|
+
disabled: string | null;
|
|
1080
|
+
name: string;
|
|
1081
|
+
description: string | null;
|
|
1082
|
+
}
|
|
1083
|
+
interface ApiKeyWithCost extends ApiKey {
|
|
1084
|
+
cost: number;
|
|
1085
|
+
}
|
|
1086
|
+
namespace ApiKey {
|
|
1087
|
+
function list(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<{
|
|
1088
|
+
data: ApiKeyWithCost[];
|
|
1089
|
+
}>;
|
|
1090
|
+
function create(openai: OpenAI, name: string, expires?: Date | null, description?: string | null, options?: OpenAI.RequestOptions): Promise<ApiKey>;
|
|
1091
|
+
function remove(openai: OpenAI, key: string, options?: OpenAI.RequestOptions): Promise<ApiKey>;
|
|
1092
|
+
}
|
|
1093
|
+
interface OpenRouterApiKey {
|
|
1094
|
+
api_key: string;
|
|
1095
|
+
}
|
|
1096
|
+
namespace OpenRouterApiKey {
|
|
1097
|
+
function retrieve(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<OpenRouterApiKey>;
|
|
1098
|
+
function create(openai: OpenAI, apiKey: string, options?: OpenAI.RequestOptions): Promise<OpenRouterApiKey>;
|
|
1099
|
+
function remove(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<OpenRouterApiKey>;
|
|
1100
|
+
}
|
|
1101
|
+
interface Credits {
|
|
1102
|
+
credits: number;
|
|
1103
|
+
total_credits_purchased: number;
|
|
1104
|
+
total_credits_used: number;
|
|
1105
|
+
}
|
|
1106
|
+
namespace Credits {
|
|
1107
|
+
function retrieve(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<Credits>;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
export interface Metadata {
|
|
1111
|
+
query_requests: number;
|
|
1112
|
+
query_completion_tokens: number;
|
|
1113
|
+
query_prompt_tokens: number;
|
|
1114
|
+
query_cost: number;
|
|
1115
|
+
chat_requests: number;
|
|
1116
|
+
chat_completion_tokens: number;
|
|
1117
|
+
chat_prompt_tokens: number;
|
|
1118
|
+
chat_cost: number;
|
|
1119
|
+
embedding_completion_tokens: number;
|
|
1120
|
+
embedding_prompt_tokens: number;
|
|
1121
|
+
embedding_cost: number;
|
|
1122
|
+
}
|
|
1123
|
+
export declare namespace Metadata {
|
|
1124
|
+
function get(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<Metadata>;
|
|
1125
|
+
}
|
|
1126
|
+
export interface QueryModelBase {
|
|
1127
|
+
models: QueryModel.QueryLlmBase[];
|
|
1128
|
+
weight: QueryModel.Weight;
|
|
1129
|
+
}
|
|
1130
|
+
export interface QueryModel {
|
|
1131
|
+
name: string;
|
|
1132
|
+
training_table_name?: string;
|
|
1133
|
+
models: QueryModel.QueryLlm[];
|
|
1134
|
+
weight: QueryModel.Weight;
|
|
1135
|
+
}
|
|
1136
|
+
export interface QueryModelWithMetadata extends QueryModel {
|
|
1137
|
+
user_id: string;
|
|
1138
|
+
created: string;
|
|
1139
|
+
requests: number;
|
|
1140
|
+
chat_completion_tokens: number;
|
|
1141
|
+
chat_prompt_tokens: number;
|
|
1142
|
+
chat_cost: number;
|
|
1143
|
+
embedding_completion_tokens: number;
|
|
1144
|
+
embedding_prompt_tokens: number;
|
|
1145
|
+
embedding_cost: number;
|
|
1146
|
+
}
|
|
1147
|
+
export declare namespace QueryModel {
|
|
1148
|
+
type Weight = Weight.Static | Weight.TrainingTable;
|
|
1149
|
+
namespace Weight {
|
|
1150
|
+
interface Static {
|
|
1151
|
+
type: "static";
|
|
1152
|
+
}
|
|
1153
|
+
interface TrainingTable {
|
|
1154
|
+
type: "training_table";
|
|
1155
|
+
embeddings_model: string;
|
|
1156
|
+
top: number;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
interface QueryLlmBase {
|
|
1160
|
+
id: string;
|
|
1161
|
+
mode: QueryLlm.Mode;
|
|
1162
|
+
select_top_logprobs?: number | null;
|
|
1163
|
+
frequency_penalty?: number | null;
|
|
1164
|
+
logit_bias?: Record<string, number> | null;
|
|
1165
|
+
max_completion_tokens?: number | null;
|
|
1166
|
+
presence_penalty?: number | null;
|
|
1167
|
+
reasoning_effort?: Chat.Completions.Request.ReasoningEffort | null;
|
|
1168
|
+
stop?: Chat.Completions.Request.Stop | null;
|
|
1169
|
+
temperature?: number | null;
|
|
1170
|
+
top_p?: number | null;
|
|
1171
|
+
max_tokens?: number | null;
|
|
1172
|
+
min_p?: number | null;
|
|
1173
|
+
provider?: Chat.Completions.Request.ProviderPreferences | null;
|
|
1174
|
+
reasoning?: Chat.Completions.Request.Reasoning | null;
|
|
1175
|
+
repetition_penalty?: number | null;
|
|
1176
|
+
top_a?: number | null;
|
|
1177
|
+
top_k?: number | null;
|
|
1178
|
+
verbosity?: Chat.Completions.Request.Verbosity | null;
|
|
1179
|
+
models?: string[] | null;
|
|
1180
|
+
weight: QueryLlm.Weight;
|
|
1181
|
+
}
|
|
1182
|
+
interface QueryLlmWithoutIndices extends QueryLlmBase {
|
|
1183
|
+
name: string;
|
|
1184
|
+
training_table_name?: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface QueryLlm extends QueryLlmWithoutIndices {
|
|
1187
|
+
index: number;
|
|
1188
|
+
training_table_index?: number;
|
|
1189
|
+
}
|
|
1190
|
+
interface QueryLlmWithoutIndicesWithMetadata extends QueryLlmWithoutIndices {
|
|
1191
|
+
user_id: string;
|
|
1192
|
+
created: string;
|
|
1193
|
+
requests: number;
|
|
1194
|
+
chat_completion_tokens: number;
|
|
1195
|
+
chat_prompt_tokens: number;
|
|
1196
|
+
chat_cost: number;
|
|
1197
|
+
embedding_completion_tokens: number;
|
|
1198
|
+
embedding_prompt_tokens: number;
|
|
1199
|
+
embedding_cost: number;
|
|
1200
|
+
}
|
|
1201
|
+
namespace QueryLlm {
|
|
1202
|
+
type Mode = "generate" | "select_thinking" | "select_non_thinking" | "select_thinking_logprobs" | "select_non_thinking_logprobs";
|
|
1203
|
+
type Weight = Weight.Static | Weight.TrainingTable;
|
|
1204
|
+
namespace Weight {
|
|
1205
|
+
interface Static {
|
|
1206
|
+
type: "static";
|
|
1207
|
+
weight: number;
|
|
1208
|
+
}
|
|
1209
|
+
interface TrainingTable {
|
|
1210
|
+
type: "training_table";
|
|
1211
|
+
base_weight: number;
|
|
1212
|
+
min_weight: number;
|
|
1213
|
+
max_weight: number;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndices>;
|
|
1217
|
+
function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndicesWithMetadata>;
|
|
1218
|
+
function retrieveValidate(openai: OpenAI, model: QueryLlmBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndices>;
|
|
1219
|
+
function retrieveValidate(openai: OpenAI, model: QueryLlmBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryLlmWithoutIndicesWithMetadata>;
|
|
1220
|
+
}
|
|
1221
|
+
function list(openai: OpenAI, listOptions?: Models.ListOptions, options?: OpenAI.RequestOptions): Promise<{
|
|
1222
|
+
data: string[];
|
|
1223
|
+
}>;
|
|
1224
|
+
function count(openai: OpenAI, options?: OpenAI.RequestOptions): Promise<{
|
|
1225
|
+
count: number;
|
|
1226
|
+
}>;
|
|
1227
|
+
function retrieve(openai: OpenAI, model: string, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryModel>;
|
|
1228
|
+
function retrieve(openai: OpenAI, model: string, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryModelWithMetadata>;
|
|
1229
|
+
function retrieveValidate(openai: OpenAI, model: QueryModelBase, retrieveOptions?: Models.RetrieveOptionsWithoutMetadata, options?: OpenAI.RequestOptions): Promise<QueryModel>;
|
|
1230
|
+
function retrieveValidate(openai: OpenAI, model: QueryModelBase, retrieveOptions: Models.RetrieveOptionsWithMetadata, options?: OpenAI.RequestOptions): Promise<QueryModelWithMetadata>;
|
|
1231
|
+
}
|
|
1232
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
1233
|
+
[key: string]: JsonValue;
|
|
1234
|
+
};
|
|
1235
|
+
export interface ObjectiveAIError {
|
|
1236
|
+
code: number;
|
|
1237
|
+
message: JsonValue;
|
|
1238
|
+
}
|