@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/index.cjs CHANGED
@@ -1614,7 +1614,7 @@ const safeJSON = (text) => {
1614
1614
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1615
1615
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1616
1616
 
1617
- const VERSION = '6.22.0'; // x-release-please-version
1617
+ const VERSION = '6.27.0'; // x-release-please-version
1618
1618
 
1619
1619
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1620
1620
  const isRunningInBrowser = () => {
@@ -2234,6 +2234,11 @@ function stringify(object, opts = {}) {
2234
2234
  return joined.length > 0 ? prefix + joined : '';
2235
2235
  }
2236
2236
 
2237
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2238
+ function stringifyQuery(query) {
2239
+ return stringify(query, { arrayFormat: 'brackets' });
2240
+ }
2241
+
2237
2242
  function concatBytes(buffers) {
2238
2243
  let length = 0;
2239
2244
  for (const buffer of buffers) {
@@ -2452,7 +2457,7 @@ class Stream {
2452
2457
  this.controller = controller;
2453
2458
  __classPrivateFieldSet(this, _Stream_client, client);
2454
2459
  }
2455
- static fromSSEResponse(response, controller, client) {
2460
+ static fromSSEResponse(response, controller, client, synthesizeEventData) {
2456
2461
  let consumed = false;
2457
2462
  const logger = client ? loggerFor(client) : console;
2458
2463
  async function* iterator() {
@@ -2482,7 +2487,7 @@ class Stream {
2482
2487
  if (data && data.error) {
2483
2488
  throw new APIError(undefined, data.error, undefined, response.headers);
2484
2489
  }
2485
- yield data;
2490
+ yield synthesizeEventData ? { event: sse.event, data } : data;
2486
2491
  }
2487
2492
  else {
2488
2493
  let data;
@@ -2732,9 +2737,9 @@ async function defaultParseResponse(client, props) {
2732
2737
  // Note: there is an invariant here that isn't represented in the type system
2733
2738
  // that if you set `stream: true` the response type must also be `Stream<T>`
2734
2739
  if (props.options.__streamClass) {
2735
- return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
2740
+ return props.options.__streamClass.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
2736
2741
  }
2737
- return Stream.fromSSEResponse(response, props.controller, client);
2742
+ return Stream.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
2738
2743
  }
2739
2744
  // fetch refuses to read the body when the status code is 204.
2740
2745
  if (response.status === 204) {
@@ -3287,6 +3292,9 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
3287
3292
  const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
3288
3293
 
3289
3294
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3295
+ /**
3296
+ * Given a list of messages comprising a conversation, the model will return a response.
3297
+ */
3290
3298
  let Messages$1 = class Messages extends APIResource {
3291
3299
  /**
3292
3300
  * Get the messages in a stored chat completion. Only Chat Completions that have
@@ -4649,6 +4657,9 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
4649
4657
  }
4650
4658
 
4651
4659
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4660
+ /**
4661
+ * Given a list of messages comprising a conversation, the model will return a response.
4662
+ */
4652
4663
  let Completions$1 = class Completions extends APIResource {
4653
4664
  constructor() {
4654
4665
  super(...arguments);
@@ -4819,10 +4830,15 @@ const buildHeaders = (newHeaders) => {
4819
4830
  };
4820
4831
 
4821
4832
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4833
+ /**
4834
+ * Turn audio into text or text into audio.
4835
+ */
4822
4836
  class Speech extends APIResource {
4823
4837
  /**
4824
4838
  * Generates audio from the input text.
4825
4839
  *
4840
+ * Returns the audio file content, or a stream of audio events.
4841
+ *
4826
4842
  * @example
4827
4843
  * ```ts
4828
4844
  * const speech = await client.audio.speech.create({
@@ -4846,6 +4862,9 @@ class Speech extends APIResource {
4846
4862
  }
4847
4863
 
4848
4864
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4865
+ /**
4866
+ * Turn audio into text or text into audio.
4867
+ */
4849
4868
  class Transcriptions extends APIResource {
4850
4869
  create(body, options) {
4851
4870
  return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
@@ -4858,6 +4877,9 @@ class Transcriptions extends APIResource {
4858
4877
  }
4859
4878
 
4860
4879
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4880
+ /**
4881
+ * Turn audio into text or text into audio.
4882
+ */
4861
4883
  class Translations extends APIResource {
4862
4884
  create(body, options) {
4863
4885
  return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
@@ -4878,6 +4900,9 @@ Audio.Translations = Translations;
4878
4900
  Audio.Speech = Speech;
4879
4901
 
4880
4902
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4903
+ /**
4904
+ * Create large batches of API requests to run asynchronously.
4905
+ */
4881
4906
  class Batches extends APIResource {
4882
4907
  /**
4883
4908
  * Creates and executes a batch from an uploaded file of requests
@@ -4908,6 +4933,9 @@ class Batches extends APIResource {
4908
4933
  }
4909
4934
 
4910
4935
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4936
+ /**
4937
+ * Build Assistants that can call models and use tools.
4938
+ */
4911
4939
  class Assistants extends APIResource {
4912
4940
  /**
4913
4941
  * Create an assistant with a model and instructions.
@@ -5038,7 +5066,7 @@ Realtime$1.TranscriptionSessions = TranscriptionSessions;
5038
5066
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5039
5067
  class Sessions extends APIResource {
5040
5068
  /**
5041
- * Create a ChatKit session
5069
+ * Create a ChatKit session.
5042
5070
  *
5043
5071
  * @example
5044
5072
  * ```ts
@@ -5057,7 +5085,9 @@ class Sessions extends APIResource {
5057
5085
  });
5058
5086
  }
5059
5087
  /**
5060
- * Cancel a ChatKit session
5088
+ * Cancel an active ChatKit session and return its most recent metadata.
5089
+ *
5090
+ * Cancelling prevents new requests from using the issued client secret.
5061
5091
  *
5062
5092
  * @example
5063
5093
  * ```ts
@@ -5076,7 +5106,7 @@ class Sessions extends APIResource {
5076
5106
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5077
5107
  let Threads$1 = class Threads extends APIResource {
5078
5108
  /**
5079
- * Retrieve a ChatKit thread
5109
+ * Retrieve a ChatKit thread by its identifier.
5080
5110
  *
5081
5111
  * @example
5082
5112
  * ```ts
@@ -5091,7 +5121,7 @@ let Threads$1 = class Threads extends APIResource {
5091
5121
  });
5092
5122
  }
5093
5123
  /**
5094
- * List ChatKit threads
5124
+ * List ChatKit threads with optional pagination and user filters.
5095
5125
  *
5096
5126
  * @example
5097
5127
  * ```ts
@@ -5109,7 +5139,7 @@ let Threads$1 = class Threads extends APIResource {
5109
5139
  });
5110
5140
  }
5111
5141
  /**
5112
- * Delete a ChatKit thread
5142
+ * Delete a ChatKit thread along with its items and stored attachments.
5113
5143
  *
5114
5144
  * @example
5115
5145
  * ```ts
@@ -5125,7 +5155,7 @@ let Threads$1 = class Threads extends APIResource {
5125
5155
  });
5126
5156
  }
5127
5157
  /**
5128
- * List ChatKit thread items
5158
+ * List items that belong to a ChatKit thread.
5129
5159
  *
5130
5160
  * @example
5131
5161
  * ```ts
@@ -5155,6 +5185,8 @@ ChatKit.Threads = Threads$1;
5155
5185
 
5156
5186
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5157
5187
  /**
5188
+ * Build Assistants that can call models and use tools.
5189
+ *
5158
5190
  * @deprecated The Assistants API is deprecated in favor of the Responses API
5159
5191
  */
5160
5192
  class Messages extends APIResource {
@@ -5223,6 +5255,8 @@ class Messages extends APIResource {
5223
5255
 
5224
5256
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5225
5257
  /**
5258
+ * Build Assistants that can call models and use tools.
5259
+ *
5226
5260
  * @deprecated The Assistants API is deprecated in favor of the Responses API
5227
5261
  */
5228
5262
  class Steps extends APIResource {
@@ -5835,6 +5869,8 @@ _a$1 = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_ad
5835
5869
 
5836
5870
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
5837
5871
  /**
5872
+ * Build Assistants that can call models and use tools.
5873
+ *
5838
5874
  * @deprecated The Assistants API is deprecated in favor of the Responses API
5839
5875
  */
5840
5876
  let Runs$1 = class Runs extends APIResource {
@@ -5850,6 +5886,7 @@ let Runs$1 = class Runs extends APIResource {
5850
5886
  ...options,
5851
5887
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
5852
5888
  stream: params.stream ?? false,
5889
+ __synthesizeEventData: true,
5853
5890
  });
5854
5891
  }
5855
5892
  /**
@@ -5980,6 +6017,7 @@ let Runs$1 = class Runs extends APIResource {
5980
6017
  ...options,
5981
6018
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
5982
6019
  stream: params.stream ?? false,
6020
+ __synthesizeEventData: true,
5983
6021
  });
5984
6022
  }
5985
6023
  /**
@@ -6004,6 +6042,8 @@ Runs$1.Steps = Steps;
6004
6042
 
6005
6043
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6006
6044
  /**
6045
+ * Build Assistants that can call models and use tools.
6046
+ *
6007
6047
  * @deprecated The Assistants API is deprecated in favor of the Responses API
6008
6048
  */
6009
6049
  class Threads extends APIResource {
@@ -6064,6 +6104,7 @@ class Threads extends APIResource {
6064
6104
  ...options,
6065
6105
  headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
6066
6106
  stream: body.stream ?? false,
6107
+ __synthesizeEventData: true,
6067
6108
  });
6068
6109
  }
6069
6110
  /**
@@ -6101,6 +6142,9 @@ Beta.Assistants = Assistants;
6101
6142
  Beta.Threads = Threads;
6102
6143
 
6103
6144
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6145
+ /**
6146
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
6147
+ */
6104
6148
  class Completions extends APIResource {
6105
6149
  create(body, options) {
6106
6150
  return this._client.post('/completions', { body, ...options, stream: body.stream ?? false });
@@ -6203,6 +6247,9 @@ class Containers extends APIResource {
6203
6247
  Containers.Files = Files$2;
6204
6248
 
6205
6249
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6250
+ /**
6251
+ * Manage conversations and conversation items.
6252
+ */
6206
6253
  class Items extends APIResource {
6207
6254
  /**
6208
6255
  * Create items in a conversation with the given ID.
@@ -6238,6 +6285,9 @@ class Items extends APIResource {
6238
6285
  }
6239
6286
 
6240
6287
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6288
+ /**
6289
+ * Manage conversations and conversation items.
6290
+ */
6241
6291
  class Conversations extends APIResource {
6242
6292
  constructor() {
6243
6293
  super(...arguments);
@@ -6271,6 +6321,9 @@ class Conversations extends APIResource {
6271
6321
  Conversations.Items = Items;
6272
6322
 
6273
6323
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6324
+ /**
6325
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
6326
+ */
6274
6327
  class Embeddings extends APIResource {
6275
6328
  /**
6276
6329
  * Creates an embedding vector representing the input text.
@@ -6321,6 +6374,9 @@ class Embeddings extends APIResource {
6321
6374
  }
6322
6375
 
6323
6376
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6377
+ /**
6378
+ * Manage and run evals in the OpenAI platform.
6379
+ */
6324
6380
  class OutputItems extends APIResource {
6325
6381
  /**
6326
6382
  * Get an evaluation run output item by ID.
@@ -6339,6 +6395,9 @@ class OutputItems extends APIResource {
6339
6395
  }
6340
6396
 
6341
6397
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6398
+ /**
6399
+ * Manage and run evals in the OpenAI platform.
6400
+ */
6342
6401
  class Runs extends APIResource {
6343
6402
  constructor() {
6344
6403
  super(...arguments);
@@ -6386,6 +6445,9 @@ class Runs extends APIResource {
6386
6445
  Runs.OutputItems = OutputItems;
6387
6446
 
6388
6447
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6448
+ /**
6449
+ * Manage and run evals in the OpenAI platform.
6450
+ */
6389
6451
  class Evals extends APIResource {
6390
6452
  constructor() {
6391
6453
  super(...arguments);
@@ -6430,6 +6492,9 @@ class Evals extends APIResource {
6430
6492
  Evals.Runs = Runs;
6431
6493
 
6432
6494
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6495
+ /**
6496
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
6497
+ */
6433
6498
  let Files$1 = class Files extends APIResource {
6434
6499
  /**
6435
6500
  * Upload a file that can be used across various endpoints. Individual files can be
@@ -6509,6 +6574,9 @@ class Methods extends APIResource {
6509
6574
  }
6510
6575
 
6511
6576
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6577
+ /**
6578
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
6579
+ */
6512
6580
  let Graders$1 = class Graders extends APIResource {
6513
6581
  /**
6514
6582
  * Run a grader.
@@ -6562,6 +6630,9 @@ class Alpha extends APIResource {
6562
6630
  Alpha.Graders = Graders$1;
6563
6631
 
6564
6632
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6633
+ /**
6634
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
6635
+ */
6565
6636
  class Permissions extends APIResource {
6566
6637
  /**
6567
6638
  * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
@@ -6589,13 +6660,7 @@ class Permissions extends APIResource {
6589
6660
  * Organization owners can use this endpoint to view all permissions for a
6590
6661
  * fine-tuned model checkpoint.
6591
6662
  *
6592
- * @example
6593
- * ```ts
6594
- * const permission =
6595
- * await client.fineTuning.checkpoints.permissions.retrieve(
6596
- * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
6597
- * );
6598
- * ```
6663
+ * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
6599
6664
  */
6600
6665
  retrieve(fineTunedModelCheckpoint, query = {}, options) {
6601
6666
  return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
@@ -6603,6 +6668,25 @@ class Permissions extends APIResource {
6603
6668
  ...options,
6604
6669
  });
6605
6670
  }
6671
+ /**
6672
+ * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
6673
+ *
6674
+ * Organization owners can use this endpoint to view all permissions for a
6675
+ * fine-tuned model checkpoint.
6676
+ *
6677
+ * @example
6678
+ * ```ts
6679
+ * // Automatically fetches more pages as needed.
6680
+ * for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list(
6681
+ * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
6682
+ * )) {
6683
+ * // ...
6684
+ * }
6685
+ * ```
6686
+ */
6687
+ list(fineTunedModelCheckpoint, query = {}, options) {
6688
+ return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
6689
+ }
6606
6690
  /**
6607
6691
  * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
6608
6692
  *
@@ -6637,6 +6721,9 @@ let Checkpoints$1 = class Checkpoints extends APIResource {
6637
6721
  Checkpoints$1.Permissions = Permissions;
6638
6722
 
6639
6723
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6724
+ /**
6725
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
6726
+ */
6640
6727
  class Checkpoints extends APIResource {
6641
6728
  /**
6642
6729
  * List checkpoints for a fine-tuning job.
@@ -6657,6 +6744,9 @@ class Checkpoints extends APIResource {
6657
6744
  }
6658
6745
 
6659
6746
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6747
+ /**
6748
+ * Manage fine-tuning jobs to tailor a model to your specific training data.
6749
+ */
6660
6750
  class Jobs extends APIResource {
6661
6751
  constructor() {
6662
6752
  super(...arguments);
@@ -6798,6 +6888,9 @@ class Graders extends APIResource {
6798
6888
  Graders.GraderModels = GraderModels;
6799
6889
 
6800
6890
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6891
+ /**
6892
+ * Given a prompt and/or an input image, the model will generate a new image.
6893
+ */
6801
6894
  class Images extends APIResource {
6802
6895
  /**
6803
6896
  * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
@@ -6821,6 +6914,9 @@ class Images extends APIResource {
6821
6914
  }
6822
6915
 
6823
6916
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6917
+ /**
6918
+ * List and describe the various models available in the API.
6919
+ */
6824
6920
  class Models extends APIResource {
6825
6921
  /**
6826
6922
  * Retrieves a model instance, providing basic information about the model such as
@@ -6846,6 +6942,9 @@ class Models extends APIResource {
6846
6942
  }
6847
6943
 
6848
6944
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
6945
+ /**
6946
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
6947
+ */
6849
6948
  class Moderations extends APIResource {
6850
6949
  /**
6851
6950
  * Classifies if text and/or image inputs are potentially harmful. Learn more in
@@ -6929,6 +7028,20 @@ class ClientSecrets extends APIResource {
6929
7028
  /**
6930
7029
  * Create a Realtime client secret with an associated session configuration.
6931
7030
  *
7031
+ * Client secrets are short-lived tokens that can be passed to a client app, such
7032
+ * as a web frontend or mobile client, which grants access to the Realtime API
7033
+ * without leaking your main API key. You can configure a custom TTL for each
7034
+ * client secret.
7035
+ *
7036
+ * You can also attach session configuration options to the client secret, which
7037
+ * will be applied to any sessions created using that client secret, but these can
7038
+ * also be overridden by the client connection.
7039
+ *
7040
+ * [Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
7041
+ *
7042
+ * Returns the created client secret and the effective session object. The client
7043
+ * secret is a string that looks like `ek_1234`.
7044
+ *
6932
7045
  * @example
6933
7046
  * ```ts
6934
7047
  * const clientSecret =
@@ -7354,7 +7467,10 @@ class InputItems extends APIResource {
7354
7467
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7355
7468
  class InputTokens extends APIResource {
7356
7469
  /**
7357
- * Get input token counts
7470
+ * Returns input token counts of the request.
7471
+ *
7472
+ * Returns an object with `object` set to `response.input_tokens` and an
7473
+ * `input_tokens` count.
7358
7474
  *
7359
7475
  * @example
7360
7476
  * ```ts
@@ -7436,12 +7552,17 @@ class Responses extends APIResource {
7436
7552
  return this._client.post(path `/responses/${responseID}/cancel`, options);
7437
7553
  }
7438
7554
  /**
7439
- * Compact conversation
7555
+ * Compact a conversation. Returns a compacted response object.
7556
+ *
7557
+ * Learn when and how to compact long-running conversations in the
7558
+ * [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
7559
+ * For ZDR-compatible compaction details, see
7560
+ * [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
7440
7561
  *
7441
7562
  * @example
7442
7563
  * ```ts
7443
7564
  * const compactedResponse = await client.responses.compact({
7444
- * model: 'gpt-5.2',
7565
+ * model: 'gpt-5.4',
7445
7566
  * });
7446
7567
  * ```
7447
7568
  */
@@ -7455,7 +7576,7 @@ Responses.InputTokens = InputTokens;
7455
7576
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7456
7577
  let Content$1 = class Content extends APIResource {
7457
7578
  /**
7458
- * Get Skill Content
7579
+ * Download a skill zip bundle by its ID.
7459
7580
  */
7460
7581
  retrieve(skillID, options) {
7461
7582
  return this._client.get(path `/skills/${skillID}/content`, {
@@ -7469,7 +7590,7 @@ let Content$1 = class Content extends APIResource {
7469
7590
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7470
7591
  class Content extends APIResource {
7471
7592
  /**
7472
- * Get Skill Version Content
7593
+ * Download a skill version zip bundle.
7473
7594
  */
7474
7595
  retrieve(version, params, options) {
7475
7596
  const { skill_id } = params;
@@ -7488,20 +7609,20 @@ class Versions extends APIResource {
7488
7609
  this.content = new Content(this._client);
7489
7610
  }
7490
7611
  /**
7491
- * Create Skill Version
7612
+ * Create a new immutable skill version.
7492
7613
  */
7493
7614
  create(skillID, body = {}, options) {
7494
7615
  return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
7495
7616
  }
7496
7617
  /**
7497
- * Get Skill Version
7618
+ * Get a specific skill version.
7498
7619
  */
7499
7620
  retrieve(version, params, options) {
7500
7621
  const { skill_id } = params;
7501
7622
  return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
7502
7623
  }
7503
7624
  /**
7504
- * List Skill Versions
7625
+ * List skill versions for a skill.
7505
7626
  */
7506
7627
  list(skillID, query = {}, options) {
7507
7628
  return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
@@ -7510,7 +7631,7 @@ class Versions extends APIResource {
7510
7631
  });
7511
7632
  }
7512
7633
  /**
7513
- * Delete Skill Version
7634
+ * Delete a skill version.
7514
7635
  */
7515
7636
  delete(version, params, options) {
7516
7637
  const { skill_id } = params;
@@ -7527,31 +7648,31 @@ class Skills extends APIResource {
7527
7648
  this.versions = new Versions(this._client);
7528
7649
  }
7529
7650
  /**
7530
- * Create Skill
7651
+ * Create a new skill.
7531
7652
  */
7532
7653
  create(body = {}, options) {
7533
7654
  return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
7534
7655
  }
7535
7656
  /**
7536
- * Get Skill
7657
+ * Get a skill by its ID.
7537
7658
  */
7538
7659
  retrieve(skillID, options) {
7539
7660
  return this._client.get(path `/skills/${skillID}`, options);
7540
7661
  }
7541
7662
  /**
7542
- * Update Skill Default Version
7663
+ * Update the default version pointer for a skill.
7543
7664
  */
7544
7665
  update(skillID, body, options) {
7545
7666
  return this._client.post(path `/skills/${skillID}`, { body, ...options });
7546
7667
  }
7547
7668
  /**
7548
- * List Skills
7669
+ * List all skills for the current project.
7549
7670
  */
7550
7671
  list(query = {}, options) {
7551
7672
  return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
7552
7673
  }
7553
7674
  /**
7554
- * Delete Skill
7675
+ * Delete a skill by its ID.
7555
7676
  */
7556
7677
  delete(skillID, options) {
7557
7678
  return this._client.delete(path `/skills/${skillID}`, options);
@@ -7561,6 +7682,9 @@ Skills.Content = Content$1;
7561
7682
  Skills.Versions = Versions;
7562
7683
 
7563
7684
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7685
+ /**
7686
+ * Use Uploads to upload large files in multiple parts.
7687
+ */
7564
7688
  class Parts extends APIResource {
7565
7689
  /**
7566
7690
  * Adds a
@@ -7581,6 +7705,9 @@ class Parts extends APIResource {
7581
7705
  }
7582
7706
 
7583
7707
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7708
+ /**
7709
+ * Use Uploads to upload large files in multiple parts.
7710
+ */
7584
7711
  class Uploads extends APIResource {
7585
7712
  constructor() {
7586
7713
  super(...arguments);
@@ -7606,12 +7733,16 @@ class Uploads extends APIResource {
7606
7733
  * For guidance on the proper filename extensions for each purpose, please follow
7607
7734
  * the documentation on
7608
7735
  * [creating a File](https://platform.openai.com/docs/api-reference/files/create).
7736
+ *
7737
+ * Returns the Upload object with status `pending`.
7609
7738
  */
7610
7739
  create(body, options) {
7611
7740
  return this._client.post('/uploads', { body, ...options });
7612
7741
  }
7613
7742
  /**
7614
7743
  * Cancels the Upload. No Parts may be added after an Upload is cancelled.
7744
+ *
7745
+ * Returns the Upload object with status `cancelled`.
7615
7746
  */
7616
7747
  cancel(uploadID, options) {
7617
7748
  return this._client.post(path `/uploads/${uploadID}/cancel`, options);
@@ -7629,7 +7760,9 @@ class Uploads extends APIResource {
7629
7760
  *
7630
7761
  * The number of bytes uploaded upon completion must match the number of bytes
7631
7762
  * initially specified when creating the Upload object. No Parts may be added after
7632
- * an Upload is completed.
7763
+ * an Upload is completed. Returns the Upload object with status `completed`,
7764
+ * including an additional `file` property containing the created usable File
7765
+ * object.
7633
7766
  */
7634
7767
  complete(uploadID, body, options) {
7635
7768
  return this._client.post(path `/uploads/${uploadID}/complete`, { body, ...options });
@@ -7989,31 +8122,33 @@ VectorStores.FileBatches = FileBatches;
7989
8122
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
7990
8123
  class Videos extends APIResource {
7991
8124
  /**
7992
- * Create a video
8125
+ * Create a new video generation job from a prompt and optional reference assets.
7993
8126
  */
7994
8127
  create(body, options) {
7995
8128
  return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
7996
8129
  }
7997
8130
  /**
7998
- * Retrieve a video
8131
+ * Fetch the latest metadata for a generated video.
7999
8132
  */
8000
8133
  retrieve(videoID, options) {
8001
8134
  return this._client.get(path `/videos/${videoID}`, options);
8002
8135
  }
8003
8136
  /**
8004
- * List videos
8137
+ * List recently generated videos for the current project.
8005
8138
  */
8006
8139
  list(query = {}, options) {
8007
8140
  return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
8008
8141
  }
8009
8142
  /**
8010
- * Delete a video
8143
+ * Permanently delete a completed or failed video and its stored assets.
8011
8144
  */
8012
8145
  delete(videoID, options) {
8013
8146
  return this._client.delete(path `/videos/${videoID}`, options);
8014
8147
  }
8015
8148
  /**
8016
- * Download video content
8149
+ * Download the generated video bytes or a derived preview asset.
8150
+ *
8151
+ * Streams the rendered video content for the specified video job.
8017
8152
  */
8018
8153
  downloadContent(videoID, query = {}, options) {
8019
8154
  return this._client.get(path `/videos/${videoID}/content`, {
@@ -8024,7 +8159,7 @@ class Videos extends APIResource {
8024
8159
  });
8025
8160
  }
8026
8161
  /**
8027
- * Create a video remix
8162
+ * Create a remix of a completed video using a refreshed prompt.
8028
8163
  */
8029
8164
  remix(videoID, body, options) {
8030
8165
  return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
@@ -8149,24 +8284,54 @@ class OpenAI {
8149
8284
  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 } = {}) {
8150
8285
  _OpenAI_instances.add(this);
8151
8286
  _OpenAI_encoder.set(this, void 0);
8287
+ /**
8288
+ * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
8289
+ */
8152
8290
  this.completions = new Completions(this);
8153
8291
  this.chat = new Chat(this);
8292
+ /**
8293
+ * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
8294
+ */
8154
8295
  this.embeddings = new Embeddings(this);
8296
+ /**
8297
+ * Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
8298
+ */
8155
8299
  this.files = new Files$1(this);
8300
+ /**
8301
+ * Given a prompt and/or an input image, the model will generate a new image.
8302
+ */
8156
8303
  this.images = new Images(this);
8157
8304
  this.audio = new Audio(this);
8305
+ /**
8306
+ * Given text and/or image inputs, classifies if those inputs are potentially harmful.
8307
+ */
8158
8308
  this.moderations = new Moderations(this);
8309
+ /**
8310
+ * List and describe the various models available in the API.
8311
+ */
8159
8312
  this.models = new Models(this);
8160
8313
  this.fineTuning = new FineTuning(this);
8161
8314
  this.graders = new Graders(this);
8162
8315
  this.vectorStores = new VectorStores(this);
8163
8316
  this.webhooks = new Webhooks(this);
8164
8317
  this.beta = new Beta(this);
8318
+ /**
8319
+ * Create large batches of API requests to run asynchronously.
8320
+ */
8165
8321
  this.batches = new Batches(this);
8322
+ /**
8323
+ * Use Uploads to upload large files in multiple parts.
8324
+ */
8166
8325
  this.uploads = new Uploads(this);
8167
8326
  this.responses = new Responses(this);
8168
8327
  this.realtime = new Realtime(this);
8328
+ /**
8329
+ * Manage conversations and conversation items.
8330
+ */
8169
8331
  this.conversations = new Conversations(this);
8332
+ /**
8333
+ * Manage and run evals in the OpenAI platform.
8334
+ */
8170
8335
  this.evals = new Evals(this);
8171
8336
  this.containers = new Containers(this);
8172
8337
  this.skills = new Skills(this);
@@ -8236,7 +8401,7 @@ class OpenAI {
8236
8401
  return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
8237
8402
  }
8238
8403
  stringifyQuery(query) {
8239
- return stringify(query, { arrayFormat: 'brackets' });
8404
+ return stringifyQuery(query);
8240
8405
  }
8241
8406
  getUserAgent() {
8242
8407
  return `${this.constructor.name}/JS ${VERSION}`;
@@ -8505,9 +8670,9 @@ class OpenAI {
8505
8670
  timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
8506
8671
  }
8507
8672
  }
8508
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
8509
- // just do what it says, but otherwise calculate a default
8510
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
8673
+ // If the API asks us to wait a certain amount of time, just do what it
8674
+ // says, but otherwise calculate a default
8675
+ if (timeoutMillis === undefined) {
8511
8676
  const maxRetries = options.maxRetries ?? this.maxRetries;
8512
8677
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
8513
8678
  }
@@ -8604,6 +8769,13 @@ class OpenAI {
8604
8769
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
8605
8770
  return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
8606
8771
  }
8772
+ else if (typeof body === 'object' &&
8773
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
8774
+ return {
8775
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
8776
+ body: this.stringifyQuery(body),
8777
+ };
8778
+ }
8607
8779
  else {
8608
8780
  return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
8609
8781
  }