@discomedia/utils 1.0.59 → 1.0.61

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 (45) hide show
  1. package/README.md +0 -2
  2. package/dist/index-frontend.cjs +215 -43
  3. package/dist/index-frontend.cjs.map +1 -1
  4. package/dist/index-frontend.mjs +215 -43
  5. package/dist/index-frontend.mjs.map +1 -1
  6. package/dist/index.cjs +215 -1421
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.mjs +215 -1421
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/package.json +4 -4
  11. package/dist/test.js +215 -268
  12. package/dist/test.js.map +1 -1
  13. package/dist/types/index.d.ts +0 -82
  14. package/dist/types/index.d.ts.map +1 -1
  15. package/dist/types/misc-utils.d.ts +0 -6
  16. package/dist/types/misc-utils.d.ts.map +1 -1
  17. package/dist/types/types/index.d.ts +0 -2
  18. package/dist/types/types/index.d.ts.map +1 -1
  19. package/dist/types-frontend/index.d.ts +0 -82
  20. package/dist/types-frontend/index.d.ts.map +1 -1
  21. package/dist/types-frontend/misc-utils.d.ts +0 -6
  22. package/dist/types-frontend/misc-utils.d.ts.map +1 -1
  23. package/dist/types-frontend/types/index.d.ts +0 -2
  24. package/dist/types-frontend/types/index.d.ts.map +1 -1
  25. package/package.json +4 -4
  26. package/dist/types/polygon-indices.d.ts +0 -85
  27. package/dist/types/polygon-indices.d.ts.map +0 -1
  28. package/dist/types/polygon.d.ts +0 -126
  29. package/dist/types/polygon.d.ts.map +0 -1
  30. package/dist/types/technical-analysis.d.ts +0 -90
  31. package/dist/types/technical-analysis.d.ts.map +0 -1
  32. package/dist/types/types/polygon-indices-types.d.ts +0 -190
  33. package/dist/types/types/polygon-indices-types.d.ts.map +0 -1
  34. package/dist/types/types/polygon-types.d.ts +0 -204
  35. package/dist/types/types/polygon-types.d.ts.map +0 -1
  36. package/dist/types-frontend/polygon-indices.d.ts +0 -85
  37. package/dist/types-frontend/polygon-indices.d.ts.map +0 -1
  38. package/dist/types-frontend/polygon.d.ts +0 -126
  39. package/dist/types-frontend/polygon.d.ts.map +0 -1
  40. package/dist/types-frontend/technical-analysis.d.ts +0 -90
  41. package/dist/types-frontend/technical-analysis.d.ts.map +0 -1
  42. package/dist/types-frontend/types/polygon-indices-types.d.ts +0 -190
  43. package/dist/types-frontend/types/polygon-indices-types.d.ts.map +0 -1
  44. package/dist/types-frontend/types/polygon-types.d.ts +0 -204
  45. package/dist/types-frontend/types/polygon-types.d.ts.map +0 -1
@@ -260,7 +260,7 @@ const safeJSON = (text) => {
260
260
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
261
261
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
262
262
 
263
- const VERSION = '6.22.0'; // x-release-please-version
263
+ const VERSION = '6.27.0'; // x-release-please-version
264
264
 
265
265
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
266
266
  const isRunningInBrowser = () => {
@@ -880,6 +880,11 @@ function stringify(object, opts = {}) {
880
880
  return joined.length > 0 ? prefix + joined : '';
881
881
  }
882
882
 
883
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
884
+ function stringifyQuery(query) {
885
+ return stringify(query, { arrayFormat: 'brackets' });
886
+ }
887
+
883
888
  function concatBytes(buffers) {
884
889
  let length = 0;
885
890
  for (const buffer of buffers) {
@@ -1098,7 +1103,7 @@ class Stream {
1098
1103
  this.controller = controller;
1099
1104
  __classPrivateFieldSet(this, _Stream_client, client);
1100
1105
  }
1101
- static fromSSEResponse(response, controller, client) {
1106
+ static fromSSEResponse(response, controller, client, synthesizeEventData) {
1102
1107
  let consumed = false;
1103
1108
  const logger = client ? loggerFor(client) : console;
1104
1109
  async function* iterator() {
@@ -1128,7 +1133,7 @@ class Stream {
1128
1133
  if (data && data.error) {
1129
1134
  throw new APIError(undefined, data.error, undefined, response.headers);
1130
1135
  }
1131
- yield data;
1136
+ yield synthesizeEventData ? { event: sse.event, data } : data;
1132
1137
  }
1133
1138
  else {
1134
1139
  let data;
@@ -1378,9 +1383,9 @@ async function defaultParseResponse(client, props) {
1378
1383
  // Note: there is an invariant here that isn't represented in the type system
1379
1384
  // that if you set `stream: true` the response type must also be `Stream<T>`
1380
1385
  if (props.options.__streamClass) {
1381
- return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
1386
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1382
1387
  }
1383
- return Stream.fromSSEResponse(response, props.controller, client);
1388
+ return Stream.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1384
1389
  }
1385
1390
  // fetch refuses to read the body when the status code is 204.
1386
1391
  if (response.status === 204) {
@@ -1933,6 +1938,9 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
1933
1938
  const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
1934
1939
 
1935
1940
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1941
+ /**
1942
+ * Given a list of messages comprising a conversation, the model will return a response.
1943
+ */
1936
1944
  let Messages$1 = class Messages extends APIResource {
1937
1945
  /**
1938
1946
  * Get the messages in a stored chat completion. Only Chat Completions that have
@@ -3295,6 +3303,9 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
3295
3303
  }
3296
3304
 
3297
3305
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3306
+ /**
3307
+ * Given a list of messages comprising a conversation, the model will return a response.
3308
+ */
3298
3309
  let Completions$1 = class Completions extends APIResource {
3299
3310
  constructor() {
3300
3311
  super(...arguments);
@@ -3465,10 +3476,15 @@ const buildHeaders = (newHeaders) => {
3465
3476
  };
3466
3477
 
3467
3478
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3479
+ /**
3480
+ * Turn audio into text or text into audio.
3481
+ */
3468
3482
  class Speech extends APIResource {
3469
3483
  /**
3470
3484
  * Generates audio from the input text.
3471
3485
  *
3486
+ * Returns the audio file content, or a stream of audio events.
3487
+ *
3472
3488
  * @example
3473
3489
  * ```ts
3474
3490
  * const speech = await client.audio.speech.create({
@@ -3492,6 +3508,9 @@ class Speech extends APIResource {
3492
3508
  }
3493
3509
 
3494
3510
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3511
+ /**
3512
+ * Turn audio into text or text into audio.
3513
+ */
3495
3514
  class Transcriptions extends APIResource {
3496
3515
  create(body, options) {
3497
3516
  return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
@@ -3504,6 +3523,9 @@ class Transcriptions extends APIResource {
3504
3523
  }
3505
3524
 
3506
3525
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3526
+ /**
3527
+ * Turn audio into text or text into audio.
3528
+ */
3507
3529
  class Translations extends APIResource {
3508
3530
  create(body, options) {
3509
3531
  return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
@@ -3524,6 +3546,9 @@ Audio.Translations = Translations;
3524
3546
  Audio.Speech = Speech;
3525
3547
 
3526
3548
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3549
+ /**
3550
+ * Create large batches of API requests to run asynchronously.
3551
+ */
3527
3552
  class Batches extends APIResource {
3528
3553
  /**
3529
3554
  * Creates and executes a batch from an uploaded file of requests
@@ -3554,6 +3579,9 @@ class Batches extends APIResource {
3554
3579
  }
3555
3580
 
3556
3581
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3582
+ /**
3583
+ * Build Assistants that can call models and use tools.
3584
+ */
3557
3585
  class Assistants extends APIResource {
3558
3586
  /**
3559
3587
  * Create an assistant with a model and instructions.
@@ -3684,7 +3712,7 @@ Realtime$1.TranscriptionSessions = TranscriptionSessions;
3684
3712
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3685
3713
  class Sessions extends APIResource {
3686
3714
  /**
3687
- * Create a ChatKit session
3715
+ * Create a ChatKit session.
3688
3716
  *
3689
3717
  * @example
3690
3718
  * ```ts
@@ -3703,7 +3731,9 @@ class Sessions extends APIResource {
3703
3731
  });
3704
3732
  }
3705
3733
  /**
3706
- * Cancel a ChatKit session
3734
+ * Cancel an active ChatKit session and return its most recent metadata.
3735
+ *
3736
+ * Cancelling prevents new requests from using the issued client secret.
3707
3737
  *
3708
3738
  * @example
3709
3739
  * ```ts
@@ -3722,7 +3752,7 @@ class Sessions extends APIResource {
3722
3752
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3723
3753
  let Threads$1 = class Threads extends APIResource {
3724
3754
  /**
3725
- * Retrieve a ChatKit thread
3755
+ * Retrieve a ChatKit thread by its identifier.
3726
3756
  *
3727
3757
  * @example
3728
3758
  * ```ts
@@ -3737,7 +3767,7 @@ let Threads$1 = class Threads extends APIResource {
3737
3767
  });
3738
3768
  }
3739
3769
  /**
3740
- * List ChatKit threads
3770
+ * List ChatKit threads with optional pagination and user filters.
3741
3771
  *
3742
3772
  * @example
3743
3773
  * ```ts
@@ -3755,7 +3785,7 @@ let Threads$1 = class Threads extends APIResource {
3755
3785
  });
3756
3786
  }
3757
3787
  /**
3758
- * Delete a ChatKit thread
3788
+ * Delete a ChatKit thread along with its items and stored attachments.
3759
3789
  *
3760
3790
  * @example
3761
3791
  * ```ts
@@ -3771,7 +3801,7 @@ let Threads$1 = class Threads extends APIResource {
3771
3801
  });
3772
3802
  }
3773
3803
  /**
3774
- * List ChatKit thread items
3804
+ * List items that belong to a ChatKit thread.
3775
3805
  *
3776
3806
  * @example
3777
3807
  * ```ts
@@ -3801,6 +3831,8 @@ ChatKit.Threads = Threads$1;
3801
3831
 
3802
3832
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3803
3833
  /**
3834
+ * Build Assistants that can call models and use tools.
3835
+ *
3804
3836
  * @deprecated The Assistants API is deprecated in favor of the Responses API
3805
3837
  */
3806
3838
  class Messages extends APIResource {
@@ -3869,6 +3901,8 @@ class Messages extends APIResource {
3869
3901
 
3870
3902
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3871
3903
  /**
3904
+ * Build Assistants that can call models and use tools.
3905
+ *
3872
3906
  * @deprecated The Assistants API is deprecated in favor of the Responses API
3873
3907
  */
3874
3908
  class Steps extends APIResource {
@@ -4481,6 +4515,8 @@ _a$1 = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_ad
4481
4515
 
4482
4516
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4483
4517
  /**
4518
+ * Build Assistants that can call models and use tools.
4519
+ *
4484
4520
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4485
4521
  */
4486
4522
  let Runs$1 = class Runs extends APIResource {
@@ -4496,6 +4532,7 @@ let Runs$1 = class Runs extends APIResource {
4496
4532
  ...options,
4497
4533
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4498
4534
  stream: params.stream ?? false,
4535
+ __synthesizeEventData: true,
4499
4536
  });
4500
4537
  }
4501
4538
  /**
@@ -4626,6 +4663,7 @@ let Runs$1 = class Runs extends APIResource {
4626
4663
  ...options,
4627
4664
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4628
4665
  stream: params.stream ?? false,
4666
+ __synthesizeEventData: true,
4629
4667
  });
4630
4668
  }
4631
4669
  /**
@@ -4650,6 +4688,8 @@ Runs$1.Steps = Steps;
4650
4688
 
4651
4689
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4652
4690
  /**
4691
+ * Build Assistants that can call models and use tools.
4692
+ *
4653
4693
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4654
4694
  */
4655
4695
  class Threads extends APIResource {
@@ -4710,6 +4750,7 @@ class Threads extends APIResource {
4710
4750
  ...options,
4711
4751
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4712
4752
  stream: body.stream ?? false,
4753
+ __synthesizeEventData: true,
4713
4754
  });
4714
4755
  }
4715
4756
  /**
@@ -4747,6 +4788,9 @@ Beta.Assistants = Assistants;
4747
4788
  Beta.Threads = Threads;
4748
4789
 
4749
4790
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4791
+ /**
4792
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
4793
+ */
4750
4794
  class Completions extends APIResource {
4751
4795
  create(body, options) {
4752
4796
  return this._client.post('/completions', { body, ...options, stream: body.stream ?? false });
@@ -4849,6 +4893,9 @@ class Containers extends APIResource {
4849
4893
  Containers.Files = Files$2;
4850
4894
 
4851
4895
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4896
+ /**
4897
+ * Manage conversations and conversation items.
4898
+ */
4852
4899
  class Items extends APIResource {
4853
4900
  /**
4854
4901
  * Create items in a conversation with the given ID.
@@ -4884,6 +4931,9 @@ class Items extends APIResource {
4884
4931
  }
4885
4932
 
4886
4933
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4934
+ /**
4935
+ * Manage conversations and conversation items.
4936
+ */
4887
4937
  class Conversations extends APIResource {
4888
4938
  constructor() {
4889
4939
  super(...arguments);
@@ -4917,6 +4967,9 @@ class Conversations extends APIResource {
4917
4967
  Conversations.Items = Items;
4918
4968
 
4919
4969
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4970
+ /**
4971
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
4972
+ */
4920
4973
  class Embeddings extends APIResource {
4921
4974
  /**
4922
4975
  * Creates an embedding vector representing the input text.
@@ -4967,6 +5020,9 @@ class Embeddings extends APIResource {
4967
5020
  }
4968
5021
 
4969
5022
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5023
+ /**
5024
+ * Manage and run evals in the OpenAI platform.
5025
+ */
4970
5026
  class OutputItems extends APIResource {
4971
5027
  /**
4972
5028
  * Get an evaluation run output item by ID.
@@ -4985,6 +5041,9 @@ class OutputItems extends APIResource {
4985
5041
  }
4986
5042
 
4987
5043
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5044
+ /**
5045
+ * Manage and run evals in the OpenAI platform.
5046
+ */
4988
5047
  class Runs extends APIResource {
4989
5048
  constructor() {
4990
5049
  super(...arguments);
@@ -5032,6 +5091,9 @@ class Runs extends APIResource {
5032
5091
  Runs.OutputItems = OutputItems;
5033
5092
 
5034
5093
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5094
+ /**
5095
+ * Manage and run evals in the OpenAI platform.
5096
+ */
5035
5097
  class Evals extends APIResource {
5036
5098
  constructor() {
5037
5099
  super(...arguments);
@@ -5076,6 +5138,9 @@ class Evals extends APIResource {
5076
5138
  Evals.Runs = Runs;
5077
5139
 
5078
5140
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5141
+ /**
5142
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
5143
+ */
5079
5144
  let Files$1 = class Files extends APIResource {
5080
5145
  /**
5081
5146
  * Upload a file that can be used across various endpoints. Individual files can be
@@ -5155,6 +5220,9 @@ class Methods extends APIResource {
5155
5220
  }
5156
5221
 
5157
5222
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5223
+ /**
5224
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5225
+ */
5158
5226
  let Graders$1 = class Graders extends APIResource {
5159
5227
  /**
5160
5228
  * Run a grader.
@@ -5208,6 +5276,9 @@ class Alpha extends APIResource {
5208
5276
  Alpha.Graders = Graders$1;
5209
5277
 
5210
5278
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5279
+ /**
5280
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5281
+ */
5211
5282
  class Permissions extends APIResource {
5212
5283
  /**
5213
5284
  * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
@@ -5235,13 +5306,7 @@ class Permissions extends APIResource {
5235
5306
  * Organization owners can use this endpoint to view all permissions for a
5236
5307
  * fine-tuned model checkpoint.
5237
5308
  *
5238
- * @example
5239
- * ```ts
5240
- * const permission =
5241
- * await client.fineTuning.checkpoints.permissions.retrieve(
5242
- * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5243
- * );
5244
- * ```
5309
+ * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
5245
5310
  */
5246
5311
  retrieve(fineTunedModelCheckpoint, query = {}, options) {
5247
5312
  return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
@@ -5249,6 +5314,25 @@ class Permissions extends APIResource {
5249
5314
  ...options,
5250
5315
  });
5251
5316
  }
5317
+ /**
5318
+ * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5319
+ *
5320
+ * Organization owners can use this endpoint to view all permissions for a
5321
+ * fine-tuned model checkpoint.
5322
+ *
5323
+ * @example
5324
+ * ```ts
5325
+ * // Automatically fetches more pages as needed.
5326
+ * for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list(
5327
+ * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5328
+ * )) {
5329
+ * // ...
5330
+ * }
5331
+ * ```
5332
+ */
5333
+ list(fineTunedModelCheckpoint, query = {}, options) {
5334
+ return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
5335
+ }
5252
5336
  /**
5253
5337
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5254
5338
  *
@@ -5283,6 +5367,9 @@ let Checkpoints$1 = class Checkpoints extends APIResource {
5283
5367
  Checkpoints$1.Permissions = Permissions;
5284
5368
 
5285
5369
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5370
+ /**
5371
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5372
+ */
5286
5373
  class Checkpoints extends APIResource {
5287
5374
  /**
5288
5375
  * List checkpoints for a fine-tuning job.
@@ -5303,6 +5390,9 @@ class Checkpoints extends APIResource {
5303
5390
  }
5304
5391
 
5305
5392
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5393
+ /**
5394
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5395
+ */
5306
5396
  class Jobs extends APIResource {
5307
5397
  constructor() {
5308
5398
  super(...arguments);
@@ -5444,6 +5534,9 @@ class Graders extends APIResource {
5444
5534
  Graders.GraderModels = GraderModels;
5445
5535
 
5446
5536
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5537
+ /**
5538
+ * Given a prompt and/or an input image, the model will generate a new image.
5539
+ */
5447
5540
  class Images extends APIResource {
5448
5541
  /**
5449
5542
  * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
@@ -5467,6 +5560,9 @@ class Images extends APIResource {
5467
5560
  }
5468
5561
 
5469
5562
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5563
+ /**
5564
+ * List and describe the various models available in the API.
5565
+ */
5470
5566
  class Models extends APIResource {
5471
5567
  /**
5472
5568
  * Retrieves a model instance, providing basic information about the model such as
@@ -5492,6 +5588,9 @@ class Models extends APIResource {
5492
5588
  }
5493
5589
 
5494
5590
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5591
+ /**
5592
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
5593
+ */
5495
5594
  class Moderations extends APIResource {
5496
5595
  /**
5497
5596
  * Classifies if text and/or image inputs are potentially harmful. Learn more in
@@ -5575,6 +5674,20 @@ class ClientSecrets extends APIResource {
5575
5674
  /**
5576
5675
  * Create a Realtime client secret with an associated session configuration.
5577
5676
  *
5677
+ * Client secrets are short-lived tokens that can be passed to a client app, such
5678
+ * as a web frontend or mobile client, which grants access to the Realtime API
5679
+ * without leaking your main API key. You can configure a custom TTL for each
5680
+ * client secret.
5681
+ *
5682
+ * You can also attach session configuration options to the client secret, which
5683
+ * will be applied to any sessions created using that client secret, but these can
5684
+ * also be overridden by the client connection.
5685
+ *
5686
+ * [Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
5687
+ *
5688
+ * Returns the created client secret and the effective session object. The client
5689
+ * secret is a string that looks like `ek_1234`.
5690
+ *
5578
5691
  * @example
5579
5692
  * ```ts
5580
5693
  * const clientSecret =
@@ -6000,7 +6113,10 @@ class InputItems extends APIResource {
6000
6113
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6001
6114
  class InputTokens extends APIResource {
6002
6115
  /**
6003
- * Get input token counts
6116
+ * Returns input token counts of the request.
6117
+ *
6118
+ * Returns an object with `object` set to `response.input_tokens` and an
6119
+ * `input_tokens` count.
6004
6120
  *
6005
6121
  * @example
6006
6122
  * ```ts
@@ -6082,12 +6198,17 @@ class Responses extends APIResource {
6082
6198
  return this._client.post(path `/responses/${responseID}/cancel`, options);
6083
6199
  }
6084
6200
  /**
6085
- * Compact conversation
6201
+ * Compact a conversation. Returns a compacted response object.
6202
+ *
6203
+ * Learn when and how to compact long-running conversations in the
6204
+ * [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
6205
+ * For ZDR-compatible compaction details, see
6206
+ * [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
6086
6207
  *
6087
6208
  * @example
6088
6209
  * ```ts
6089
6210
  * const compactedResponse = await client.responses.compact({
6090
- * model: 'gpt-5.2',
6211
+ * model: 'gpt-5.4',
6091
6212
  * });
6092
6213
  * ```
6093
6214
  */
@@ -6101,7 +6222,7 @@ Responses.InputTokens = InputTokens;
6101
6222
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6102
6223
  let Content$1 = class Content extends APIResource {
6103
6224
  /**
6104
- * Get Skill Content
6225
+ * Download a skill zip bundle by its ID.
6105
6226
  */
6106
6227
  retrieve(skillID, options) {
6107
6228
  return this._client.get(path `/skills/${skillID}/content`, {
@@ -6115,7 +6236,7 @@ let Content$1 = class Content extends APIResource {
6115
6236
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6116
6237
  class Content extends APIResource {
6117
6238
  /**
6118
- * Get Skill Version Content
6239
+ * Download a skill version zip bundle.
6119
6240
  */
6120
6241
  retrieve(version, params, options) {
6121
6242
  const { skill_id } = params;
@@ -6134,20 +6255,20 @@ class Versions extends APIResource {
6134
6255
  this.content = new Content(this._client);
6135
6256
  }
6136
6257
  /**
6137
- * Create Skill Version
6258
+ * Create a new immutable skill version.
6138
6259
  */
6139
6260
  create(skillID, body = {}, options) {
6140
6261
  return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6141
6262
  }
6142
6263
  /**
6143
- * Get Skill Version
6264
+ * Get a specific skill version.
6144
6265
  */
6145
6266
  retrieve(version, params, options) {
6146
6267
  const { skill_id } = params;
6147
6268
  return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
6148
6269
  }
6149
6270
  /**
6150
- * List Skill Versions
6271
+ * List skill versions for a skill.
6151
6272
  */
6152
6273
  list(skillID, query = {}, options) {
6153
6274
  return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
@@ -6156,7 +6277,7 @@ class Versions extends APIResource {
6156
6277
  });
6157
6278
  }
6158
6279
  /**
6159
- * Delete Skill Version
6280
+ * Delete a skill version.
6160
6281
  */
6161
6282
  delete(version, params, options) {
6162
6283
  const { skill_id } = params;
@@ -6173,31 +6294,31 @@ class Skills extends APIResource {
6173
6294
  this.versions = new Versions(this._client);
6174
6295
  }
6175
6296
  /**
6176
- * Create Skill
6297
+ * Create a new skill.
6177
6298
  */
6178
6299
  create(body = {}, options) {
6179
6300
  return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6180
6301
  }
6181
6302
  /**
6182
- * Get Skill
6303
+ * Get a skill by its ID.
6183
6304
  */
6184
6305
  retrieve(skillID, options) {
6185
6306
  return this._client.get(path `/skills/${skillID}`, options);
6186
6307
  }
6187
6308
  /**
6188
- * Update Skill Default Version
6309
+ * Update the default version pointer for a skill.
6189
6310
  */
6190
6311
  update(skillID, body, options) {
6191
6312
  return this._client.post(path `/skills/${skillID}`, { body, ...options });
6192
6313
  }
6193
6314
  /**
6194
- * List Skills
6315
+ * List all skills for the current project.
6195
6316
  */
6196
6317
  list(query = {}, options) {
6197
6318
  return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
6198
6319
  }
6199
6320
  /**
6200
- * Delete Skill
6321
+ * Delete a skill by its ID.
6201
6322
  */
6202
6323
  delete(skillID, options) {
6203
6324
  return this._client.delete(path `/skills/${skillID}`, options);
@@ -6207,6 +6328,9 @@ Skills.Content = Content$1;
6207
6328
  Skills.Versions = Versions;
6208
6329
 
6209
6330
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6331
+ /**
6332
+ * Use Uploads to upload large files in multiple parts.
6333
+ */
6210
6334
  class Parts extends APIResource {
6211
6335
  /**
6212
6336
  * Adds a
@@ -6227,6 +6351,9 @@ class Parts extends APIResource {
6227
6351
  }
6228
6352
 
6229
6353
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6354
+ /**
6355
+ * Use Uploads to upload large files in multiple parts.
6356
+ */
6230
6357
  class Uploads extends APIResource {
6231
6358
  constructor() {
6232
6359
  super(...arguments);
@@ -6252,12 +6379,16 @@ class Uploads extends APIResource {
6252
6379
  * For guidance on the proper filename extensions for each purpose, please follow
6253
6380
  * the documentation on
6254
6381
  * [creating a File](https://platform.openai.com/docs/api-reference/files/create).
6382
+ *
6383
+ * Returns the Upload object with status `pending`.
6255
6384
  */
6256
6385
  create(body, options) {
6257
6386
  return this._client.post('/uploads', { body, ...options });
6258
6387
  }
6259
6388
  /**
6260
6389
  * Cancels the Upload. No Parts may be added after an Upload is cancelled.
6390
+ *
6391
+ * Returns the Upload object with status `cancelled`.
6261
6392
  */
6262
6393
  cancel(uploadID, options) {
6263
6394
  return this._client.post(path `/uploads/${uploadID}/cancel`, options);
@@ -6275,7 +6406,9 @@ class Uploads extends APIResource {
6275
6406
  *
6276
6407
  * The number of bytes uploaded upon completion must match the number of bytes
6277
6408
  * initially specified when creating the Upload object. No Parts may be added after
6278
- * an Upload is completed.
6409
+ * an Upload is completed. Returns the Upload object with status `completed`,
6410
+ * including an additional `file` property containing the created usable File
6411
+ * object.
6279
6412
  */
6280
6413
  complete(uploadID, body, options) {
6281
6414
  return this._client.post(path `/uploads/${uploadID}/complete`, { body, ...options });
@@ -6635,31 +6768,33 @@ VectorStores.FileBatches = FileBatches;
6635
6768
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6636
6769
  class Videos extends APIResource {
6637
6770
  /**
6638
- * Create a video
6771
+ * Create a new video generation job from a prompt and optional reference assets.
6639
6772
  */
6640
6773
  create(body, options) {
6641
6774
  return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6642
6775
  }
6643
6776
  /**
6644
- * Retrieve a video
6777
+ * Fetch the latest metadata for a generated video.
6645
6778
  */
6646
6779
  retrieve(videoID, options) {
6647
6780
  return this._client.get(path `/videos/${videoID}`, options);
6648
6781
  }
6649
6782
  /**
6650
- * List videos
6783
+ * List recently generated videos for the current project.
6651
6784
  */
6652
6785
  list(query = {}, options) {
6653
6786
  return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
6654
6787
  }
6655
6788
  /**
6656
- * Delete a video
6789
+ * Permanently delete a completed or failed video and its stored assets.
6657
6790
  */
6658
6791
  delete(videoID, options) {
6659
6792
  return this._client.delete(path `/videos/${videoID}`, options);
6660
6793
  }
6661
6794
  /**
6662
- * Download video content
6795
+ * Download the generated video bytes or a derived preview asset.
6796
+ *
6797
+ * Streams the rendered video content for the specified video job.
6663
6798
  */
6664
6799
  downloadContent(videoID, query = {}, options) {
6665
6800
  return this._client.get(path `/videos/${videoID}/content`, {
@@ -6670,7 +6805,7 @@ class Videos extends APIResource {
6670
6805
  });
6671
6806
  }
6672
6807
  /**
6673
- * Create a video remix
6808
+ * Create a remix of a completed video using a refreshed prompt.
6674
6809
  */
6675
6810
  remix(videoID, body, options) {
6676
6811
  return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
@@ -6795,24 +6930,54 @@ class OpenAI {
6795
6930
  constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, ...opts } = {}) {
6796
6931
  _OpenAI_instances.add(this);
6797
6932
  _OpenAI_encoder.set(this, void 0);
6933
+ /**
6934
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
6935
+ */
6798
6936
  this.completions = new Completions(this);
6799
6937
  this.chat = new Chat(this);
6938
+ /**
6939
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
6940
+ */
6800
6941
  this.embeddings = new Embeddings(this);
6942
+ /**
6943
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
6944
+ */
6801
6945
  this.files = new Files$1(this);
6946
+ /**
6947
+ * Given a prompt and/or an input image, the model will generate a new image.
6948
+ */
6802
6949
  this.images = new Images(this);
6803
6950
  this.audio = new Audio(this);
6951
+ /**
6952
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
6953
+ */
6804
6954
  this.moderations = new Moderations(this);
6955
+ /**
6956
+ * List and describe the various models available in the API.
6957
+ */
6805
6958
  this.models = new Models(this);
6806
6959
  this.fineTuning = new FineTuning(this);
6807
6960
  this.graders = new Graders(this);
6808
6961
  this.vectorStores = new VectorStores(this);
6809
6962
  this.webhooks = new Webhooks(this);
6810
6963
  this.beta = new Beta(this);
6964
+ /**
6965
+ * Create large batches of API requests to run asynchronously.
6966
+ */
6811
6967
  this.batches = new Batches(this);
6968
+ /**
6969
+ * Use Uploads to upload large files in multiple parts.
6970
+ */
6812
6971
  this.uploads = new Uploads(this);
6813
6972
  this.responses = new Responses(this);
6814
6973
  this.realtime = new Realtime(this);
6974
+ /**
6975
+ * Manage conversations and conversation items.
6976
+ */
6815
6977
  this.conversations = new Conversations(this);
6978
+ /**
6979
+ * Manage and run evals in the OpenAI platform.
6980
+ */
6816
6981
  this.evals = new Evals(this);
6817
6982
  this.containers = new Containers(this);
6818
6983
  this.skills = new Skills(this);
@@ -6882,7 +7047,7 @@ class OpenAI {
6882
7047
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
6883
7048
  }
6884
7049
  stringifyQuery(query) {
6885
- return stringify(query, { arrayFormat: 'brackets' });
7050
+ return stringifyQuery(query);
6886
7051
  }
6887
7052
  getUserAgent() {
6888
7053
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -7151,9 +7316,9 @@ class OpenAI {
7151
7316
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
7152
7317
  }
7153
7318
  }
7154
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
7155
- // just do what it says, but otherwise calculate a default
7156
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
7319
+ // If the API asks us to wait a certain amount of time, just do what it
7320
+ // says, but otherwise calculate a default
7321
+ if (timeoutMillis === undefined) {
7157
7322
  const maxRetries = options.maxRetries ?? this.maxRetries;
7158
7323
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
7159
7324
  }
@@ -7250,6 +7415,13 @@ class OpenAI {
7250
7415
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
7251
7416
  return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
7252
7417
  }
7418
+ else if (typeof body === 'object' &&
7419
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
7420
+ return {
7421
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
7422
+ body: this.stringifyQuery(body),
7423
+ };
7424
+ }
7253
7425
  else {
7254
7426
  return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
7255
7427
  }