@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
@@ -258,7 +258,7 @@ const safeJSON = (text) => {
258
258
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
259
259
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
260
260
 
261
- const VERSION = '6.22.0'; // x-release-please-version
261
+ const VERSION = '6.27.0'; // x-release-please-version
262
262
 
263
263
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
264
264
  const isRunningInBrowser = () => {
@@ -878,6 +878,11 @@ function stringify(object, opts = {}) {
878
878
  return joined.length > 0 ? prefix + joined : '';
879
879
  }
880
880
 
881
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
882
+ function stringifyQuery(query) {
883
+ return stringify(query, { arrayFormat: 'brackets' });
884
+ }
885
+
881
886
  function concatBytes(buffers) {
882
887
  let length = 0;
883
888
  for (const buffer of buffers) {
@@ -1096,7 +1101,7 @@ class Stream {
1096
1101
  this.controller = controller;
1097
1102
  __classPrivateFieldSet(this, _Stream_client, client);
1098
1103
  }
1099
- static fromSSEResponse(response, controller, client) {
1104
+ static fromSSEResponse(response, controller, client, synthesizeEventData) {
1100
1105
  let consumed = false;
1101
1106
  const logger = client ? loggerFor(client) : console;
1102
1107
  async function* iterator() {
@@ -1126,7 +1131,7 @@ class Stream {
1126
1131
  if (data && data.error) {
1127
1132
  throw new APIError(undefined, data.error, undefined, response.headers);
1128
1133
  }
1129
- yield data;
1134
+ yield synthesizeEventData ? { event: sse.event, data } : data;
1130
1135
  }
1131
1136
  else {
1132
1137
  let data;
@@ -1376,9 +1381,9 @@ async function defaultParseResponse(client, props) {
1376
1381
  // Note: there is an invariant here that isn't represented in the type system
1377
1382
  // that if you set `stream: true` the response type must also be `Stream<T>`
1378
1383
  if (props.options.__streamClass) {
1379
- return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
1384
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1380
1385
  }
1381
- return Stream.fromSSEResponse(response, props.controller, client);
1386
+ return Stream.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1382
1387
  }
1383
1388
  // fetch refuses to read the body when the status code is 204.
1384
1389
  if (response.status === 204) {
@@ -1931,6 +1936,9 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
1931
1936
  const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
1932
1937
 
1933
1938
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1939
+ /**
1940
+ * Given a list of messages comprising a conversation, the model will return a response.
1941
+ */
1934
1942
  let Messages$1 = class Messages extends APIResource {
1935
1943
  /**
1936
1944
  * Get the messages in a stored chat completion. Only Chat Completions that have
@@ -3293,6 +3301,9 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
3293
3301
  }
3294
3302
 
3295
3303
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3304
+ /**
3305
+ * Given a list of messages comprising a conversation, the model will return a response.
3306
+ */
3296
3307
  let Completions$1 = class Completions extends APIResource {
3297
3308
  constructor() {
3298
3309
  super(...arguments);
@@ -3463,10 +3474,15 @@ const buildHeaders = (newHeaders) => {
3463
3474
  };
3464
3475
 
3465
3476
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3477
+ /**
3478
+ * Turn audio into text or text into audio.
3479
+ */
3466
3480
  class Speech extends APIResource {
3467
3481
  /**
3468
3482
  * Generates audio from the input text.
3469
3483
  *
3484
+ * Returns the audio file content, or a stream of audio events.
3485
+ *
3470
3486
  * @example
3471
3487
  * ```ts
3472
3488
  * const speech = await client.audio.speech.create({
@@ -3490,6 +3506,9 @@ class Speech extends APIResource {
3490
3506
  }
3491
3507
 
3492
3508
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3509
+ /**
3510
+ * Turn audio into text or text into audio.
3511
+ */
3493
3512
  class Transcriptions extends APIResource {
3494
3513
  create(body, options) {
3495
3514
  return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
@@ -3502,6 +3521,9 @@ class Transcriptions extends APIResource {
3502
3521
  }
3503
3522
 
3504
3523
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3524
+ /**
3525
+ * Turn audio into text or text into audio.
3526
+ */
3505
3527
  class Translations extends APIResource {
3506
3528
  create(body, options) {
3507
3529
  return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
@@ -3522,6 +3544,9 @@ Audio.Translations = Translations;
3522
3544
  Audio.Speech = Speech;
3523
3545
 
3524
3546
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3547
+ /**
3548
+ * Create large batches of API requests to run asynchronously.
3549
+ */
3525
3550
  class Batches extends APIResource {
3526
3551
  /**
3527
3552
  * Creates and executes a batch from an uploaded file of requests
@@ -3552,6 +3577,9 @@ class Batches extends APIResource {
3552
3577
  }
3553
3578
 
3554
3579
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3580
+ /**
3581
+ * Build Assistants that can call models and use tools.
3582
+ */
3555
3583
  class Assistants extends APIResource {
3556
3584
  /**
3557
3585
  * Create an assistant with a model and instructions.
@@ -3682,7 +3710,7 @@ Realtime$1.TranscriptionSessions = TranscriptionSessions;
3682
3710
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3683
3711
  class Sessions extends APIResource {
3684
3712
  /**
3685
- * Create a ChatKit session
3713
+ * Create a ChatKit session.
3686
3714
  *
3687
3715
  * @example
3688
3716
  * ```ts
@@ -3701,7 +3729,9 @@ class Sessions extends APIResource {
3701
3729
  });
3702
3730
  }
3703
3731
  /**
3704
- * Cancel a ChatKit session
3732
+ * Cancel an active ChatKit session and return its most recent metadata.
3733
+ *
3734
+ * Cancelling prevents new requests from using the issued client secret.
3705
3735
  *
3706
3736
  * @example
3707
3737
  * ```ts
@@ -3720,7 +3750,7 @@ class Sessions extends APIResource {
3720
3750
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3721
3751
  let Threads$1 = class Threads extends APIResource {
3722
3752
  /**
3723
- * Retrieve a ChatKit thread
3753
+ * Retrieve a ChatKit thread by its identifier.
3724
3754
  *
3725
3755
  * @example
3726
3756
  * ```ts
@@ -3735,7 +3765,7 @@ let Threads$1 = class Threads extends APIResource {
3735
3765
  });
3736
3766
  }
3737
3767
  /**
3738
- * List ChatKit threads
3768
+ * List ChatKit threads with optional pagination and user filters.
3739
3769
  *
3740
3770
  * @example
3741
3771
  * ```ts
@@ -3753,7 +3783,7 @@ let Threads$1 = class Threads extends APIResource {
3753
3783
  });
3754
3784
  }
3755
3785
  /**
3756
- * Delete a ChatKit thread
3786
+ * Delete a ChatKit thread along with its items and stored attachments.
3757
3787
  *
3758
3788
  * @example
3759
3789
  * ```ts
@@ -3769,7 +3799,7 @@ let Threads$1 = class Threads extends APIResource {
3769
3799
  });
3770
3800
  }
3771
3801
  /**
3772
- * List ChatKit thread items
3802
+ * List items that belong to a ChatKit thread.
3773
3803
  *
3774
3804
  * @example
3775
3805
  * ```ts
@@ -3799,6 +3829,8 @@ ChatKit.Threads = Threads$1;
3799
3829
 
3800
3830
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3801
3831
  /**
3832
+ * Build Assistants that can call models and use tools.
3833
+ *
3802
3834
  * @deprecated The Assistants API is deprecated in favor of the Responses API
3803
3835
  */
3804
3836
  class Messages extends APIResource {
@@ -3867,6 +3899,8 @@ class Messages extends APIResource {
3867
3899
 
3868
3900
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3869
3901
  /**
3902
+ * Build Assistants that can call models and use tools.
3903
+ *
3870
3904
  * @deprecated The Assistants API is deprecated in favor of the Responses API
3871
3905
  */
3872
3906
  class Steps extends APIResource {
@@ -4479,6 +4513,8 @@ _a$1 = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_ad
4479
4513
 
4480
4514
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4481
4515
  /**
4516
+ * Build Assistants that can call models and use tools.
4517
+ *
4482
4518
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4483
4519
  */
4484
4520
  let Runs$1 = class Runs extends APIResource {
@@ -4494,6 +4530,7 @@ let Runs$1 = class Runs extends APIResource {
4494
4530
  ...options,
4495
4531
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4496
4532
  stream: params.stream ?? false,
4533
+ __synthesizeEventData: true,
4497
4534
  });
4498
4535
  }
4499
4536
  /**
@@ -4624,6 +4661,7 @@ let Runs$1 = class Runs extends APIResource {
4624
4661
  ...options,
4625
4662
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4626
4663
  stream: params.stream ?? false,
4664
+ __synthesizeEventData: true,
4627
4665
  });
4628
4666
  }
4629
4667
  /**
@@ -4648,6 +4686,8 @@ Runs$1.Steps = Steps;
4648
4686
 
4649
4687
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4650
4688
  /**
4689
+ * Build Assistants that can call models and use tools.
4690
+ *
4651
4691
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4652
4692
  */
4653
4693
  class Threads extends APIResource {
@@ -4708,6 +4748,7 @@ class Threads extends APIResource {
4708
4748
  ...options,
4709
4749
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4710
4750
  stream: body.stream ?? false,
4751
+ __synthesizeEventData: true,
4711
4752
  });
4712
4753
  }
4713
4754
  /**
@@ -4745,6 +4786,9 @@ Beta.Assistants = Assistants;
4745
4786
  Beta.Threads = Threads;
4746
4787
 
4747
4788
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4789
+ /**
4790
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
4791
+ */
4748
4792
  class Completions extends APIResource {
4749
4793
  create(body, options) {
4750
4794
  return this._client.post('/completions', { body, ...options, stream: body.stream ?? false });
@@ -4847,6 +4891,9 @@ class Containers extends APIResource {
4847
4891
  Containers.Files = Files$2;
4848
4892
 
4849
4893
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4894
+ /**
4895
+ * Manage conversations and conversation items.
4896
+ */
4850
4897
  class Items extends APIResource {
4851
4898
  /**
4852
4899
  * Create items in a conversation with the given ID.
@@ -4882,6 +4929,9 @@ class Items extends APIResource {
4882
4929
  }
4883
4930
 
4884
4931
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4932
+ /**
4933
+ * Manage conversations and conversation items.
4934
+ */
4885
4935
  class Conversations extends APIResource {
4886
4936
  constructor() {
4887
4937
  super(...arguments);
@@ -4915,6 +4965,9 @@ class Conversations extends APIResource {
4915
4965
  Conversations.Items = Items;
4916
4966
 
4917
4967
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4968
+ /**
4969
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
4970
+ */
4918
4971
  class Embeddings extends APIResource {
4919
4972
  /**
4920
4973
  * Creates an embedding vector representing the input text.
@@ -4965,6 +5018,9 @@ class Embeddings extends APIResource {
4965
5018
  }
4966
5019
 
4967
5020
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5021
+ /**
5022
+ * Manage and run evals in the OpenAI platform.
5023
+ */
4968
5024
  class OutputItems extends APIResource {
4969
5025
  /**
4970
5026
  * Get an evaluation run output item by ID.
@@ -4983,6 +5039,9 @@ class OutputItems extends APIResource {
4983
5039
  }
4984
5040
 
4985
5041
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5042
+ /**
5043
+ * Manage and run evals in the OpenAI platform.
5044
+ */
4986
5045
  class Runs extends APIResource {
4987
5046
  constructor() {
4988
5047
  super(...arguments);
@@ -5030,6 +5089,9 @@ class Runs extends APIResource {
5030
5089
  Runs.OutputItems = OutputItems;
5031
5090
 
5032
5091
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5092
+ /**
5093
+ * Manage and run evals in the OpenAI platform.
5094
+ */
5033
5095
  class Evals extends APIResource {
5034
5096
  constructor() {
5035
5097
  super(...arguments);
@@ -5074,6 +5136,9 @@ class Evals extends APIResource {
5074
5136
  Evals.Runs = Runs;
5075
5137
 
5076
5138
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5139
+ /**
5140
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
5141
+ */
5077
5142
  let Files$1 = class Files extends APIResource {
5078
5143
  /**
5079
5144
  * Upload a file that can be used across various endpoints. Individual files can be
@@ -5153,6 +5218,9 @@ class Methods extends APIResource {
5153
5218
  }
5154
5219
 
5155
5220
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5221
+ /**
5222
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5223
+ */
5156
5224
  let Graders$1 = class Graders extends APIResource {
5157
5225
  /**
5158
5226
  * Run a grader.
@@ -5206,6 +5274,9 @@ class Alpha extends APIResource {
5206
5274
  Alpha.Graders = Graders$1;
5207
5275
 
5208
5276
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5277
+ /**
5278
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5279
+ */
5209
5280
  class Permissions extends APIResource {
5210
5281
  /**
5211
5282
  * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
@@ -5233,13 +5304,7 @@ class Permissions extends APIResource {
5233
5304
  * Organization owners can use this endpoint to view all permissions for a
5234
5305
  * fine-tuned model checkpoint.
5235
5306
  *
5236
- * @example
5237
- * ```ts
5238
- * const permission =
5239
- * await client.fineTuning.checkpoints.permissions.retrieve(
5240
- * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5241
- * );
5242
- * ```
5307
+ * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
5243
5308
  */
5244
5309
  retrieve(fineTunedModelCheckpoint, query = {}, options) {
5245
5310
  return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
@@ -5247,6 +5312,25 @@ class Permissions extends APIResource {
5247
5312
  ...options,
5248
5313
  });
5249
5314
  }
5315
+ /**
5316
+ * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5317
+ *
5318
+ * Organization owners can use this endpoint to view all permissions for a
5319
+ * fine-tuned model checkpoint.
5320
+ *
5321
+ * @example
5322
+ * ```ts
5323
+ * // Automatically fetches more pages as needed.
5324
+ * for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list(
5325
+ * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5326
+ * )) {
5327
+ * // ...
5328
+ * }
5329
+ * ```
5330
+ */
5331
+ list(fineTunedModelCheckpoint, query = {}, options) {
5332
+ return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
5333
+ }
5250
5334
  /**
5251
5335
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5252
5336
  *
@@ -5281,6 +5365,9 @@ let Checkpoints$1 = class Checkpoints extends APIResource {
5281
5365
  Checkpoints$1.Permissions = Permissions;
5282
5366
 
5283
5367
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5368
+ /**
5369
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5370
+ */
5284
5371
  class Checkpoints extends APIResource {
5285
5372
  /**
5286
5373
  * List checkpoints for a fine-tuning job.
@@ -5301,6 +5388,9 @@ class Checkpoints extends APIResource {
5301
5388
  }
5302
5389
 
5303
5390
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5391
+ /**
5392
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5393
+ */
5304
5394
  class Jobs extends APIResource {
5305
5395
  constructor() {
5306
5396
  super(...arguments);
@@ -5442,6 +5532,9 @@ class Graders extends APIResource {
5442
5532
  Graders.GraderModels = GraderModels;
5443
5533
 
5444
5534
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5535
+ /**
5536
+ * Given a prompt and/or an input image, the model will generate a new image.
5537
+ */
5445
5538
  class Images extends APIResource {
5446
5539
  /**
5447
5540
  * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
@@ -5465,6 +5558,9 @@ class Images extends APIResource {
5465
5558
  }
5466
5559
 
5467
5560
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5561
+ /**
5562
+ * List and describe the various models available in the API.
5563
+ */
5468
5564
  class Models extends APIResource {
5469
5565
  /**
5470
5566
  * Retrieves a model instance, providing basic information about the model such as
@@ -5490,6 +5586,9 @@ class Models extends APIResource {
5490
5586
  }
5491
5587
 
5492
5588
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5589
+ /**
5590
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
5591
+ */
5493
5592
  class Moderations extends APIResource {
5494
5593
  /**
5495
5594
  * Classifies if text and/or image inputs are potentially harmful. Learn more in
@@ -5573,6 +5672,20 @@ class ClientSecrets extends APIResource {
5573
5672
  /**
5574
5673
  * Create a Realtime client secret with an associated session configuration.
5575
5674
  *
5675
+ * Client secrets are short-lived tokens that can be passed to a client app, such
5676
+ * as a web frontend or mobile client, which grants access to the Realtime API
5677
+ * without leaking your main API key. You can configure a custom TTL for each
5678
+ * client secret.
5679
+ *
5680
+ * You can also attach session configuration options to the client secret, which
5681
+ * will be applied to any sessions created using that client secret, but these can
5682
+ * also be overridden by the client connection.
5683
+ *
5684
+ * [Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
5685
+ *
5686
+ * Returns the created client secret and the effective session object. The client
5687
+ * secret is a string that looks like `ek_1234`.
5688
+ *
5576
5689
  * @example
5577
5690
  * ```ts
5578
5691
  * const clientSecret =
@@ -5998,7 +6111,10 @@ class InputItems extends APIResource {
5998
6111
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5999
6112
  class InputTokens extends APIResource {
6000
6113
  /**
6001
- * Get input token counts
6114
+ * Returns input token counts of the request.
6115
+ *
6116
+ * Returns an object with `object` set to `response.input_tokens` and an
6117
+ * `input_tokens` count.
6002
6118
  *
6003
6119
  * @example
6004
6120
  * ```ts
@@ -6080,12 +6196,17 @@ class Responses extends APIResource {
6080
6196
  return this._client.post(path `/responses/${responseID}/cancel`, options);
6081
6197
  }
6082
6198
  /**
6083
- * Compact conversation
6199
+ * Compact a conversation. Returns a compacted response object.
6200
+ *
6201
+ * Learn when and how to compact long-running conversations in the
6202
+ * [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
6203
+ * For ZDR-compatible compaction details, see
6204
+ * [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
6084
6205
  *
6085
6206
  * @example
6086
6207
  * ```ts
6087
6208
  * const compactedResponse = await client.responses.compact({
6088
- * model: 'gpt-5.2',
6209
+ * model: 'gpt-5.4',
6089
6210
  * });
6090
6211
  * ```
6091
6212
  */
@@ -6099,7 +6220,7 @@ Responses.InputTokens = InputTokens;
6099
6220
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6100
6221
  let Content$1 = class Content extends APIResource {
6101
6222
  /**
6102
- * Get Skill Content
6223
+ * Download a skill zip bundle by its ID.
6103
6224
  */
6104
6225
  retrieve(skillID, options) {
6105
6226
  return this._client.get(path `/skills/${skillID}/content`, {
@@ -6113,7 +6234,7 @@ let Content$1 = class Content extends APIResource {
6113
6234
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6114
6235
  class Content extends APIResource {
6115
6236
  /**
6116
- * Get Skill Version Content
6237
+ * Download a skill version zip bundle.
6117
6238
  */
6118
6239
  retrieve(version, params, options) {
6119
6240
  const { skill_id } = params;
@@ -6132,20 +6253,20 @@ class Versions extends APIResource {
6132
6253
  this.content = new Content(this._client);
6133
6254
  }
6134
6255
  /**
6135
- * Create Skill Version
6256
+ * Create a new immutable skill version.
6136
6257
  */
6137
6258
  create(skillID, body = {}, options) {
6138
6259
  return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6139
6260
  }
6140
6261
  /**
6141
- * Get Skill Version
6262
+ * Get a specific skill version.
6142
6263
  */
6143
6264
  retrieve(version, params, options) {
6144
6265
  const { skill_id } = params;
6145
6266
  return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
6146
6267
  }
6147
6268
  /**
6148
- * List Skill Versions
6269
+ * List skill versions for a skill.
6149
6270
  */
6150
6271
  list(skillID, query = {}, options) {
6151
6272
  return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
@@ -6154,7 +6275,7 @@ class Versions extends APIResource {
6154
6275
  });
6155
6276
  }
6156
6277
  /**
6157
- * Delete Skill Version
6278
+ * Delete a skill version.
6158
6279
  */
6159
6280
  delete(version, params, options) {
6160
6281
  const { skill_id } = params;
@@ -6171,31 +6292,31 @@ class Skills extends APIResource {
6171
6292
  this.versions = new Versions(this._client);
6172
6293
  }
6173
6294
  /**
6174
- * Create Skill
6295
+ * Create a new skill.
6175
6296
  */
6176
6297
  create(body = {}, options) {
6177
6298
  return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6178
6299
  }
6179
6300
  /**
6180
- * Get Skill
6301
+ * Get a skill by its ID.
6181
6302
  */
6182
6303
  retrieve(skillID, options) {
6183
6304
  return this._client.get(path `/skills/${skillID}`, options);
6184
6305
  }
6185
6306
  /**
6186
- * Update Skill Default Version
6307
+ * Update the default version pointer for a skill.
6187
6308
  */
6188
6309
  update(skillID, body, options) {
6189
6310
  return this._client.post(path `/skills/${skillID}`, { body, ...options });
6190
6311
  }
6191
6312
  /**
6192
- * List Skills
6313
+ * List all skills for the current project.
6193
6314
  */
6194
6315
  list(query = {}, options) {
6195
6316
  return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
6196
6317
  }
6197
6318
  /**
6198
- * Delete Skill
6319
+ * Delete a skill by its ID.
6199
6320
  */
6200
6321
  delete(skillID, options) {
6201
6322
  return this._client.delete(path `/skills/${skillID}`, options);
@@ -6205,6 +6326,9 @@ Skills.Content = Content$1;
6205
6326
  Skills.Versions = Versions;
6206
6327
 
6207
6328
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6329
+ /**
6330
+ * Use Uploads to upload large files in multiple parts.
6331
+ */
6208
6332
  class Parts extends APIResource {
6209
6333
  /**
6210
6334
  * Adds a
@@ -6225,6 +6349,9 @@ class Parts extends APIResource {
6225
6349
  }
6226
6350
 
6227
6351
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6352
+ /**
6353
+ * Use Uploads to upload large files in multiple parts.
6354
+ */
6228
6355
  class Uploads extends APIResource {
6229
6356
  constructor() {
6230
6357
  super(...arguments);
@@ -6250,12 +6377,16 @@ class Uploads extends APIResource {
6250
6377
  * For guidance on the proper filename extensions for each purpose, please follow
6251
6378
  * the documentation on
6252
6379
  * [creating a File](https://platform.openai.com/docs/api-reference/files/create).
6380
+ *
6381
+ * Returns the Upload object with status `pending`.
6253
6382
  */
6254
6383
  create(body, options) {
6255
6384
  return this._client.post('/uploads', { body, ...options });
6256
6385
  }
6257
6386
  /**
6258
6387
  * Cancels the Upload. No Parts may be added after an Upload is cancelled.
6388
+ *
6389
+ * Returns the Upload object with status `cancelled`.
6259
6390
  */
6260
6391
  cancel(uploadID, options) {
6261
6392
  return this._client.post(path `/uploads/${uploadID}/cancel`, options);
@@ -6273,7 +6404,9 @@ class Uploads extends APIResource {
6273
6404
  *
6274
6405
  * The number of bytes uploaded upon completion must match the number of bytes
6275
6406
  * initially specified when creating the Upload object. No Parts may be added after
6276
- * an Upload is completed.
6407
+ * an Upload is completed. Returns the Upload object with status `completed`,
6408
+ * including an additional `file` property containing the created usable File
6409
+ * object.
6277
6410
  */
6278
6411
  complete(uploadID, body, options) {
6279
6412
  return this._client.post(path `/uploads/${uploadID}/complete`, { body, ...options });
@@ -6633,31 +6766,33 @@ VectorStores.FileBatches = FileBatches;
6633
6766
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6634
6767
  class Videos extends APIResource {
6635
6768
  /**
6636
- * Create a video
6769
+ * Create a new video generation job from a prompt and optional reference assets.
6637
6770
  */
6638
6771
  create(body, options) {
6639
6772
  return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6640
6773
  }
6641
6774
  /**
6642
- * Retrieve a video
6775
+ * Fetch the latest metadata for a generated video.
6643
6776
  */
6644
6777
  retrieve(videoID, options) {
6645
6778
  return this._client.get(path `/videos/${videoID}`, options);
6646
6779
  }
6647
6780
  /**
6648
- * List videos
6781
+ * List recently generated videos for the current project.
6649
6782
  */
6650
6783
  list(query = {}, options) {
6651
6784
  return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
6652
6785
  }
6653
6786
  /**
6654
- * Delete a video
6787
+ * Permanently delete a completed or failed video and its stored assets.
6655
6788
  */
6656
6789
  delete(videoID, options) {
6657
6790
  return this._client.delete(path `/videos/${videoID}`, options);
6658
6791
  }
6659
6792
  /**
6660
- * Download video content
6793
+ * Download the generated video bytes or a derived preview asset.
6794
+ *
6795
+ * Streams the rendered video content for the specified video job.
6661
6796
  */
6662
6797
  downloadContent(videoID, query = {}, options) {
6663
6798
  return this._client.get(path `/videos/${videoID}/content`, {
@@ -6668,7 +6803,7 @@ class Videos extends APIResource {
6668
6803
  });
6669
6804
  }
6670
6805
  /**
6671
- * Create a video remix
6806
+ * Create a remix of a completed video using a refreshed prompt.
6672
6807
  */
6673
6808
  remix(videoID, body, options) {
6674
6809
  return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
@@ -6793,24 +6928,54 @@ class OpenAI {
6793
6928
  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 } = {}) {
6794
6929
  _OpenAI_instances.add(this);
6795
6930
  _OpenAI_encoder.set(this, void 0);
6931
+ /**
6932
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
6933
+ */
6796
6934
  this.completions = new Completions(this);
6797
6935
  this.chat = new Chat(this);
6936
+ /**
6937
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
6938
+ */
6798
6939
  this.embeddings = new Embeddings(this);
6940
+ /**
6941
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
6942
+ */
6799
6943
  this.files = new Files$1(this);
6944
+ /**
6945
+ * Given a prompt and/or an input image, the model will generate a new image.
6946
+ */
6800
6947
  this.images = new Images(this);
6801
6948
  this.audio = new Audio(this);
6949
+ /**
6950
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
6951
+ */
6802
6952
  this.moderations = new Moderations(this);
6953
+ /**
6954
+ * List and describe the various models available in the API.
6955
+ */
6803
6956
  this.models = new Models(this);
6804
6957
  this.fineTuning = new FineTuning(this);
6805
6958
  this.graders = new Graders(this);
6806
6959
  this.vectorStores = new VectorStores(this);
6807
6960
  this.webhooks = new Webhooks(this);
6808
6961
  this.beta = new Beta(this);
6962
+ /**
6963
+ * Create large batches of API requests to run asynchronously.
6964
+ */
6809
6965
  this.batches = new Batches(this);
6966
+ /**
6967
+ * Use Uploads to upload large files in multiple parts.
6968
+ */
6810
6969
  this.uploads = new Uploads(this);
6811
6970
  this.responses = new Responses(this);
6812
6971
  this.realtime = new Realtime(this);
6972
+ /**
6973
+ * Manage conversations and conversation items.
6974
+ */
6813
6975
  this.conversations = new Conversations(this);
6976
+ /**
6977
+ * Manage and run evals in the OpenAI platform.
6978
+ */
6814
6979
  this.evals = new Evals(this);
6815
6980
  this.containers = new Containers(this);
6816
6981
  this.skills = new Skills(this);
@@ -6880,7 +7045,7 @@ class OpenAI {
6880
7045
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
6881
7046
  }
6882
7047
  stringifyQuery(query) {
6883
- return stringify(query, { arrayFormat: 'brackets' });
7048
+ return stringifyQuery(query);
6884
7049
  }
6885
7050
  getUserAgent() {
6886
7051
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -7149,9 +7314,9 @@ class OpenAI {
7149
7314
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
7150
7315
  }
7151
7316
  }
7152
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
7153
- // just do what it says, but otherwise calculate a default
7154
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
7317
+ // If the API asks us to wait a certain amount of time, just do what it
7318
+ // says, but otherwise calculate a default
7319
+ if (timeoutMillis === undefined) {
7155
7320
  const maxRetries = options.maxRetries ?? this.maxRetries;
7156
7321
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
7157
7322
  }
@@ -7248,6 +7413,13 @@ class OpenAI {
7248
7413
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
7249
7414
  return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
7250
7415
  }
7416
+ else if (typeof body === 'object' &&
7417
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
7418
+ return {
7419
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
7420
+ body: this.stringifyQuery(body),
7421
+ };
7422
+ }
7251
7423
  else {
7252
7424
  return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
7253
7425
  }