openai 4.16.2 → 4.17.1
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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/assistants/assistants.d.ts +4 -96
- package/resources/beta/assistants/assistants.d.ts.map +1 -1
- package/resources/beta/assistants/assistants.js.map +1 -1
- package/resources/beta/assistants/assistants.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +5 -66
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/runs/steps.d.ts +4 -4
- package/resources/beta/threads/runs/steps.d.ts.map +1 -1
- package/resources/beta/threads/threads.d.ts +2 -32
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/chat/completions.d.ts +27 -42
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/files.d.ts +7 -0
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +8 -0
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +8 -0
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -0
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.ts +35 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/src/index.ts +3 -0
- package/src/resources/beta/assistants/assistants.ts +4 -105
- package/src/resources/beta/threads/runs/runs.ts +5 -72
- package/src/resources/beta/threads/runs/steps.ts +4 -4
- package/src/resources/beta/threads/threads.ts +2 -35
- package/src/resources/chat/completions.ts +27 -45
- package/src/resources/files.ts +10 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/shared.ts +39 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -4,6 +4,7 @@ import * as Core from "../../../../core";
|
|
|
4
4
|
import { APIResource } from "../../../../resource";
|
|
5
5
|
import { isRequestOptions } from "../../../../core";
|
|
6
6
|
import * as RunsAPI from "./runs";
|
|
7
|
+
import * as Shared from "../../../shared";
|
|
7
8
|
import * as StepsAPI from "./steps";
|
|
8
9
|
import { CursorPage, type CursorPageParams } from "../../../../pagination";
|
|
9
10
|
|
|
@@ -221,9 +222,9 @@ export interface Run {
|
|
|
221
222
|
model: string;
|
|
222
223
|
|
|
223
224
|
/**
|
|
224
|
-
* The object type, which is always `
|
|
225
|
+
* The object type, which is always `thread.run`.
|
|
225
226
|
*/
|
|
226
|
-
object: '
|
|
227
|
+
object: 'thread.run';
|
|
227
228
|
|
|
228
229
|
/**
|
|
229
230
|
* Details on the action required to continue the run. Will be `null` if no action
|
|
@@ -324,47 +325,13 @@ export namespace Run {
|
|
|
324
325
|
}
|
|
325
326
|
|
|
326
327
|
export interface AssistantToolsFunction {
|
|
327
|
-
|
|
328
|
-
* The function definition.
|
|
329
|
-
*/
|
|
330
|
-
function: AssistantToolsFunction.Function;
|
|
328
|
+
function: Shared.FunctionDefinition;
|
|
331
329
|
|
|
332
330
|
/**
|
|
333
331
|
* The type of tool being defined: `function`
|
|
334
332
|
*/
|
|
335
333
|
type: 'function';
|
|
336
334
|
}
|
|
337
|
-
|
|
338
|
-
export namespace AssistantToolsFunction {
|
|
339
|
-
/**
|
|
340
|
-
* The function definition.
|
|
341
|
-
*/
|
|
342
|
-
export interface Function {
|
|
343
|
-
/**
|
|
344
|
-
* A description of what the function does, used by the model to choose when and
|
|
345
|
-
* how to call the function.
|
|
346
|
-
*/
|
|
347
|
-
description: string;
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
351
|
-
* underscores and dashes, with a maximum length of 64.
|
|
352
|
-
*/
|
|
353
|
-
name: string;
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
357
|
-
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
358
|
-
* examples, and the
|
|
359
|
-
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
360
|
-
* documentation about the format.
|
|
361
|
-
*
|
|
362
|
-
* To describe a function that accepts no parameters, provide the value
|
|
363
|
-
* `{"type": "object", "properties": {}}`.
|
|
364
|
-
*/
|
|
365
|
-
parameters: Record<string, unknown>;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
335
|
}
|
|
369
336
|
|
|
370
337
|
export interface RunCreateParams {
|
|
@@ -424,47 +391,13 @@ export namespace RunCreateParams {
|
|
|
424
391
|
}
|
|
425
392
|
|
|
426
393
|
export interface AssistantToolsFunction {
|
|
427
|
-
|
|
428
|
-
* The function definition.
|
|
429
|
-
*/
|
|
430
|
-
function: AssistantToolsFunction.Function;
|
|
394
|
+
function: Shared.FunctionDefinition;
|
|
431
395
|
|
|
432
396
|
/**
|
|
433
397
|
* The type of tool being defined: `function`
|
|
434
398
|
*/
|
|
435
399
|
type: 'function';
|
|
436
400
|
}
|
|
437
|
-
|
|
438
|
-
export namespace AssistantToolsFunction {
|
|
439
|
-
/**
|
|
440
|
-
* The function definition.
|
|
441
|
-
*/
|
|
442
|
-
export interface Function {
|
|
443
|
-
/**
|
|
444
|
-
* A description of what the function does, used by the model to choose when and
|
|
445
|
-
* how to call the function.
|
|
446
|
-
*/
|
|
447
|
-
description: string;
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
451
|
-
* underscores and dashes, with a maximum length of 64.
|
|
452
|
-
*/
|
|
453
|
-
name: string;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
457
|
-
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
458
|
-
* examples, and the
|
|
459
|
-
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
460
|
-
* documentation about the format.
|
|
461
|
-
*
|
|
462
|
-
* To describe a function that accepts no parameters, provide the value
|
|
463
|
-
* `{"type": "object", "properties": {}}`.
|
|
464
|
-
*/
|
|
465
|
-
parameters: Record<string, unknown>;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
401
|
}
|
|
469
402
|
|
|
470
403
|
export interface RunUpdateParams {
|
|
@@ -269,9 +269,9 @@ export interface RunStep {
|
|
|
269
269
|
metadata: unknown | null;
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* The object type, which is always `
|
|
272
|
+
* The object type, which is always `thread.run.step``.
|
|
273
273
|
*/
|
|
274
|
-
object: '
|
|
274
|
+
object: 'thread.run.step';
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that
|
|
@@ -280,8 +280,8 @@ export interface RunStep {
|
|
|
280
280
|
run_id: string;
|
|
281
281
|
|
|
282
282
|
/**
|
|
283
|
-
* The status of the run, which can be either `in_progress`, `cancelled`,
|
|
284
|
-
* `completed`, or `expired`.
|
|
283
|
+
* The status of the run step, which can be either `in_progress`, `cancelled`,
|
|
284
|
+
* `failed`, `completed`, or `expired`.
|
|
285
285
|
*/
|
|
286
286
|
status: 'in_progress' | 'cancelled' | 'failed' | 'completed' | 'expired';
|
|
287
287
|
|
|
@@ -4,6 +4,7 @@ import * as Core from "../../../core";
|
|
|
4
4
|
import { APIResource } from "../../../resource";
|
|
5
5
|
import { isRequestOptions } from "../../../core";
|
|
6
6
|
import * as ThreadsAPI from "./threads";
|
|
7
|
+
import * as Shared from "../../shared";
|
|
7
8
|
import * as MessagesAPI from "./messages/messages";
|
|
8
9
|
import * as RunsAPI from "./runs/runs";
|
|
9
10
|
|
|
@@ -279,47 +280,13 @@ export namespace ThreadCreateAndRunParams {
|
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
export interface AssistantToolsFunction {
|
|
282
|
-
|
|
283
|
-
* The function definition.
|
|
284
|
-
*/
|
|
285
|
-
function: AssistantToolsFunction.Function;
|
|
283
|
+
function: Shared.FunctionDefinition;
|
|
286
284
|
|
|
287
285
|
/**
|
|
288
286
|
* The type of tool being defined: `function`
|
|
289
287
|
*/
|
|
290
288
|
type: 'function';
|
|
291
289
|
}
|
|
292
|
-
|
|
293
|
-
export namespace AssistantToolsFunction {
|
|
294
|
-
/**
|
|
295
|
-
* The function definition.
|
|
296
|
-
*/
|
|
297
|
-
export interface Function {
|
|
298
|
-
/**
|
|
299
|
-
* A description of what the function does, used by the model to choose when and
|
|
300
|
-
* how to call the function.
|
|
301
|
-
*/
|
|
302
|
-
description: string;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
306
|
-
* underscores and dashes, with a maximum length of 64.
|
|
307
|
-
*/
|
|
308
|
-
name: string;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
312
|
-
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
313
|
-
* examples, and the
|
|
314
|
-
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
315
|
-
* documentation about the format.
|
|
316
|
-
*
|
|
317
|
-
* To describe a function that accepts no parameters, provide the value
|
|
318
|
-
* `{"type": "object", "properties": {}}`.
|
|
319
|
-
*/
|
|
320
|
-
parameters: Record<string, unknown>;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
290
|
}
|
|
324
291
|
|
|
325
292
|
export namespace Threads {
|
|
@@ -5,6 +5,7 @@ import { APIPromise } from "../../core";
|
|
|
5
5
|
import { APIResource } from "../../resource";
|
|
6
6
|
import * as ChatCompletionsAPI from "./completions";
|
|
7
7
|
import * as CompletionsAPI from "../completions";
|
|
8
|
+
import * as Shared from "../shared";
|
|
8
9
|
import { Stream } from "../../streaming";
|
|
9
10
|
|
|
10
11
|
export class Completions extends APIResource {
|
|
@@ -180,7 +181,6 @@ export interface ChatCompletionChunk {
|
|
|
180
181
|
|
|
181
182
|
/**
|
|
182
183
|
* This fingerprint represents the backend configuration that the model runs with.
|
|
183
|
-
*
|
|
184
184
|
* Can be used in conjunction with the `seed` request parameter to understand when
|
|
185
185
|
* backend changes have been made that might impact determinism.
|
|
186
186
|
*/
|
|
@@ -486,7 +486,7 @@ export interface ChatCompletionSystemMessageParam {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
export interface ChatCompletionTool {
|
|
489
|
-
function:
|
|
489
|
+
function: Shared.FunctionDefinition;
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
492
|
* The type of the tool. Currently, only `function` is supported.
|
|
@@ -494,34 +494,6 @@ export interface ChatCompletionTool {
|
|
|
494
494
|
type: 'function';
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
export namespace ChatCompletionTool {
|
|
498
|
-
export interface Function {
|
|
499
|
-
/**
|
|
500
|
-
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
501
|
-
* underscores and dashes, with a maximum length of 64.
|
|
502
|
-
*/
|
|
503
|
-
name: string;
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
507
|
-
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
508
|
-
* examples, and the
|
|
509
|
-
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
510
|
-
* documentation about the format.
|
|
511
|
-
*
|
|
512
|
-
* To describe a function that accepts no parameters, provide the value
|
|
513
|
-
* `{"type": "object", "properties": {}}`.
|
|
514
|
-
*/
|
|
515
|
-
parameters: Record<string, unknown>;
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* A description of what the function does, used by the model to choose when and
|
|
519
|
-
* how to call the function.
|
|
520
|
-
*/
|
|
521
|
-
description?: string;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
497
|
/**
|
|
526
498
|
* Controls which (if any) function is called by the model. `none` means the model
|
|
527
499
|
* will not call a function and instead generates a message. `auto` means the model
|
|
@@ -668,8 +640,18 @@ export interface ChatCompletionCreateParamsBase {
|
|
|
668
640
|
presence_penalty?: number | null;
|
|
669
641
|
|
|
670
642
|
/**
|
|
671
|
-
* An object specifying the format that the model must output.
|
|
672
|
-
*
|
|
643
|
+
* An object specifying the format that the model must output.
|
|
644
|
+
*
|
|
645
|
+
* Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
|
|
646
|
+
* message the model generates is valid JSON.
|
|
647
|
+
*
|
|
648
|
+
* **Important:** when using JSON mode, you **must** also instruct the model to
|
|
649
|
+
* produce JSON yourself via a system or user message. Without this, the model may
|
|
650
|
+
* generate an unending stream of whitespace until the generation reaches the token
|
|
651
|
+
* limit, resulting in increased latency and appearance of a "stuck" request. Also
|
|
652
|
+
* note that the message content may be partially cut off if
|
|
653
|
+
* `finish_reason="length"`, which indicates the generation exceeded `max_tokens`
|
|
654
|
+
* or the conversation exceeded the max context length.
|
|
673
655
|
*/
|
|
674
656
|
response_format?: ChatCompletionCreateParams.ResponseFormat;
|
|
675
657
|
|
|
@@ -761,7 +743,7 @@ export namespace ChatCompletionCreateParams {
|
|
|
761
743
|
* To describe a function that accepts no parameters, provide the value
|
|
762
744
|
* `{"type": "object", "properties": {}}`.
|
|
763
745
|
*/
|
|
764
|
-
parameters:
|
|
746
|
+
parameters: Shared.FunctionParameters;
|
|
765
747
|
|
|
766
748
|
/**
|
|
767
749
|
* A description of what the function does, used by the model to choose when and
|
|
@@ -771,21 +753,21 @@ export namespace ChatCompletionCreateParams {
|
|
|
771
753
|
}
|
|
772
754
|
|
|
773
755
|
/**
|
|
774
|
-
* An object specifying the format that the model must output.
|
|
775
|
-
*
|
|
756
|
+
* An object specifying the format that the model must output.
|
|
757
|
+
*
|
|
758
|
+
* Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
|
|
759
|
+
* message the model generates is valid JSON.
|
|
760
|
+
*
|
|
761
|
+
* **Important:** when using JSON mode, you **must** also instruct the model to
|
|
762
|
+
* produce JSON yourself via a system or user message. Without this, the model may
|
|
763
|
+
* generate an unending stream of whitespace until the generation reaches the token
|
|
764
|
+
* limit, resulting in increased latency and appearance of a "stuck" request. Also
|
|
765
|
+
* note that the message content may be partially cut off if
|
|
766
|
+
* `finish_reason="length"`, which indicates the generation exceeded `max_tokens`
|
|
767
|
+
* or the conversation exceeded the max context length.
|
|
776
768
|
*/
|
|
777
769
|
export interface ResponseFormat {
|
|
778
770
|
/**
|
|
779
|
-
* Setting to `json_object` enables JSON mode. This guarantees that the message the
|
|
780
|
-
* model generates is valid JSON.
|
|
781
|
-
*
|
|
782
|
-
* Note that your system prompt must still instruct the model to produce JSON, and
|
|
783
|
-
* to help ensure you don't forget, the API will throw an error if the string
|
|
784
|
-
* `JSON` does not appear in your system message. Also note that the message
|
|
785
|
-
* content may be partial (i.e. cut off) if `finish_reason="length"`, which
|
|
786
|
-
* indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
|
787
|
-
* max context length.
|
|
788
|
-
*
|
|
789
771
|
* Must be one of `text` or `json_object`.
|
|
790
772
|
*/
|
|
791
773
|
type?: 'text' | 'json_object';
|
package/src/resources/files.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as Core from "../core";
|
|
4
4
|
import { APIResource } from "../resource";
|
|
5
5
|
import { isRequestOptions } from "../core";
|
|
6
|
+
import { type Response } from "../_shims/index";
|
|
6
7
|
import { sleep } from "../core";
|
|
7
8
|
import { APIConnectionTimeoutError } from "../error";
|
|
8
9
|
import * as FilesAPI from "./files";
|
|
@@ -58,6 +59,15 @@ export class Files extends APIResource {
|
|
|
58
59
|
/**
|
|
59
60
|
* Returns the contents of the specified file.
|
|
60
61
|
*/
|
|
62
|
+
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
|
|
63
|
+
return this.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns the contents of the specified file.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated The `.content()` method should be used instead
|
|
70
|
+
*/
|
|
61
71
|
retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise<string> {
|
|
62
72
|
return this.get(`/files/${fileId}/content`, {
|
|
63
73
|
...options,
|
package/src/resources/index.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
export interface FunctionDefinition {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
6
|
+
* underscores and dashes, with a maximum length of 64.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
12
|
+
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
13
|
+
* examples, and the
|
|
14
|
+
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
15
|
+
* documentation about the format.
|
|
16
|
+
*
|
|
17
|
+
* To describe a function that accepts no parameters, provide the value
|
|
18
|
+
* `{"type": "object", "properties": {}}`.
|
|
19
|
+
*/
|
|
20
|
+
parameters: FunctionParameters;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A description of what the function does, used by the model to choose when and
|
|
24
|
+
* how to call the function.
|
|
25
|
+
*/
|
|
26
|
+
description?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
31
|
+
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
32
|
+
* examples, and the
|
|
33
|
+
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
34
|
+
* documentation about the format.
|
|
35
|
+
*
|
|
36
|
+
* To describe a function that accepts no parameters, provide the value
|
|
37
|
+
* `{"type": "object", "properties": {}}`.
|
|
38
|
+
*/
|
|
39
|
+
export type FunctionParameters = Record<string, unknown>;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.17.1'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.17.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.17.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|