openai 4.16.2 → 4.17.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/index.d.mts +2 -0
  4. package/index.d.ts +2 -0
  5. package/index.d.ts.map +1 -1
  6. package/index.js.map +1 -1
  7. package/index.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/beta/assistants/assistants.d.ts +4 -96
  10. package/resources/beta/assistants/assistants.d.ts.map +1 -1
  11. package/resources/beta/assistants/assistants.js.map +1 -1
  12. package/resources/beta/assistants/assistants.mjs.map +1 -1
  13. package/resources/beta/threads/runs/runs.d.ts +5 -66
  14. package/resources/beta/threads/runs/runs.d.ts.map +1 -1
  15. package/resources/beta/threads/runs/runs.js.map +1 -1
  16. package/resources/beta/threads/runs/runs.mjs.map +1 -1
  17. package/resources/beta/threads/runs/steps.d.ts +4 -4
  18. package/resources/beta/threads/runs/steps.d.ts.map +1 -1
  19. package/resources/beta/threads/threads.d.ts +2 -32
  20. package/resources/beta/threads/threads.d.ts.map +1 -1
  21. package/resources/beta/threads/threads.js.map +1 -1
  22. package/resources/beta/threads/threads.mjs.map +1 -1
  23. package/resources/chat/completions.d.ts +27 -42
  24. package/resources/chat/completions.d.ts.map +1 -1
  25. package/resources/chat/completions.js.map +1 -1
  26. package/resources/chat/completions.mjs.map +1 -1
  27. package/resources/index.d.ts +1 -0
  28. package/resources/index.d.ts.map +1 -1
  29. package/resources/index.js +1 -0
  30. package/resources/index.js.map +1 -1
  31. package/resources/index.mjs +1 -0
  32. package/resources/index.mjs.map +1 -1
  33. package/resources/shared.d.ts +35 -0
  34. package/resources/shared.d.ts.map +1 -0
  35. package/resources/shared.js +4 -0
  36. package/resources/shared.js.map +1 -0
  37. package/resources/shared.mjs +3 -0
  38. package/resources/shared.mjs.map +1 -0
  39. package/src/index.ts +3 -0
  40. package/src/resources/beta/assistants/assistants.ts +4 -105
  41. package/src/resources/beta/threads/runs/runs.ts +5 -72
  42. package/src/resources/beta/threads/runs/steps.ts +4 -4
  43. package/src/resources/beta/threads/threads.ts +2 -35
  44. package/src/resources/chat/completions.ts +27 -45
  45. package/src/resources/index.ts +1 -0
  46. package/src/resources/shared.ts +39 -0
  47. package/src/version.ts +1 -1
  48. package/version.d.ts +1 -1
  49. package/version.js +1 -1
  50. package/version.mjs +1 -1
@@ -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: ChatCompletionTool.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. Used to enable JSON
672
- * mode.
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: Record<string, unknown>;
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. Used to enable JSON
775
- * mode.
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';
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
3
  export * from './chat/index';
4
+ export * from './shared';
4
5
  export { Audio } from './audio/audio';
5
6
  export { Beta } from './beta/beta';
6
7
  export {
@@ -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.16.2'; // x-release-please-version
1
+ export const VERSION = '4.17.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.16.2";
1
+ export declare const VERSION = "4.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '4.16.2'; // x-release-please-version
4
+ exports.VERSION = '4.17.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '4.16.2'; // x-release-please-version
1
+ export const VERSION = '4.17.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map