@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-frontend.cjs +215 -43
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +215 -43
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +215 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +215 -43
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +215 -43
- package/dist/test.js.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1612,7 +1612,7 @@ const safeJSON = (text) => {
|
|
|
1612
1612
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1613
1613
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1614
1614
|
|
|
1615
|
-
const VERSION = '6.
|
|
1615
|
+
const VERSION = '6.27.0'; // x-release-please-version
|
|
1616
1616
|
|
|
1617
1617
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1618
1618
|
const isRunningInBrowser = () => {
|
|
@@ -2232,6 +2232,11 @@ function stringify(object, opts = {}) {
|
|
|
2232
2232
|
return joined.length > 0 ? prefix + joined : '';
|
|
2233
2233
|
}
|
|
2234
2234
|
|
|
2235
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2236
|
+
function stringifyQuery(query) {
|
|
2237
|
+
return stringify(query, { arrayFormat: 'brackets' });
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2235
2240
|
function concatBytes(buffers) {
|
|
2236
2241
|
let length = 0;
|
|
2237
2242
|
for (const buffer of buffers) {
|
|
@@ -2450,7 +2455,7 @@ class Stream {
|
|
|
2450
2455
|
this.controller = controller;
|
|
2451
2456
|
__classPrivateFieldSet(this, _Stream_client, client);
|
|
2452
2457
|
}
|
|
2453
|
-
static fromSSEResponse(response, controller, client) {
|
|
2458
|
+
static fromSSEResponse(response, controller, client, synthesizeEventData) {
|
|
2454
2459
|
let consumed = false;
|
|
2455
2460
|
const logger = client ? loggerFor(client) : console;
|
|
2456
2461
|
async function* iterator() {
|
|
@@ -2480,7 +2485,7 @@ class Stream {
|
|
|
2480
2485
|
if (data && data.error) {
|
|
2481
2486
|
throw new APIError(undefined, data.error, undefined, response.headers);
|
|
2482
2487
|
}
|
|
2483
|
-
yield data;
|
|
2488
|
+
yield synthesizeEventData ? { event: sse.event, data } : data;
|
|
2484
2489
|
}
|
|
2485
2490
|
else {
|
|
2486
2491
|
let data;
|
|
@@ -2730,9 +2735,9 @@ async function defaultParseResponse(client, props) {
|
|
|
2730
2735
|
// Note: there is an invariant here that isn't represented in the type system
|
|
2731
2736
|
// that if you set `stream: true` the response type must also be `Stream<T>`
|
|
2732
2737
|
if (props.options.__streamClass) {
|
|
2733
|
-
return props.options.__streamClass.fromSSEResponse(response, props.controller, client);
|
|
2738
|
+
return props.options.__streamClass.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
|
|
2734
2739
|
}
|
|
2735
|
-
return Stream.fromSSEResponse(response, props.controller, client);
|
|
2740
|
+
return Stream.fromSSEResponse(response, props.controller, client, props.options.__synthesizeEventData);
|
|
2736
2741
|
}
|
|
2737
2742
|
// fetch refuses to read the body when the status code is 204.
|
|
2738
2743
|
if (response.status === 204) {
|
|
@@ -3285,6 +3290,9 @@ const createPathTagFunction = (pathEncoder = encodeURIPath) => function path(sta
|
|
|
3285
3290
|
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
3286
3291
|
|
|
3287
3292
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3293
|
+
/**
|
|
3294
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
3295
|
+
*/
|
|
3288
3296
|
let Messages$1 = class Messages extends APIResource {
|
|
3289
3297
|
/**
|
|
3290
3298
|
* Get the messages in a stored chat completion. Only Chat Completions that have
|
|
@@ -4647,6 +4655,9 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
4647
4655
|
}
|
|
4648
4656
|
|
|
4649
4657
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4658
|
+
/**
|
|
4659
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4660
|
+
*/
|
|
4650
4661
|
let Completions$1 = class Completions extends APIResource {
|
|
4651
4662
|
constructor() {
|
|
4652
4663
|
super(...arguments);
|
|
@@ -4817,10 +4828,15 @@ const buildHeaders = (newHeaders) => {
|
|
|
4817
4828
|
};
|
|
4818
4829
|
|
|
4819
4830
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4831
|
+
/**
|
|
4832
|
+
* Turn audio into text or text into audio.
|
|
4833
|
+
*/
|
|
4820
4834
|
class Speech extends APIResource {
|
|
4821
4835
|
/**
|
|
4822
4836
|
* Generates audio from the input text.
|
|
4823
4837
|
*
|
|
4838
|
+
* Returns the audio file content, or a stream of audio events.
|
|
4839
|
+
*
|
|
4824
4840
|
* @example
|
|
4825
4841
|
* ```ts
|
|
4826
4842
|
* const speech = await client.audio.speech.create({
|
|
@@ -4844,6 +4860,9 @@ class Speech extends APIResource {
|
|
|
4844
4860
|
}
|
|
4845
4861
|
|
|
4846
4862
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4863
|
+
/**
|
|
4864
|
+
* Turn audio into text or text into audio.
|
|
4865
|
+
*/
|
|
4847
4866
|
class Transcriptions extends APIResource {
|
|
4848
4867
|
create(body, options) {
|
|
4849
4868
|
return this._client.post('/audio/transcriptions', multipartFormRequestOptions({
|
|
@@ -4856,6 +4875,9 @@ class Transcriptions extends APIResource {
|
|
|
4856
4875
|
}
|
|
4857
4876
|
|
|
4858
4877
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4878
|
+
/**
|
|
4879
|
+
* Turn audio into text or text into audio.
|
|
4880
|
+
*/
|
|
4859
4881
|
class Translations extends APIResource {
|
|
4860
4882
|
create(body, options) {
|
|
4861
4883
|
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
@@ -4876,6 +4898,9 @@ Audio.Translations = Translations;
|
|
|
4876
4898
|
Audio.Speech = Speech;
|
|
4877
4899
|
|
|
4878
4900
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4901
|
+
/**
|
|
4902
|
+
* Create large batches of API requests to run asynchronously.
|
|
4903
|
+
*/
|
|
4879
4904
|
class Batches extends APIResource {
|
|
4880
4905
|
/**
|
|
4881
4906
|
* Creates and executes a batch from an uploaded file of requests
|
|
@@ -4906,6 +4931,9 @@ class Batches extends APIResource {
|
|
|
4906
4931
|
}
|
|
4907
4932
|
|
|
4908
4933
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4934
|
+
/**
|
|
4935
|
+
* Build Assistants that can call models and use tools.
|
|
4936
|
+
*/
|
|
4909
4937
|
class Assistants extends APIResource {
|
|
4910
4938
|
/**
|
|
4911
4939
|
* Create an assistant with a model and instructions.
|
|
@@ -5036,7 +5064,7 @@ Realtime$1.TranscriptionSessions = TranscriptionSessions;
|
|
|
5036
5064
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5037
5065
|
class Sessions extends APIResource {
|
|
5038
5066
|
/**
|
|
5039
|
-
* Create a ChatKit session
|
|
5067
|
+
* Create a ChatKit session.
|
|
5040
5068
|
*
|
|
5041
5069
|
* @example
|
|
5042
5070
|
* ```ts
|
|
@@ -5055,7 +5083,9 @@ class Sessions extends APIResource {
|
|
|
5055
5083
|
});
|
|
5056
5084
|
}
|
|
5057
5085
|
/**
|
|
5058
|
-
* Cancel
|
|
5086
|
+
* Cancel an active ChatKit session and return its most recent metadata.
|
|
5087
|
+
*
|
|
5088
|
+
* Cancelling prevents new requests from using the issued client secret.
|
|
5059
5089
|
*
|
|
5060
5090
|
* @example
|
|
5061
5091
|
* ```ts
|
|
@@ -5074,7 +5104,7 @@ class Sessions extends APIResource {
|
|
|
5074
5104
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5075
5105
|
let Threads$1 = class Threads extends APIResource {
|
|
5076
5106
|
/**
|
|
5077
|
-
* Retrieve a ChatKit thread
|
|
5107
|
+
* Retrieve a ChatKit thread by its identifier.
|
|
5078
5108
|
*
|
|
5079
5109
|
* @example
|
|
5080
5110
|
* ```ts
|
|
@@ -5089,7 +5119,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5089
5119
|
});
|
|
5090
5120
|
}
|
|
5091
5121
|
/**
|
|
5092
|
-
* List ChatKit threads
|
|
5122
|
+
* List ChatKit threads with optional pagination and user filters.
|
|
5093
5123
|
*
|
|
5094
5124
|
* @example
|
|
5095
5125
|
* ```ts
|
|
@@ -5107,7 +5137,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5107
5137
|
});
|
|
5108
5138
|
}
|
|
5109
5139
|
/**
|
|
5110
|
-
* Delete a ChatKit thread
|
|
5140
|
+
* Delete a ChatKit thread along with its items and stored attachments.
|
|
5111
5141
|
*
|
|
5112
5142
|
* @example
|
|
5113
5143
|
* ```ts
|
|
@@ -5123,7 +5153,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5123
5153
|
});
|
|
5124
5154
|
}
|
|
5125
5155
|
/**
|
|
5126
|
-
* List ChatKit thread
|
|
5156
|
+
* List items that belong to a ChatKit thread.
|
|
5127
5157
|
*
|
|
5128
5158
|
* @example
|
|
5129
5159
|
* ```ts
|
|
@@ -5153,6 +5183,8 @@ ChatKit.Threads = Threads$1;
|
|
|
5153
5183
|
|
|
5154
5184
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5155
5185
|
/**
|
|
5186
|
+
* Build Assistants that can call models and use tools.
|
|
5187
|
+
*
|
|
5156
5188
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
5157
5189
|
*/
|
|
5158
5190
|
class Messages extends APIResource {
|
|
@@ -5221,6 +5253,8 @@ class Messages extends APIResource {
|
|
|
5221
5253
|
|
|
5222
5254
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5223
5255
|
/**
|
|
5256
|
+
* Build Assistants that can call models and use tools.
|
|
5257
|
+
*
|
|
5224
5258
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
5225
5259
|
*/
|
|
5226
5260
|
class Steps extends APIResource {
|
|
@@ -5833,6 +5867,8 @@ _a$1 = AssistantStream, _AssistantStream_addEvent = function _AssistantStream_ad
|
|
|
5833
5867
|
|
|
5834
5868
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5835
5869
|
/**
|
|
5870
|
+
* Build Assistants that can call models and use tools.
|
|
5871
|
+
*
|
|
5836
5872
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
5837
5873
|
*/
|
|
5838
5874
|
let Runs$1 = class Runs extends APIResource {
|
|
@@ -5848,6 +5884,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5848
5884
|
...options,
|
|
5849
5885
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5850
5886
|
stream: params.stream ?? false,
|
|
5887
|
+
__synthesizeEventData: true,
|
|
5851
5888
|
});
|
|
5852
5889
|
}
|
|
5853
5890
|
/**
|
|
@@ -5978,6 +6015,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
5978
6015
|
...options,
|
|
5979
6016
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5980
6017
|
stream: params.stream ?? false,
|
|
6018
|
+
__synthesizeEventData: true,
|
|
5981
6019
|
});
|
|
5982
6020
|
}
|
|
5983
6021
|
/**
|
|
@@ -6002,6 +6040,8 @@ Runs$1.Steps = Steps;
|
|
|
6002
6040
|
|
|
6003
6041
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6004
6042
|
/**
|
|
6043
|
+
* Build Assistants that can call models and use tools.
|
|
6044
|
+
*
|
|
6005
6045
|
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
6006
6046
|
*/
|
|
6007
6047
|
class Threads extends APIResource {
|
|
@@ -6062,6 +6102,7 @@ class Threads extends APIResource {
|
|
|
6062
6102
|
...options,
|
|
6063
6103
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6064
6104
|
stream: body.stream ?? false,
|
|
6105
|
+
__synthesizeEventData: true,
|
|
6065
6106
|
});
|
|
6066
6107
|
}
|
|
6067
6108
|
/**
|
|
@@ -6099,6 +6140,9 @@ Beta.Assistants = Assistants;
|
|
|
6099
6140
|
Beta.Threads = Threads;
|
|
6100
6141
|
|
|
6101
6142
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6143
|
+
/**
|
|
6144
|
+
* Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
|
|
6145
|
+
*/
|
|
6102
6146
|
class Completions extends APIResource {
|
|
6103
6147
|
create(body, options) {
|
|
6104
6148
|
return this._client.post('/completions', { body, ...options, stream: body.stream ?? false });
|
|
@@ -6201,6 +6245,9 @@ class Containers extends APIResource {
|
|
|
6201
6245
|
Containers.Files = Files$2;
|
|
6202
6246
|
|
|
6203
6247
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6248
|
+
/**
|
|
6249
|
+
* Manage conversations and conversation items.
|
|
6250
|
+
*/
|
|
6204
6251
|
class Items extends APIResource {
|
|
6205
6252
|
/**
|
|
6206
6253
|
* Create items in a conversation with the given ID.
|
|
@@ -6236,6 +6283,9 @@ class Items extends APIResource {
|
|
|
6236
6283
|
}
|
|
6237
6284
|
|
|
6238
6285
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6286
|
+
/**
|
|
6287
|
+
* Manage conversations and conversation items.
|
|
6288
|
+
*/
|
|
6239
6289
|
class Conversations extends APIResource {
|
|
6240
6290
|
constructor() {
|
|
6241
6291
|
super(...arguments);
|
|
@@ -6269,6 +6319,9 @@ class Conversations extends APIResource {
|
|
|
6269
6319
|
Conversations.Items = Items;
|
|
6270
6320
|
|
|
6271
6321
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6322
|
+
/**
|
|
6323
|
+
* Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
|
6324
|
+
*/
|
|
6272
6325
|
class Embeddings extends APIResource {
|
|
6273
6326
|
/**
|
|
6274
6327
|
* Creates an embedding vector representing the input text.
|
|
@@ -6319,6 +6372,9 @@ class Embeddings extends APIResource {
|
|
|
6319
6372
|
}
|
|
6320
6373
|
|
|
6321
6374
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6375
|
+
/**
|
|
6376
|
+
* Manage and run evals in the OpenAI platform.
|
|
6377
|
+
*/
|
|
6322
6378
|
class OutputItems extends APIResource {
|
|
6323
6379
|
/**
|
|
6324
6380
|
* Get an evaluation run output item by ID.
|
|
@@ -6337,6 +6393,9 @@ class OutputItems extends APIResource {
|
|
|
6337
6393
|
}
|
|
6338
6394
|
|
|
6339
6395
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6396
|
+
/**
|
|
6397
|
+
* Manage and run evals in the OpenAI platform.
|
|
6398
|
+
*/
|
|
6340
6399
|
class Runs extends APIResource {
|
|
6341
6400
|
constructor() {
|
|
6342
6401
|
super(...arguments);
|
|
@@ -6384,6 +6443,9 @@ class Runs extends APIResource {
|
|
|
6384
6443
|
Runs.OutputItems = OutputItems;
|
|
6385
6444
|
|
|
6386
6445
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6446
|
+
/**
|
|
6447
|
+
* Manage and run evals in the OpenAI platform.
|
|
6448
|
+
*/
|
|
6387
6449
|
class Evals extends APIResource {
|
|
6388
6450
|
constructor() {
|
|
6389
6451
|
super(...arguments);
|
|
@@ -6428,6 +6490,9 @@ class Evals extends APIResource {
|
|
|
6428
6490
|
Evals.Runs = Runs;
|
|
6429
6491
|
|
|
6430
6492
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6493
|
+
/**
|
|
6494
|
+
* Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
|
|
6495
|
+
*/
|
|
6431
6496
|
let Files$1 = class Files extends APIResource {
|
|
6432
6497
|
/**
|
|
6433
6498
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
@@ -6507,6 +6572,9 @@ class Methods extends APIResource {
|
|
|
6507
6572
|
}
|
|
6508
6573
|
|
|
6509
6574
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6575
|
+
/**
|
|
6576
|
+
* Manage fine-tuning jobs to tailor a model to your specific training data.
|
|
6577
|
+
*/
|
|
6510
6578
|
let Graders$1 = class Graders extends APIResource {
|
|
6511
6579
|
/**
|
|
6512
6580
|
* Run a grader.
|
|
@@ -6560,6 +6628,9 @@ class Alpha extends APIResource {
|
|
|
6560
6628
|
Alpha.Graders = Graders$1;
|
|
6561
6629
|
|
|
6562
6630
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6631
|
+
/**
|
|
6632
|
+
* Manage fine-tuning jobs to tailor a model to your specific training data.
|
|
6633
|
+
*/
|
|
6563
6634
|
class Permissions extends APIResource {
|
|
6564
6635
|
/**
|
|
6565
6636
|
* **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6587,13 +6658,7 @@ class Permissions extends APIResource {
|
|
|
6587
6658
|
* Organization owners can use this endpoint to view all permissions for a
|
|
6588
6659
|
* fine-tuned model checkpoint.
|
|
6589
6660
|
*
|
|
6590
|
-
* @
|
|
6591
|
-
* ```ts
|
|
6592
|
-
* const permission =
|
|
6593
|
-
* await client.fineTuning.checkpoints.permissions.retrieve(
|
|
6594
|
-
* 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
|
|
6595
|
-
* );
|
|
6596
|
-
* ```
|
|
6661
|
+
* @deprecated Retrieve is deprecated. Please swap to the paginated list method instead.
|
|
6597
6662
|
*/
|
|
6598
6663
|
retrieve(fineTunedModelCheckpoint, query = {}, options) {
|
|
6599
6664
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
@@ -6601,6 +6666,25 @@ class Permissions extends APIResource {
|
|
|
6601
6666
|
...options,
|
|
6602
6667
|
});
|
|
6603
6668
|
}
|
|
6669
|
+
/**
|
|
6670
|
+
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
6671
|
+
*
|
|
6672
|
+
* Organization owners can use this endpoint to view all permissions for a
|
|
6673
|
+
* fine-tuned model checkpoint.
|
|
6674
|
+
*
|
|
6675
|
+
* @example
|
|
6676
|
+
* ```ts
|
|
6677
|
+
* // Automatically fetches more pages as needed.
|
|
6678
|
+
* for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list(
|
|
6679
|
+
* 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
|
|
6680
|
+
* )) {
|
|
6681
|
+
* // ...
|
|
6682
|
+
* }
|
|
6683
|
+
* ```
|
|
6684
|
+
*/
|
|
6685
|
+
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
6686
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
|
|
6687
|
+
}
|
|
6604
6688
|
/**
|
|
6605
6689
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
6606
6690
|
*
|
|
@@ -6635,6 +6719,9 @@ let Checkpoints$1 = class Checkpoints extends APIResource {
|
|
|
6635
6719
|
Checkpoints$1.Permissions = Permissions;
|
|
6636
6720
|
|
|
6637
6721
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6722
|
+
/**
|
|
6723
|
+
* Manage fine-tuning jobs to tailor a model to your specific training data.
|
|
6724
|
+
*/
|
|
6638
6725
|
class Checkpoints extends APIResource {
|
|
6639
6726
|
/**
|
|
6640
6727
|
* List checkpoints for a fine-tuning job.
|
|
@@ -6655,6 +6742,9 @@ class Checkpoints extends APIResource {
|
|
|
6655
6742
|
}
|
|
6656
6743
|
|
|
6657
6744
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6745
|
+
/**
|
|
6746
|
+
* Manage fine-tuning jobs to tailor a model to your specific training data.
|
|
6747
|
+
*/
|
|
6658
6748
|
class Jobs extends APIResource {
|
|
6659
6749
|
constructor() {
|
|
6660
6750
|
super(...arguments);
|
|
@@ -6796,6 +6886,9 @@ class Graders extends APIResource {
|
|
|
6796
6886
|
Graders.GraderModels = GraderModels;
|
|
6797
6887
|
|
|
6798
6888
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6889
|
+
/**
|
|
6890
|
+
* Given a prompt and/or an input image, the model will generate a new image.
|
|
6891
|
+
*/
|
|
6799
6892
|
class Images extends APIResource {
|
|
6800
6893
|
/**
|
|
6801
6894
|
* Creates a variation of a given image. This endpoint only supports `dall-e-2`.
|
|
@@ -6819,6 +6912,9 @@ class Images extends APIResource {
|
|
|
6819
6912
|
}
|
|
6820
6913
|
|
|
6821
6914
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6915
|
+
/**
|
|
6916
|
+
* List and describe the various models available in the API.
|
|
6917
|
+
*/
|
|
6822
6918
|
class Models extends APIResource {
|
|
6823
6919
|
/**
|
|
6824
6920
|
* Retrieves a model instance, providing basic information about the model such as
|
|
@@ -6844,6 +6940,9 @@ class Models extends APIResource {
|
|
|
6844
6940
|
}
|
|
6845
6941
|
|
|
6846
6942
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6943
|
+
/**
|
|
6944
|
+
* Given text and/or image inputs, classifies if those inputs are potentially harmful.
|
|
6945
|
+
*/
|
|
6847
6946
|
class Moderations extends APIResource {
|
|
6848
6947
|
/**
|
|
6849
6948
|
* Classifies if text and/or image inputs are potentially harmful. Learn more in
|
|
@@ -6927,6 +7026,20 @@ class ClientSecrets extends APIResource {
|
|
|
6927
7026
|
/**
|
|
6928
7027
|
* Create a Realtime client secret with an associated session configuration.
|
|
6929
7028
|
*
|
|
7029
|
+
* Client secrets are short-lived tokens that can be passed to a client app, such
|
|
7030
|
+
* as a web frontend or mobile client, which grants access to the Realtime API
|
|
7031
|
+
* without leaking your main API key. You can configure a custom TTL for each
|
|
7032
|
+
* client secret.
|
|
7033
|
+
*
|
|
7034
|
+
* You can also attach session configuration options to the client secret, which
|
|
7035
|
+
* will be applied to any sessions created using that client secret, but these can
|
|
7036
|
+
* also be overridden by the client connection.
|
|
7037
|
+
*
|
|
7038
|
+
* [Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
|
|
7039
|
+
*
|
|
7040
|
+
* Returns the created client secret and the effective session object. The client
|
|
7041
|
+
* secret is a string that looks like `ek_1234`.
|
|
7042
|
+
*
|
|
6930
7043
|
* @example
|
|
6931
7044
|
* ```ts
|
|
6932
7045
|
* const clientSecret =
|
|
@@ -7352,7 +7465,10 @@ class InputItems extends APIResource {
|
|
|
7352
7465
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7353
7466
|
class InputTokens extends APIResource {
|
|
7354
7467
|
/**
|
|
7355
|
-
*
|
|
7468
|
+
* Returns input token counts of the request.
|
|
7469
|
+
*
|
|
7470
|
+
* Returns an object with `object` set to `response.input_tokens` and an
|
|
7471
|
+
* `input_tokens` count.
|
|
7356
7472
|
*
|
|
7357
7473
|
* @example
|
|
7358
7474
|
* ```ts
|
|
@@ -7434,12 +7550,17 @@ class Responses extends APIResource {
|
|
|
7434
7550
|
return this._client.post(path `/responses/${responseID}/cancel`, options);
|
|
7435
7551
|
}
|
|
7436
7552
|
/**
|
|
7437
|
-
* Compact conversation
|
|
7553
|
+
* Compact a conversation. Returns a compacted response object.
|
|
7554
|
+
*
|
|
7555
|
+
* Learn when and how to compact long-running conversations in the
|
|
7556
|
+
* [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
|
|
7557
|
+
* For ZDR-compatible compaction details, see
|
|
7558
|
+
* [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
|
|
7438
7559
|
*
|
|
7439
7560
|
* @example
|
|
7440
7561
|
* ```ts
|
|
7441
7562
|
* const compactedResponse = await client.responses.compact({
|
|
7442
|
-
* model: 'gpt-5.
|
|
7563
|
+
* model: 'gpt-5.4',
|
|
7443
7564
|
* });
|
|
7444
7565
|
* ```
|
|
7445
7566
|
*/
|
|
@@ -7453,7 +7574,7 @@ Responses.InputTokens = InputTokens;
|
|
|
7453
7574
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7454
7575
|
let Content$1 = class Content extends APIResource {
|
|
7455
7576
|
/**
|
|
7456
|
-
*
|
|
7577
|
+
* Download a skill zip bundle by its ID.
|
|
7457
7578
|
*/
|
|
7458
7579
|
retrieve(skillID, options) {
|
|
7459
7580
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
@@ -7467,7 +7588,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
7467
7588
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7468
7589
|
class Content extends APIResource {
|
|
7469
7590
|
/**
|
|
7470
|
-
*
|
|
7591
|
+
* Download a skill version zip bundle.
|
|
7471
7592
|
*/
|
|
7472
7593
|
retrieve(version, params, options) {
|
|
7473
7594
|
const { skill_id } = params;
|
|
@@ -7486,20 +7607,20 @@ class Versions extends APIResource {
|
|
|
7486
7607
|
this.content = new Content(this._client);
|
|
7487
7608
|
}
|
|
7488
7609
|
/**
|
|
7489
|
-
* Create
|
|
7610
|
+
* Create a new immutable skill version.
|
|
7490
7611
|
*/
|
|
7491
7612
|
create(skillID, body = {}, options) {
|
|
7492
7613
|
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
7493
7614
|
}
|
|
7494
7615
|
/**
|
|
7495
|
-
* Get
|
|
7616
|
+
* Get a specific skill version.
|
|
7496
7617
|
*/
|
|
7497
7618
|
retrieve(version, params, options) {
|
|
7498
7619
|
const { skill_id } = params;
|
|
7499
7620
|
return this._client.get(path `/skills/${skill_id}/versions/${version}`, options);
|
|
7500
7621
|
}
|
|
7501
7622
|
/**
|
|
7502
|
-
* List
|
|
7623
|
+
* List skill versions for a skill.
|
|
7503
7624
|
*/
|
|
7504
7625
|
list(skillID, query = {}, options) {
|
|
7505
7626
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
@@ -7508,7 +7629,7 @@ class Versions extends APIResource {
|
|
|
7508
7629
|
});
|
|
7509
7630
|
}
|
|
7510
7631
|
/**
|
|
7511
|
-
* Delete
|
|
7632
|
+
* Delete a skill version.
|
|
7512
7633
|
*/
|
|
7513
7634
|
delete(version, params, options) {
|
|
7514
7635
|
const { skill_id } = params;
|
|
@@ -7525,31 +7646,31 @@ class Skills extends APIResource {
|
|
|
7525
7646
|
this.versions = new Versions(this._client);
|
|
7526
7647
|
}
|
|
7527
7648
|
/**
|
|
7528
|
-
* Create
|
|
7649
|
+
* Create a new skill.
|
|
7529
7650
|
*/
|
|
7530
7651
|
create(body = {}, options) {
|
|
7531
7652
|
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
7532
7653
|
}
|
|
7533
7654
|
/**
|
|
7534
|
-
* Get
|
|
7655
|
+
* Get a skill by its ID.
|
|
7535
7656
|
*/
|
|
7536
7657
|
retrieve(skillID, options) {
|
|
7537
7658
|
return this._client.get(path `/skills/${skillID}`, options);
|
|
7538
7659
|
}
|
|
7539
7660
|
/**
|
|
7540
|
-
* Update
|
|
7661
|
+
* Update the default version pointer for a skill.
|
|
7541
7662
|
*/
|
|
7542
7663
|
update(skillID, body, options) {
|
|
7543
7664
|
return this._client.post(path `/skills/${skillID}`, { body, ...options });
|
|
7544
7665
|
}
|
|
7545
7666
|
/**
|
|
7546
|
-
* List
|
|
7667
|
+
* List all skills for the current project.
|
|
7547
7668
|
*/
|
|
7548
7669
|
list(query = {}, options) {
|
|
7549
7670
|
return this._client.getAPIList('/skills', (CursorPage), { query, ...options });
|
|
7550
7671
|
}
|
|
7551
7672
|
/**
|
|
7552
|
-
* Delete
|
|
7673
|
+
* Delete a skill by its ID.
|
|
7553
7674
|
*/
|
|
7554
7675
|
delete(skillID, options) {
|
|
7555
7676
|
return this._client.delete(path `/skills/${skillID}`, options);
|
|
@@ -7559,6 +7680,9 @@ Skills.Content = Content$1;
|
|
|
7559
7680
|
Skills.Versions = Versions;
|
|
7560
7681
|
|
|
7561
7682
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7683
|
+
/**
|
|
7684
|
+
* Use Uploads to upload large files in multiple parts.
|
|
7685
|
+
*/
|
|
7562
7686
|
class Parts extends APIResource {
|
|
7563
7687
|
/**
|
|
7564
7688
|
* Adds a
|
|
@@ -7579,6 +7703,9 @@ class Parts extends APIResource {
|
|
|
7579
7703
|
}
|
|
7580
7704
|
|
|
7581
7705
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7706
|
+
/**
|
|
7707
|
+
* Use Uploads to upload large files in multiple parts.
|
|
7708
|
+
*/
|
|
7582
7709
|
class Uploads extends APIResource {
|
|
7583
7710
|
constructor() {
|
|
7584
7711
|
super(...arguments);
|
|
@@ -7604,12 +7731,16 @@ class Uploads extends APIResource {
|
|
|
7604
7731
|
* For guidance on the proper filename extensions for each purpose, please follow
|
|
7605
7732
|
* the documentation on
|
|
7606
7733
|
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
|
|
7734
|
+
*
|
|
7735
|
+
* Returns the Upload object with status `pending`.
|
|
7607
7736
|
*/
|
|
7608
7737
|
create(body, options) {
|
|
7609
7738
|
return this._client.post('/uploads', { body, ...options });
|
|
7610
7739
|
}
|
|
7611
7740
|
/**
|
|
7612
7741
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
7742
|
+
*
|
|
7743
|
+
* Returns the Upload object with status `cancelled`.
|
|
7613
7744
|
*/
|
|
7614
7745
|
cancel(uploadID, options) {
|
|
7615
7746
|
return this._client.post(path `/uploads/${uploadID}/cancel`, options);
|
|
@@ -7627,7 +7758,9 @@ class Uploads extends APIResource {
|
|
|
7627
7758
|
*
|
|
7628
7759
|
* The number of bytes uploaded upon completion must match the number of bytes
|
|
7629
7760
|
* initially specified when creating the Upload object. No Parts may be added after
|
|
7630
|
-
* an Upload is completed.
|
|
7761
|
+
* an Upload is completed. Returns the Upload object with status `completed`,
|
|
7762
|
+
* including an additional `file` property containing the created usable File
|
|
7763
|
+
* object.
|
|
7631
7764
|
*/
|
|
7632
7765
|
complete(uploadID, body, options) {
|
|
7633
7766
|
return this._client.post(path `/uploads/${uploadID}/complete`, { body, ...options });
|
|
@@ -7987,31 +8120,33 @@ VectorStores.FileBatches = FileBatches;
|
|
|
7987
8120
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
7988
8121
|
class Videos extends APIResource {
|
|
7989
8122
|
/**
|
|
7990
|
-
* Create a video
|
|
8123
|
+
* Create a new video generation job from a prompt and optional reference assets.
|
|
7991
8124
|
*/
|
|
7992
8125
|
create(body, options) {
|
|
7993
8126
|
return this._client.post('/videos', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
7994
8127
|
}
|
|
7995
8128
|
/**
|
|
7996
|
-
*
|
|
8129
|
+
* Fetch the latest metadata for a generated video.
|
|
7997
8130
|
*/
|
|
7998
8131
|
retrieve(videoID, options) {
|
|
7999
8132
|
return this._client.get(path `/videos/${videoID}`, options);
|
|
8000
8133
|
}
|
|
8001
8134
|
/**
|
|
8002
|
-
* List videos
|
|
8135
|
+
* List recently generated videos for the current project.
|
|
8003
8136
|
*/
|
|
8004
8137
|
list(query = {}, options) {
|
|
8005
8138
|
return this._client.getAPIList('/videos', (ConversationCursorPage), { query, ...options });
|
|
8006
8139
|
}
|
|
8007
8140
|
/**
|
|
8008
|
-
*
|
|
8141
|
+
* Permanently delete a completed or failed video and its stored assets.
|
|
8009
8142
|
*/
|
|
8010
8143
|
delete(videoID, options) {
|
|
8011
8144
|
return this._client.delete(path `/videos/${videoID}`, options);
|
|
8012
8145
|
}
|
|
8013
8146
|
/**
|
|
8014
|
-
* Download video
|
|
8147
|
+
* Download the generated video bytes or a derived preview asset.
|
|
8148
|
+
*
|
|
8149
|
+
* Streams the rendered video content for the specified video job.
|
|
8015
8150
|
*/
|
|
8016
8151
|
downloadContent(videoID, query = {}, options) {
|
|
8017
8152
|
return this._client.get(path `/videos/${videoID}/content`, {
|
|
@@ -8022,7 +8157,7 @@ class Videos extends APIResource {
|
|
|
8022
8157
|
});
|
|
8023
8158
|
}
|
|
8024
8159
|
/**
|
|
8025
|
-
* Create a video
|
|
8160
|
+
* Create a remix of a completed video using a refreshed prompt.
|
|
8026
8161
|
*/
|
|
8027
8162
|
remix(videoID, body, options) {
|
|
8028
8163
|
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
@@ -8147,24 +8282,54 @@ class OpenAI {
|
|
|
8147
8282
|
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 } = {}) {
|
|
8148
8283
|
_OpenAI_instances.add(this);
|
|
8149
8284
|
_OpenAI_encoder.set(this, void 0);
|
|
8285
|
+
/**
|
|
8286
|
+
* Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
|
|
8287
|
+
*/
|
|
8150
8288
|
this.completions = new Completions(this);
|
|
8151
8289
|
this.chat = new Chat(this);
|
|
8290
|
+
/**
|
|
8291
|
+
* Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
|
8292
|
+
*/
|
|
8152
8293
|
this.embeddings = new Embeddings(this);
|
|
8294
|
+
/**
|
|
8295
|
+
* Files are used to upload documents that can be used with features like Assistants and Fine-tuning.
|
|
8296
|
+
*/
|
|
8153
8297
|
this.files = new Files$1(this);
|
|
8298
|
+
/**
|
|
8299
|
+
* Given a prompt and/or an input image, the model will generate a new image.
|
|
8300
|
+
*/
|
|
8154
8301
|
this.images = new Images(this);
|
|
8155
8302
|
this.audio = new Audio(this);
|
|
8303
|
+
/**
|
|
8304
|
+
* Given text and/or image inputs, classifies if those inputs are potentially harmful.
|
|
8305
|
+
*/
|
|
8156
8306
|
this.moderations = new Moderations(this);
|
|
8307
|
+
/**
|
|
8308
|
+
* List and describe the various models available in the API.
|
|
8309
|
+
*/
|
|
8157
8310
|
this.models = new Models(this);
|
|
8158
8311
|
this.fineTuning = new FineTuning(this);
|
|
8159
8312
|
this.graders = new Graders(this);
|
|
8160
8313
|
this.vectorStores = new VectorStores(this);
|
|
8161
8314
|
this.webhooks = new Webhooks(this);
|
|
8162
8315
|
this.beta = new Beta(this);
|
|
8316
|
+
/**
|
|
8317
|
+
* Create large batches of API requests to run asynchronously.
|
|
8318
|
+
*/
|
|
8163
8319
|
this.batches = new Batches(this);
|
|
8320
|
+
/**
|
|
8321
|
+
* Use Uploads to upload large files in multiple parts.
|
|
8322
|
+
*/
|
|
8164
8323
|
this.uploads = new Uploads(this);
|
|
8165
8324
|
this.responses = new Responses(this);
|
|
8166
8325
|
this.realtime = new Realtime(this);
|
|
8326
|
+
/**
|
|
8327
|
+
* Manage conversations and conversation items.
|
|
8328
|
+
*/
|
|
8167
8329
|
this.conversations = new Conversations(this);
|
|
8330
|
+
/**
|
|
8331
|
+
* Manage and run evals in the OpenAI platform.
|
|
8332
|
+
*/
|
|
8168
8333
|
this.evals = new Evals(this);
|
|
8169
8334
|
this.containers = new Containers(this);
|
|
8170
8335
|
this.skills = new Skills(this);
|
|
@@ -8234,7 +8399,7 @@ class OpenAI {
|
|
|
8234
8399
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
8235
8400
|
}
|
|
8236
8401
|
stringifyQuery(query) {
|
|
8237
|
-
return
|
|
8402
|
+
return stringifyQuery(query);
|
|
8238
8403
|
}
|
|
8239
8404
|
getUserAgent() {
|
|
8240
8405
|
return `${this.constructor.name}/JS ${VERSION}`;
|
|
@@ -8503,9 +8668,9 @@ class OpenAI {
|
|
|
8503
8668
|
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
8504
8669
|
}
|
|
8505
8670
|
}
|
|
8506
|
-
// If the API asks us to wait a certain amount of time
|
|
8507
|
-
//
|
|
8508
|
-
if (
|
|
8671
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
8672
|
+
// says, but otherwise calculate a default
|
|
8673
|
+
if (timeoutMillis === undefined) {
|
|
8509
8674
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
8510
8675
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
8511
8676
|
}
|
|
@@ -8602,6 +8767,13 @@ class OpenAI {
|
|
|
8602
8767
|
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
|
|
8603
8768
|
return { bodyHeaders: undefined, body: ReadableStreamFrom(body) };
|
|
8604
8769
|
}
|
|
8770
|
+
else if (typeof body === 'object' &&
|
|
8771
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded') {
|
|
8772
|
+
return {
|
|
8773
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
8774
|
+
body: this.stringifyQuery(body),
|
|
8775
|
+
};
|
|
8776
|
+
}
|
|
8605
8777
|
else {
|
|
8606
8778
|
return __classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers });
|
|
8607
8779
|
}
|