@discomedia/utils 1.0.60 → 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.
package/dist/test.js CHANGED
@@ -612,7 +612,7 @@ const safeJSON = (text) => {
612
612
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
613
613
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
614
614
 
615
- const VERSION = '6.22.0'; // x-release-please-version
615
+ const VERSION = '6.27.0'; // x-release-please-version
616
616
 
617
617
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
618
618
  const isRunningInBrowser = () => {
@@ -1232,6 +1232,11 @@ function stringify(object, opts = {}) {
1232
1232
  return joined.length > 0 ? prefix + joined : '';
1233
1233
  }
1234
1234
 
1235
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1236
+ function stringifyQuery(query) {
1237
+ return stringify(query, { arrayFormat: 'brackets' });
1238
+ }
1239
+
1235
1240
  function concatBytes(buffers) {
1236
1241
  let length = 0;
1237
1242
  for (const buffer of buffers) {
@@ -1450,7 +1455,7 @@ class Stream {
1450
1455
  this.controller = controller;
1451
1456
  __classPrivateFieldSet(this, _Stream_client, client);
1452
1457
  }
1453
- static fromSSEResponse(response, controller, client) {
1458
+ static fromSSEResponse(response, controller, client, synthesizeEventData) {
1454
1459
  let consumed = false;
1455
1460
  const logger = client ? loggerFor(client) : console;
1456
1461
  async function* iterator() {
@@ -1480,7 +1485,7 @@ class Stream {
1480
1485
  if (data && data.error) {
1481
1486
  throw new APIError(undefined, data.error, undefined, response.headers);
1482
1487
  }
1483
- yield data;
1488
+ yield synthesizeEventData ? { event: sse.event, data } : data;
1484
1489
  }
1485
1490
  else {
1486
1491
  let data;
@@ -1730,9 +1735,9 @@ async function defaultParseResponse(client, props) {
1730
1735
  // Note: there is an invariant here that isn't represented in the type system
1731
1736
  // that if you set `stream: true` the response type must also be `Stream<T>`
1732
1737
  if (props.options.__streamClass) {
1733
- return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
1738
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1734
1739
  }
1735
- return Stream.fromSSEResponse(response, props.controller, client);
1740
+ return Stream.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
1736
1741
  }
1737
1742
  // fetch refuses to read the body when the status code is 204.
1738
1743
  if (response.status === 204) {
@@ -2285,6 +2290,9 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
2285
2290
  const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
2286
2291
 
2287
2292
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2293
+ /**
2294
+ * Given a list of messages comprising a conversation, the model will return a response.
2295
+ */
2288
2296
  let Messages$1 = class Messages extends APIResource {
2289
2297
  /**
2290
2298
  * Get the messages in a stored chat completion. Only Chat Completions that have
@@ -3647,6 +3655,9 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
3647
3655
  }
3648
3656
 
3649
3657
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3658
+ /**
3659
+ * Given a list of messages comprising a conversation, the model will return a response.
3660
+ */
3650
3661
  let Completions$1 = class Completions extends APIResource {
3651
3662
  constructor() {
3652
3663
  super(...arguments);
@@ -3817,10 +3828,15 @@ const buildHeaders = (newHeaders) => {
3817
3828
  };
3818
3829
 
3819
3830
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3831
+ /**
3832
+ * Turn audio into text or text into audio.
3833
+ */
3820
3834
  class Speech extends APIResource {
3821
3835
  /**
3822
3836
  * Generates audio from the input text.
3823
3837
  *
3838
+ * Returns the audio file content, or a stream of audio events.
3839
+ *
3824
3840
  * @example
3825
3841
  * ```ts
3826
3842
  * const speech = await client.audio.speech.create({
@@ -3844,6 +3860,9 @@ class Speech extends APIResource {
3844
3860
  }
3845
3861
 
3846
3862
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3863
+ /**
3864
+ * Turn audio into text or text into audio.
3865
+ */
3847
3866
  class Transcriptions extends APIResource {
3848
3867
  create(body, options) {
3849
3868
  return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
@@ -3856,6 +3875,9 @@ class Transcriptions extends APIResource {
3856
3875
  }
3857
3876
 
3858
3877
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3878
+ /**
3879
+ * Turn audio into text or text into audio.
3880
+ */
3859
3881
  class Translations extends APIResource {
3860
3882
  create(body, options) {
3861
3883
  return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
@@ -3876,6 +3898,9 @@ Audio.Translations = Translations;
3876
3898
  Audio.Speech = Speech;
3877
3899
 
3878
3900
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3901
+ /**
3902
+ * Create large batches of API requests to run asynchronously.
3903
+ */
3879
3904
  class Batches extends APIResource {
3880
3905
  /**
3881
3906
  * Creates and executes a batch from an uploaded file of requests
@@ -3906,6 +3931,9 @@ class Batches extends APIResource {
3906
3931
  }
3907
3932
 
3908
3933
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3934
+ /**
3935
+ * Build Assistants that can call models and use tools.
3936
+ */
3909
3937
  class Assistants extends APIResource {
3910
3938
  /**
3911
3939
  * Create an assistant with a model and instructions.
@@ -4036,7 +4064,7 @@ Realtime$1.TranscriptionSessions = TranscriptionSessions;
4036
4064
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4037
4065
  class Sessions extends APIResource {
4038
4066
  /**
4039
- * Create a ChatKit session
4067
+ * Create a ChatKit session.
4040
4068
  *
4041
4069
  * @example
4042
4070
  * ```ts
@@ -4055,7 +4083,9 @@ class Sessions extends APIResource {
4055
4083
  });
4056
4084
  }
4057
4085
  /**
4058
- * Cancel a ChatKit session
4086
+ * Cancel an active ChatKit session and return its most recent metadata.
4087
+ *
4088
+ * Cancelling prevents new requests from using the issued client secret.
4059
4089
  *
4060
4090
  * @example
4061
4091
  * ```ts
@@ -4074,7 +4104,7 @@ class Sessions extends APIResource {
4074
4104
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4075
4105
  let Threads$1 = class Threads extends APIResource {
4076
4106
  /**
4077
- * Retrieve a ChatKit thread
4107
+ * Retrieve a ChatKit thread by its identifier.
4078
4108
  *
4079
4109
  * @example
4080
4110
  * ```ts
@@ -4089,7 +4119,7 @@ let Threads$1 = class Threads extends APIResource {
4089
4119
  });
4090
4120
  }
4091
4121
  /**
4092
- * List ChatKit threads
4122
+ * List ChatKit threads with optional pagination and user filters.
4093
4123
  *
4094
4124
  * @example
4095
4125
  * ```ts
@@ -4107,7 +4137,7 @@ let Threads$1 = class Threads extends APIResource {
4107
4137
  });
4108
4138
  }
4109
4139
  /**
4110
- * Delete a ChatKit thread
4140
+ * Delete a ChatKit thread along with its items and stored attachments.
4111
4141
  *
4112
4142
  * @example
4113
4143
  * ```ts
@@ -4123,7 +4153,7 @@ let Threads$1 = class Threads extends APIResource {
4123
4153
  });
4124
4154
  }
4125
4155
  /**
4126
- * List ChatKit thread items
4156
+ * List items that belong to a ChatKit thread.
4127
4157
  *
4128
4158
  * @example
4129
4159
  * ```ts
@@ -4153,6 +4183,8 @@ ChatKit.Threads = Threads$1;
4153
4183
 
4154
4184
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4155
4185
  /**
4186
+ * Build Assistants that can call models and use tools.
4187
+ *
4156
4188
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4157
4189
  */
4158
4190
  class Messages extends APIResource {
@@ -4221,6 +4253,8 @@ class Messages extends APIResource {
4221
4253
 
4222
4254
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4223
4255
  /**
4256
+ * Build Assistants that can call models and use tools.
4257
+ *
4224
4258
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4225
4259
  */
4226
4260
  class Steps extends APIResource {
@@ -4833,6 +4867,8 @@ _a$1 = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_ad
4833
4867
 
4834
4868
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4835
4869
  /**
4870
+ * Build Assistants that can call models and use tools.
4871
+ *
4836
4872
  * @deprecated The Assistants API is deprecated in favor of the Responses API
4837
4873
  */
4838
4874
  let Runs$1 = class Runs extends APIResource {
@@ -4848,6 +4884,7 @@ let Runs$1 = class Runs extends APIResource {
4848
4884
  ...options,
4849
4885
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4850
4886
  stream: params.stream ?? false,
4887
+ __synthesizeEventData: true,
4851
4888
  });
4852
4889
  }
4853
4890
  /**
@@ -4978,6 +5015,7 @@ let Runs$1 = class Runs extends APIResource {
4978
5015
  ...options,
4979
5016
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
4980
5017
  stream: params.stream ?? false,
5018
+ __synthesizeEventData: true,
4981
5019
  });
4982
5020
  }
4983
5021
  /**
@@ -5002,6 +5040,8 @@ Runs$1.Steps = Steps;
5002
5040
 
5003
5041
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5004
5042
  /**
5043
+ * Build Assistants that can call models and use tools.
5044
+ *
5005
5045
  * @deprecated The Assistants API is deprecated in favor of the Responses API
5006
5046
  */
5007
5047
  class Threads extends APIResource {
@@ -5062,6 +5102,7 @@ class Threads extends APIResource {
5062
5102
  ...options,
5063
5103
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
5064
5104
  stream: body.stream ?? false,
5105
+ __synthesizeEventData: true,
5065
5106
  });
5066
5107
  }
5067
5108
  /**
@@ -5099,6 +5140,9 @@ Beta.Assistants = Assistants;
5099
5140
  Beta.Threads = Threads;
5100
5141
 
5101
5142
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5143
+ /**
5144
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
5145
+ */
5102
5146
  class Completions extends APIResource {
5103
5147
  create(body, options) {
5104
5148
  return this._client.post('/completions', { body, ...options, stream: body.stream ?? false });
@@ -5201,6 +5245,9 @@ class Containers extends APIResource {
5201
5245
  Containers.Files = Files$2;
5202
5246
 
5203
5247
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5248
+ /**
5249
+ * Manage conversations and conversation items.
5250
+ */
5204
5251
  class Items extends APIResource {
5205
5252
  /**
5206
5253
  * Create items in a conversation with the given ID.
@@ -5236,6 +5283,9 @@ class Items extends APIResource {
5236
5283
  }
5237
5284
 
5238
5285
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5286
+ /**
5287
+ * Manage conversations and conversation items.
5288
+ */
5239
5289
  class Conversations extends APIResource {
5240
5290
  constructor() {
5241
5291
  super(...arguments);
@@ -5269,6 +5319,9 @@ class Conversations extends APIResource {
5269
5319
  Conversations.Items = Items;
5270
5320
 
5271
5321
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5322
+ /**
5323
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
5324
+ */
5272
5325
  class Embeddings extends APIResource {
5273
5326
  /**
5274
5327
  * Creates an embedding vector representing the input text.
@@ -5319,6 +5372,9 @@ class Embeddings extends APIResource {
5319
5372
  }
5320
5373
 
5321
5374
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5375
+ /**
5376
+ * Manage and run evals in the OpenAI platform.
5377
+ */
5322
5378
  class OutputItems extends APIResource {
5323
5379
  /**
5324
5380
  * Get an evaluation run output item by ID.
@@ -5337,6 +5393,9 @@ class OutputItems extends APIResource {
5337
5393
  }
5338
5394
 
5339
5395
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5396
+ /**
5397
+ * Manage and run evals in the OpenAI platform.
5398
+ */
5340
5399
  class Runs extends APIResource {
5341
5400
  constructor() {
5342
5401
  super(...arguments);
@@ -5384,6 +5443,9 @@ class Runs extends APIResource {
5384
5443
  Runs.OutputItems = OutputItems;
5385
5444
 
5386
5445
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5446
+ /**
5447
+ * Manage and run evals in the OpenAI platform.
5448
+ */
5387
5449
  class Evals extends APIResource {
5388
5450
  constructor() {
5389
5451
  super(...arguments);
@@ -5428,6 +5490,9 @@ class Evals extends APIResource {
5428
5490
  Evals.Runs = Runs;
5429
5491
 
5430
5492
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5493
+ /**
5494
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
5495
+ */
5431
5496
  let Files$1 = class Files extends APIResource {
5432
5497
  /**
5433
5498
  * Upload a file that can be used across various endpoints. Individual files can be
@@ -5507,6 +5572,9 @@ class Methods extends APIResource {
5507
5572
  }
5508
5573
 
5509
5574
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5575
+ /**
5576
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5577
+ */
5510
5578
  let Graders$1 = class Graders extends APIResource {
5511
5579
  /**
5512
5580
  * Run a grader.
@@ -5560,6 +5628,9 @@ class Alpha extends APIResource {
5560
5628
  Alpha.Graders = Graders$1;
5561
5629
 
5562
5630
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5631
+ /**
5632
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5633
+ */
5563
5634
  class Permissions extends APIResource {
5564
5635
  /**
5565
5636
  * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
@@ -5587,13 +5658,7 @@ class Permissions extends APIResource {
5587
5658
  * Organization owners can use this endpoint to view all permissions for a
5588
5659
  * fine-tuned model checkpoint.
5589
5660
  *
5590
- * @example
5591
- * ```ts
5592
- * const permission =
5593
- * await client.fineTuning.checkpoints.permissions.retrieve(
5594
- * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5595
- * );
5596
- * ```
5661
+ * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
5597
5662
  */
5598
5663
  retrieve(fineTunedModelCheckpoint, query = {}, options) {
5599
5664
  return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
@@ -5601,6 +5666,25 @@ class Permissions extends APIResource {
5601
5666
  ...options,
5602
5667
  });
5603
5668
  }
5669
+ /**
5670
+ * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5671
+ *
5672
+ * Organization owners can use this endpoint to view all permissions for a
5673
+ * fine-tuned model checkpoint.
5674
+ *
5675
+ * @example
5676
+ * ```ts
5677
+ * // Automatically fetches more pages as needed.
5678
+ * for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list(
5679
+ * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
5680
+ * )) {
5681
+ * // ...
5682
+ * }
5683
+ * ```
5684
+ */
5685
+ list(fineTunedModelCheckpoint, query = {}, options) {
5686
+ return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
5687
+ }
5604
5688
  /**
5605
5689
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
5606
5690
  *
@@ -5635,6 +5719,9 @@ let Checkpoints$1 = class Checkpoints extends APIResource {
5635
5719
  Checkpoints$1.Permissions = Permissions;
5636
5720
 
5637
5721
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5722
+ /**
5723
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5724
+ */
5638
5725
  class Checkpoints extends APIResource {
5639
5726
  /**
5640
5727
  * List checkpoints for a fine-tuning job.
@@ -5655,6 +5742,9 @@ class Checkpoints extends APIResource {
5655
5742
  }
5656
5743
 
5657
5744
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5745
+ /**
5746
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
5747
+ */
5658
5748
  class Jobs extends APIResource {
5659
5749
  constructor() {
5660
5750
  super(...arguments);
@@ -5796,6 +5886,9 @@ class Graders extends APIResource {
5796
5886
  Graders.GraderModels = GraderModels;
5797
5887
 
5798
5888
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5889
+ /**
5890
+ * Given a prompt and/or an input image, the model will generate a new image.
5891
+ */
5799
5892
  class Images extends APIResource {
5800
5893
  /**
5801
5894
  * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
@@ -5819,6 +5912,9 @@ class Images extends APIResource {
5819
5912
  }
5820
5913
 
5821
5914
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5915
+ /**
5916
+ * List and describe the various models available in the API.
5917
+ */
5822
5918
  class Models extends APIResource {
5823
5919
  /**
5824
5920
  * Retrieves a model instance, providing basic information about the model such as
@@ -5844,6 +5940,9 @@ class Models extends APIResource {
5844
5940
  }
5845
5941
 
5846
5942
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5943
+ /**
5944
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
5945
+ */
5847
5946
  class Moderations extends APIResource {
5848
5947
  /**
5849
5948
  * Classifies if text and/or image inputs are potentially harmful. Learn more in
@@ -5927,6 +6026,20 @@ class ClientSecrets extends APIResource {
5927
6026
  /**
5928
6027
  * Create a Realtime client secret with an associated session configuration.
5929
6028
  *
6029
+ * Client secrets are short-lived tokens that can be passed to a client app, such
6030
+ * as a web frontend or mobile client, which grants access to the Realtime API
6031
+ * without leaking your main API key. You can configure a custom TTL for each
6032
+ * client secret.
6033
+ *
6034
+ * You can also attach session configuration options to the client secret, which
6035
+ * will be applied to any sessions created using that client secret, but these can
6036
+ * also be overridden by the client connection.
6037
+ *
6038
+ * [Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
6039
+ *
6040
+ * Returns the created client secret and the effective session object. The client
6041
+ * secret is a string that looks like `ek_1234`.
6042
+ *
5930
6043
  * @example
5931
6044
  * ```ts
5932
6045
  * const clientSecret =
@@ -6352,7 +6465,10 @@ class InputItems extends APIResource {
6352
6465
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6353
6466
  class InputTokens extends APIResource {
6354
6467
  /**
6355
- * Get input token counts
6468
+ * Returns input token counts of the request.
6469
+ *
6470
+ * Returns an object with `object` set to `response.input_tokens` and an
6471
+ * `input_tokens` count.
6356
6472
  *
6357
6473
  * @example
6358
6474
  * ```ts
@@ -6434,12 +6550,17 @@ class Responses extends APIResource {
6434
6550
  return this._client.post(path `/responses/${responseID}/cancel`, options);
6435
6551
  }
6436
6552
  /**
6437
- * Compact conversation
6553
+ * Compact a conversation. Returns a compacted response object.
6554
+ *
6555
+ * Learn when and how to compact long-running conversations in the
6556
+ * [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
6557
+ * For ZDR-compatible compaction details, see
6558
+ * [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
6438
6559
  *
6439
6560
  * @example
6440
6561
  * ```ts
6441
6562
  * const compactedResponse = await client.responses.compact({
6442
- * model: 'gpt-5.2',
6563
+ * model: 'gpt-5.4',
6443
6564
  * });
6444
6565
  * ```
6445
6566
  */
@@ -6453,7 +6574,7 @@ Responses.InputTokens = InputTokens;
6453
6574
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6454
6575
  let Content$1 = class Content extends APIResource {
6455
6576
  /**
6456
- * Get Skill Content
6577
+ * Download a skill zip bundle by its ID.
6457
6578
  */
6458
6579
  retrieve(skillID, options) {
6459
6580
  return this._client.get(path `/skills/${skillID}/content`, {
@@ -6467,7 +6588,7 @@ let Content$1 = class Content extends APIResource {
6467
6588
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6468
6589
  class Content extends APIResource {
6469
6590
  /**
6470
- * Get Skill Version Content
6591
+ * Download a skill version zip bundle.
6471
6592
  */
6472
6593
  retrieve(version, params, options) {
6473
6594
  const { skill_id } = params;
@@ -6486,20 +6607,20 @@ class Versions extends APIResource {
6486
6607
  this.content = new Content(this._client);
6487
6608
  }
6488
6609
  /**
6489
- * Create Skill Version
6610
+ * Create a new immutable skill version.
6490
6611
  */
6491
6612
  create(skillID, body = {}, options) {
6492
6613
  return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6493
6614
  }
6494
6615
  /**
6495
- * Get Skill Version
6616
+ * Get a specific skill version.
6496
6617
  */
6497
6618
  retrieve(version, params, options) {
6498
6619
  const { skill_id } = params;
6499
6620
  return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
6500
6621
  }
6501
6622
  /**
6502
- * List Skill Versions
6623
+ * List skill versions for a skill.
6503
6624
  */
6504
6625
  list(skillID, query = {}, options) {
6505
6626
  return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
@@ -6508,7 +6629,7 @@ class Versions extends APIResource {
6508
6629
  });
6509
6630
  }
6510
6631
  /**
6511
- * Delete Skill Version
6632
+ * Delete a skill version.
6512
6633
  */
6513
6634
  delete(version, params, options) {
6514
6635
  const { skill_id } = params;
@@ -6525,31 +6646,31 @@ class Skills extends APIResource {
6525
6646
  this.versions = new Versions(this._client);
6526
6647
  }
6527
6648
  /**
6528
- * Create Skill
6649
+ * Create a new skill.
6529
6650
  */
6530
6651
  create(body = {}, options) {
6531
6652
  return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6532
6653
  }
6533
6654
  /**
6534
- * Get Skill
6655
+ * Get a skill by its ID.
6535
6656
  */
6536
6657
  retrieve(skillID, options) {
6537
6658
  return this._client.get(path `/skills/${skillID}`, options);
6538
6659
  }
6539
6660
  /**
6540
- * Update Skill Default Version
6661
+ * Update the default version pointer for a skill.
6541
6662
  */
6542
6663
  update(skillID, body, options) {
6543
6664
  return this._client.post(path `/skills/${skillID}`, { body, ...options });
6544
6665
  }
6545
6666
  /**
6546
- * List Skills
6667
+ * List all skills for the current project.
6547
6668
  */
6548
6669
  list(query = {}, options) {
6549
6670
  return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
6550
6671
  }
6551
6672
  /**
6552
- * Delete Skill
6673
+ * Delete a skill by its ID.
6553
6674
  */
6554
6675
  delete(skillID, options) {
6555
6676
  return this._client.delete(path `/skills/${skillID}`, options);
@@ -6559,6 +6680,9 @@ Skills.Content = Content$1;
6559
6680
  Skills.Versions = Versions;
6560
6681
 
6561
6682
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6683
+ /**
6684
+ * Use Uploads to upload large files in multiple parts.
6685
+ */
6562
6686
  class Parts extends APIResource {
6563
6687
  /**
6564
6688
  * Adds a
@@ -6579,6 +6703,9 @@ class Parts extends APIResource {
6579
6703
  }
6580
6704
 
6581
6705
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6706
+ /**
6707
+ * Use Uploads to upload large files in multiple parts.
6708
+ */
6582
6709
  class Uploads extends APIResource {
6583
6710
  constructor() {
6584
6711
  super(...arguments);
@@ -6604,12 +6731,16 @@ class Uploads extends APIResource {
6604
6731
  * For guidance on the proper filename extensions for each purpose, please follow
6605
6732
  * the documentation on
6606
6733
  * [creating a File](https://platform.openai.com/docs/api-reference/files/create).
6734
+ *
6735
+ * Returns the Upload object with status `pending`.
6607
6736
  */
6608
6737
  create(body, options) {
6609
6738
  return this._client.post('/uploads', { body, ...options });
6610
6739
  }
6611
6740
  /**
6612
6741
  * Cancels the Upload. No Parts may be added after an Upload is cancelled.
6742
+ *
6743
+ * Returns the Upload object with status `cancelled`.
6613
6744
  */
6614
6745
  cancel(uploadID, options) {
6615
6746
  return this._client.post(path `/uploads/${uploadID}/cancel`, options);
@@ -6627,7 +6758,9 @@ class Uploads extends APIResource {
6627
6758
  *
6628
6759
  * The number of bytes uploaded upon completion must match the number of bytes
6629
6760
  * initially specified when creating the Upload object. No Parts may be added after
6630
- * an Upload is completed.
6761
+ * an Upload is completed. Returns the Upload object with status `completed`,
6762
+ * including an additional `file` property containing the created usable File
6763
+ * object.
6631
6764
  */
6632
6765
  complete(uploadID, body, options) {
6633
6766
  return this._client.post(path `/uploads/${uploadID}/complete`, { body, ...options });
@@ -6987,31 +7120,33 @@ VectorStores.FileBatches = FileBatches;
6987
7120
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6988
7121
  class Videos extends APIResource {
6989
7122
  /**
6990
- * Create a video
7123
+ * Create a new video generation job from a prompt and optional reference assets.
6991
7124
  */
6992
7125
  create(body, options) {
6993
7126
  return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
6994
7127
  }
6995
7128
  /**
6996
- * Retrieve a video
7129
+ * Fetch the latest metadata for a generated video.
6997
7130
  */
6998
7131
  retrieve(videoID, options) {
6999
7132
  return this._client.get(path `/videos/${videoID}`, options);
7000
7133
  }
7001
7134
  /**
7002
- * List videos
7135
+ * List recently generated videos for the current project.
7003
7136
  */
7004
7137
  list(query = {}, options) {
7005
7138
  return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
7006
7139
  }
7007
7140
  /**
7008
- * Delete a video
7141
+ * Permanently delete a completed or failed video and its stored assets.
7009
7142
  */
7010
7143
  delete(videoID, options) {
7011
7144
  return this._client.delete(path `/videos/${videoID}`, options);
7012
7145
  }
7013
7146
  /**
7014
- * Download video content
7147
+ * Download the generated video bytes or a derived preview asset.
7148
+ *
7149
+ * Streams the rendered video content for the specified video job.
7015
7150
  */
7016
7151
  downloadContent(videoID, query = {}, options) {
7017
7152
  return this._client.get(path `/videos/${videoID}/content`, {
@@ -7022,7 +7157,7 @@ class Videos extends APIResource {
7022
7157
  });
7023
7158
  }
7024
7159
  /**
7025
- * Create a video remix
7160
+ * Create a remix of a completed video using a refreshed prompt.
7026
7161
  */
7027
7162
  remix(videoID, body, options) {
7028
7163
  return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
@@ -7147,24 +7282,54 @@ class OpenAI {
7147
7282
  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 } = {}) {
7148
7283
  _OpenAI_instances.add(this);
7149
7284
  _OpenAI_encoder.set(this, void 0);
7285
+ /**
7286
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
7287
+ */
7150
7288
  this.completions = new Completions(this);
7151
7289
  this.chat = new Chat(this);
7290
+ /**
7291
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
7292
+ */
7152
7293
  this.embeddings = new Embeddings(this);
7294
+ /**
7295
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
7296
+ */
7153
7297
  this.files = new Files$1(this);
7298
+ /**
7299
+ * Given a prompt and/or an input image, the model will generate a new image.
7300
+ */
7154
7301
  this.images = new Images(this);
7155
7302
  this.audio = new Audio(this);
7303
+ /**
7304
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
7305
+ */
7156
7306
  this.moderations = new Moderations(this);
7307
+ /**
7308
+ * List and describe the various models available in the API.
7309
+ */
7157
7310
  this.models = new Models(this);
7158
7311
  this.fineTuning = new FineTuning(this);
7159
7312
  this.graders = new Graders(this);
7160
7313
  this.vectorStores = new VectorStores(this);
7161
7314
  this.webhooks = new Webhooks(this);
7162
7315
  this.beta = new Beta(this);
7316
+ /**
7317
+ * Create large batches of API requests to run asynchronously.
7318
+ */
7163
7319
  this.batches = new Batches(this);
7320
+ /**
7321
+ * Use Uploads to upload large files in multiple parts.
7322
+ */
7164
7323
  this.uploads = new Uploads(this);
7165
7324
  this.responses = new Responses(this);
7166
7325
  this.realtime = new Realtime(this);
7326
+ /**
7327
+ * Manage conversations and conversation items.
7328
+ */
7167
7329
  this.conversations = new Conversations(this);
7330
+ /**
7331
+ * Manage and run evals in the OpenAI platform.
7332
+ */
7168
7333
  this.evals = new Evals(this);
7169
7334
  this.containers = new Containers(this);
7170
7335
  this.skills = new Skills(this);
@@ -7234,7 +7399,7 @@ class OpenAI {
7234
7399
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
7235
7400
  }
7236
7401
  stringifyQuery(query) {
7237
- return stringify(query, { arrayFormat: 'brackets' });
7402
+ return stringifyQuery(query);
7238
7403
  }
7239
7404
  getUserAgent() {
7240
7405
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -7503,9 +7668,9 @@ class OpenAI {
7503
7668
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
7504
7669
  }
7505
7670
  }
7506
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
7507
- // just do what it says, but otherwise calculate a default
7508
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
7671
+ // If the API asks us to wait a certain amount of time, just do what it
7672
+ // says, but otherwise calculate a default
7673
+ if (timeoutMillis === undefined) {
7509
7674
  const maxRetries = options.maxRetries ?? this.maxRetries;
7510
7675
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
7511
7676
  }
@@ -7602,6 +7767,13 @@ class OpenAI {
7602
7767
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
7603
7768
  return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
7604
7769
  }
7770
+ else if (typeof body === 'object' &&
7771
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
7772
+ return {
7773
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
7774
+ body: this.stringifyQuery(body),
7775
+ };
7776
+ }
7605
7777
  else {
7606
7778
  return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
7607
7779
  }