openai 4.4.0 → 4.6.0
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/CHANGELOG.md +36 -0
- package/README.md +6 -2
- package/_shims/{ReadableStream.node.d.ts → ReadableStream-node.d.ts} +1 -1
- package/_shims/ReadableStream-node.d.ts.map +1 -0
- package/_shims/{ReadableStream.node.js → ReadableStream-node.js} +1 -1
- package/_shims/ReadableStream-node.js.map +1 -0
- package/_shims/{ReadableStream.node.mjs → ReadableStream-node.mjs} +1 -1
- package/_shims/ReadableStream-node.mjs.map +1 -0
- package/_shims/{agent.node.d.ts → agent-node.d.ts} +1 -1
- package/_shims/agent-node.d.ts.map +1 -0
- package/_shims/{agent.node.js → agent-node.js} +1 -1
- package/_shims/{agent.node.js.map → agent-node.js.map} +1 -1
- package/_shims/{agent.node.mjs → agent-node.mjs} +1 -1
- package/_shims/{agent.node.mjs.map → agent-node.mjs.map} +1 -1
- package/_shims/agent.d.ts +1 -1
- package/_shims/agent.js +1 -1
- package/_shims/agent.mjs +1 -1
- package/_shims/{fileFromPath.node.d.ts → fileFromPath-node.d.ts} +2 -2
- package/_shims/{fileFromPath.node.d.ts.map → fileFromPath-node.d.ts.map} +1 -1
- package/_shims/{fileFromPath.node.js → fileFromPath-node.js} +1 -1
- package/_shims/{fileFromPath.node.js.map → fileFromPath-node.js.map} +1 -1
- package/_shims/{fileFromPath.node.mjs → fileFromPath-node.mjs} +1 -1
- package/_shims/{fileFromPath.node.mjs.map → fileFromPath-node.mjs.map} +1 -1
- package/_shims/fileFromPath.d.ts +2 -2
- package/_shims/fileFromPath.d.ts.map +1 -1
- package/_shims/fileFromPath.js +1 -1
- package/_shims/fileFromPath.mjs +1 -1
- package/_shims/{getMultipartRequestOptions.node.d.ts → getMultipartRequestOptions-node.d.ts} +2 -2
- package/_shims/getMultipartRequestOptions-node.d.ts.map +1 -0
- package/_shims/{getMultipartRequestOptions.node.js → getMultipartRequestOptions-node.js} +1 -1
- package/_shims/{getMultipartRequestOptions.node.js.map → getMultipartRequestOptions-node.js.map} +1 -1
- package/_shims/{getMultipartRequestOptions.node.mjs → getMultipartRequestOptions-node.mjs} +1 -1
- package/_shims/{getMultipartRequestOptions.node.mjs.map → getMultipartRequestOptions-node.mjs.map} +1 -1
- package/_shims/getMultipartRequestOptions.d.ts +1 -1
- package/_shims/getMultipartRequestOptions.d.ts.map +1 -1
- package/_shims/{node-readable.node.d.ts → node-readable-node.d.ts} +1 -1
- package/_shims/{node-readable.node.d.ts.map → node-readable-node.d.ts.map} +1 -1
- package/_shims/{node-readable.node.js → node-readable-node.js} +1 -1
- package/_shims/node-readable-node.js.map +1 -0
- package/_shims/{node-readable.node.mjs → node-readable-node.mjs} +1 -1
- package/_shims/node-readable-node.mjs.map +1 -0
- package/core.d.ts +2 -1
- package/core.d.ts.map +1 -1
- package/core.js +3 -1
- package/core.js.map +1 -1
- package/core.mjs +1 -1
- package/core.mjs.map +1 -1
- package/error.d.ts +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +2 -2
- package/error.js.map +1 -1
- package/error.mjs +2 -2
- package/error.mjs.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/index.mjs +3 -3
- package/index.mjs.map +1 -1
- package/package.json +4 -4
- package/resources/chat/chat.d.ts +1 -0
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.ts +12 -7
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/chat/index.d.ts +1 -0
- package/resources/chat/index.d.ts.map +1 -1
- package/resources/chat/index.js.map +1 -1
- package/resources/chat/index.mjs.map +1 -1
- package/resources/completions.d.ts +3 -3
- package/resources/edits.d.ts +1 -1
- package/resources/files.d.ts +14 -1
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +21 -1
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +20 -0
- package/resources/files.mjs.map +1 -1
- package/resources/fine-tunes.d.ts +2 -2
- package/resources/fine-tuning/jobs.d.ts +3 -3
- package/resources/fine-tuning/jobs.d.ts.map +1 -1
- package/resources/models.d.ts +3 -2
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +2 -1
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +2 -1
- package/resources/models.mjs.map +1 -1
- package/src/_shims/ReadableStream.d.ts +5 -5
- package/src/_shims/agent.ts +1 -1
- package/src/_shims/{fetch.node.d.ts → fetch-node.d.ts} +8 -8
- package/src/_shims/fetch.d.ts +10 -10
- package/src/_shims/{fileFromPath.node.ts → fileFromPath-node.ts} +1 -1
- package/src/_shims/fileFromPath.ts +2 -2
- package/src/_shims/{formdata.node.d.ts → form-data-node.d.ts} +4 -4
- package/src/_shims/{formdata.d.ts → form-data.d.ts} +4 -4
- package/src/_shims/{getMultipartRequestOptions.node.ts → getMultipartRequestOptions-node.ts} +3 -3
- package/src/_shims/getMultipartRequestOptions.ts +3 -3
- package/src/core.ts +12 -11
- package/src/error.ts +3 -3
- package/src/index.ts +7 -7
- package/src/pagination.ts +1 -1
- package/src/resource.ts +1 -1
- package/src/resources/audio/audio.ts +4 -4
- package/src/resources/audio/index.ts +3 -3
- package/src/resources/audio/transcriptions.ts +4 -4
- package/src/resources/audio/translations.ts +4 -4
- package/src/resources/chat/chat.ts +4 -3
- package/src/resources/chat/completions.ts +19 -13
- package/src/resources/chat/index.ts +3 -2
- package/src/resources/completions.ts +8 -8
- package/src/resources/edits.ts +5 -5
- package/src/resources/embeddings.ts +3 -3
- package/src/resources/files.ts +34 -6
- package/src/resources/fine-tunes.ts +9 -9
- package/src/resources/fine-tuning/fine-tuning.ts +3 -3
- package/src/resources/fine-tuning/index.ts +2 -2
- package/src/resources/fine-tuning/jobs.ts +9 -9
- package/src/resources/images.ts +4 -4
- package/src/resources/index.ts +11 -11
- package/src/resources/models.ts +7 -6
- package/src/resources/moderations.ts +3 -3
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +6 -6
- package/src/version.ts +1 -1
- package/uploads.d.ts +1 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +4 -4
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -1
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/_shims/ReadableStream.node.d.ts.map +0 -1
- package/_shims/ReadableStream.node.js.map +0 -1
- package/_shims/ReadableStream.node.mjs.map +0 -1
- package/_shims/agent.node.d.ts.map +0 -1
- package/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
- package/_shims/node-readable.node.js.map +0 -1
- package/_shims/node-readable.node.mjs.map +0 -1
- package/src/_shims/fetch.deno.ts +0 -23
- package/src/_shims/formdata.deno.ts +0 -16
- /package/_shims/{fetch.node.d.ts → fetch-node.d.ts} +0 -0
- /package/_shims/{fetch.node.js → fetch-node.js} +0 -0
- /package/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
- /package/_shims/{formdata.node.d.ts → form-data-node.d.ts} +0 -0
- /package/_shims/{formdata.node.js → form-data-node.js} +0 -0
- /package/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
- /package/_shims/{formdata.d.ts → form-data.d.ts} +0 -0
- /package/_shims/{formdata.js → form-data.js} +0 -0
- /package/_shims/{formdata.mjs → form-data.mjs} +0 -0
- /package/src/_shims/{ReadableStream.node.ts → ReadableStream-node.ts} +0 -0
- /package/src/_shims/{agent.node.ts → agent-node.ts} +0 -0
- /package/src/_shims/{fetch.node.js → fetch-node.js} +0 -0
- /package/src/_shims/{fetch.node.mjs → fetch-node.mjs} +0 -0
- /package/src/_shims/{formdata.node.js → form-data-node.js} +0 -0
- /package/src/_shims/{formdata.node.mjs → form-data-node.mjs} +0 -0
- /package/src/_shims/{formdata.js → form-data.js} +0 -0
- /package/src/_shims/{formdata.mjs → form-data.mjs} +0 -0
- /package/src/_shims/{node-readable.node.ts → node-readable-node.ts} +0 -0
package/resources/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAC9C,sCAAoC;AACpC,wCAAyD;AAEzD,sCAA2E;AAC3E,kDAAyC;AAEzC,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;OAKG;IACH,MAAM,CAAC,IAAsB,EAAE,OAA6B;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAA,kCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAc,EAAE,OAA6B;QACpD,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAc,EAAE,OAA6B;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAc,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,UAAU,EAAE;YAC1C,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CACrB,EAAU,EACV,EAAE,YAAY,GAAG,IAAI,EAAE,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,KAAkD,EAAE;QAEnG,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;QAEnE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAEnC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxD,MAAM,IAAA,YAAK,EAAC,YAAY,CAAC,CAAC;YAE1B,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/B,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE;gBAChC,MAAM,IAAI,iCAAyB,CAAC;oBAClC,OAAO,EAAE,iCAAiC,EAAE,+BAA+B,OAAO,gBAAgB;iBACnG,CAAC,CAAC;aACJ;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnED,sBAmEC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,iBAAgB;CAAG;AAAxD,0CAAwD;AA+ExD,WAAiB,KAAK;AAMtB,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
|
package/resources/files.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
import { APIResource } from 'openai/resource';
|
|
3
|
+
import { sleep } from 'openai/core';
|
|
4
|
+
import { APIConnectionTimeoutError } from 'openai/error';
|
|
3
5
|
import { multipartFormRequestOptions } from 'openai/core';
|
|
4
6
|
import { Page } from 'openai/pagination';
|
|
5
7
|
export class Files extends APIResource {
|
|
@@ -42,6 +44,24 @@ export class Files extends APIResource {
|
|
|
42
44
|
},
|
|
43
45
|
});
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Waits for the given file to be processed, default timeout is 30 mins.
|
|
49
|
+
*/
|
|
50
|
+
async waitForProcessing(id, { pollInterval = 5000, maxWait = 30 * 60 * 1000 } = {}) {
|
|
51
|
+
const TERMINAL_STATES = new Set(['processed', 'error', 'deleted']);
|
|
52
|
+
const start = Date.now();
|
|
53
|
+
let file = await this.retrieve(id);
|
|
54
|
+
while (!file.status || !TERMINAL_STATES.has(file.status)) {
|
|
55
|
+
await sleep(pollInterval);
|
|
56
|
+
file = await this.retrieve(id);
|
|
57
|
+
if (Date.now() - start > maxWait) {
|
|
58
|
+
throw new APIConnectionTimeoutError({
|
|
59
|
+
message: `Giving up on waiting for file ${id} to finish processing after ${maxWait} milliseconds.`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return file;
|
|
64
|
+
}
|
|
45
65
|
}
|
|
46
66
|
/**
|
|
47
67
|
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
package/resources/files.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;
|
|
1
|
+
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../src/resources/files.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;OACtC,EAAE,KAAK,EAAE,MAAM,aAAa;OAC5B,EAAE,yBAAyB,EAAE,MAAM,cAAc;OAEjD,EAAmB,2BAA2B,EAAE,MAAM,aAAa;OACnE,EAAE,IAAI,EAAE,MAAM,mBAAmB;AAExC,MAAM,OAAO,KAAM,SAAQ,WA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C,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;YAE1B,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/B,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE;gBAChC,MAAM,IAAI,yBAAyB,CAAC;oBAClC,OAAO,EAAE,iCAAiC,EAAE,+BAA+B,OAAO,gBAAgB;iBACnG,CAAC,CAAC;aACJ;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,IAAgB;CAAG;AA+ExD,WAAiB,KAAK;AAMtB,CAAC,EANgB,KAAK,KAAL,KAAK,QAMrB"}
|
|
@@ -63,7 +63,7 @@ export interface FineTune {
|
|
|
63
63
|
*/
|
|
64
64
|
id: string;
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
66
|
+
* The Unix timestamp (in seconds) for when the fine-tuning job was created.
|
|
67
67
|
*/
|
|
68
68
|
created_at: number;
|
|
69
69
|
/**
|
|
@@ -102,7 +102,7 @@ export interface FineTune {
|
|
|
102
102
|
*/
|
|
103
103
|
training_files: Array<Files.FileObject>;
|
|
104
104
|
/**
|
|
105
|
-
* The
|
|
105
|
+
* The Unix timestamp (in seconds) for when the fine-tuning job was last updated.
|
|
106
106
|
*/
|
|
107
107
|
updated_at: number;
|
|
108
108
|
/**
|
|
@@ -58,7 +58,7 @@ export interface FineTuningJob {
|
|
|
58
58
|
*/
|
|
59
59
|
id: string;
|
|
60
60
|
/**
|
|
61
|
-
* The
|
|
61
|
+
* The Unix timestamp (in seconds) for when the fine-tuning job was created.
|
|
62
62
|
*/
|
|
63
63
|
created_at: number;
|
|
64
64
|
/**
|
|
@@ -102,9 +102,9 @@ export interface FineTuningJob {
|
|
|
102
102
|
/**
|
|
103
103
|
* The file ID used for validation.
|
|
104
104
|
*/
|
|
105
|
-
validation_file: string;
|
|
105
|
+
validation_file: string | null;
|
|
106
106
|
/**
|
|
107
|
-
* The
|
|
107
|
+
* The Unix timestamp (in seconds) for when the fine-tuning job was finished.
|
|
108
108
|
*/
|
|
109
109
|
finished_at?: number;
|
|
110
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../src/resources/fine-tuning/jobs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,KAAK,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;IAI5F;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;IAIhG;;OAEG;IACH,IAAI,CACF,KAAK,CAAC,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,aAAa,CAAC;IACtD,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,aAAa,CAAC;IAWxF;;OAEG;IACH,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAA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.RequestOptions): Core.PagePromise<ModelsPage, Model>;
|
|
16
16
|
/**
|
|
17
|
-
* Delete a fine-tuned model. You must have the Owner role in your organization
|
|
17
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
18
|
+
* delete a model.
|
|
18
19
|
*/
|
|
19
20
|
del(model: string, options?: Core.RequestOptions): Core.APIPromise<ModelDeleted>;
|
|
20
21
|
}
|
|
@@ -32,7 +33,7 @@ export interface Model {
|
|
|
32
33
|
*/
|
|
33
34
|
id: string;
|
|
34
35
|
/**
|
|
35
|
-
* The
|
|
36
|
+
* The Unix timestamp (in seconds) when the model was created.
|
|
36
37
|
*/
|
|
37
38
|
created: number;
|
|
38
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAI9E;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC;IAIxE
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAI9E;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC;IAIxE;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;CAGjF;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC;CAAG;AAE9C,KAAK,WAAW,GAAG,UAAU,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,OAAO,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,yBAAiB,MAAM,CAAC;IACtB,MAAM,QAAQ,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAChC,MAAM,QAAQ,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAC9C,KAAY,UAAU,GAAG,WAAW,CAAC;CACtC"}
|
package/resources/models.js
CHANGED
|
@@ -20,7 +20,8 @@ class Models extends resource_1.APIResource {
|
|
|
20
20
|
return this.getAPIList('/models', ModelsPage, options);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Delete a fine-tuned model. You must have the Owner role in your organization
|
|
23
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
24
|
+
* delete a model.
|
|
24
25
|
*/
|
|
25
26
|
del(model, options) {
|
|
26
27
|
return this.delete(`/models/${model}`, options);
|
package/resources/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAE9C,kDAAyC;AAEzC,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAE9C,kDAAyC;AAEzC,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,KAAa,EAAE,OAA6B;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF;AAxBD,wBAwBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,iBAAW;CAAG;AAA9C,gCAA8C;AAqC9C,WAAiB,MAAM;AAIvB,CAAC,EAJgB,MAAM,GAAN,cAAM,KAAN,cAAM,QAItB"}
|
package/resources/models.mjs
CHANGED
|
@@ -17,7 +17,8 @@ export class Models extends APIResource {
|
|
|
17
17
|
return this.getAPIList('/models', ModelsPage, options);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Delete a fine-tuned model. You must have the Owner role in your organization
|
|
20
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
21
|
+
* delete a model.
|
|
21
22
|
*/
|
|
22
23
|
del(model, options) {
|
|
23
24
|
return this.delete(`/models/${model}`, options);
|
package/resources/models.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.mjs","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;OAEtC,EAAE,IAAI,EAAE,MAAM,mBAAmB;AAExC,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"models.mjs","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;OAEtC,EAAE,IAAI,EAAE,MAAM,mBAAmB;AAExC,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,OAA6B;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,KAAa,EAAE,OAA6B;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAW;CAAG;AAqC9C,WAAiB,MAAM;AAIvB,CAAC,EAJgB,MAAM,KAAN,MAAM,QAItB"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
type _ReadableStream<R = any> =
|
|
14
|
+
type _ReadableStream<R = any> = ReadableStream<R>;
|
|
15
15
|
declare const _ReadableStream: {
|
|
16
16
|
prototype: _ReadableStream;
|
|
17
17
|
new (
|
|
@@ -26,13 +26,13 @@ declare const _ReadableStream: {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// @ts-ignore
|
|
29
|
-
type _UnderlyingSource<R = any> =
|
|
29
|
+
type _UnderlyingSource<R = any> = UnderlyingSource<R>;
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
type _UnderlyingByteSource =
|
|
31
|
+
type _UnderlyingByteSource = UnderlyingByteSource;
|
|
32
32
|
type _UnderlyingDefaultSource<R = any> =
|
|
33
33
|
// @ts-ignore
|
|
34
|
-
|
|
34
|
+
UnderlyingDefaultSource<R>;
|
|
35
35
|
// @ts-ignore
|
|
36
|
-
type _QueuingStrategy<R = any> =
|
|
36
|
+
type _QueuingStrategy<R = any> = QueuingStrategy<R>;
|
|
37
37
|
|
|
38
38
|
export { _ReadableStream as ReadableStream };
|
package/src/_shims/agent.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*
|
|
4
4
|
* This is a stub for non-node environments.
|
|
5
|
-
* In node environments, it gets replaced agent
|
|
5
|
+
* In node environments, it gets replaced agent-node.ts by the package export map
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export type Agent = any;
|
|
@@ -17,26 +17,26 @@ import * as nf from 'node-fetch';
|
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
type _fetch = unknown extends typeof fetch ? typeof nf.default : typeof fetch;
|
|
19
19
|
// @ts-ignore
|
|
20
|
-
type _Request =
|
|
20
|
+
type _Request = Request;
|
|
21
21
|
// @ts-ignore
|
|
22
|
-
type _RequestInfo =
|
|
22
|
+
type _RequestInfo = RequestInfo;
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
type _RequestInit =
|
|
24
|
+
type _RequestInit = RequestInit;
|
|
25
25
|
// @ts-ignore
|
|
26
|
-
type _Response =
|
|
26
|
+
type _Response = Response;
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
type _ResponseInit =
|
|
28
|
+
type _ResponseInit = ResponseInit;
|
|
29
29
|
type _ResponseType =
|
|
30
30
|
// @ts-ignore
|
|
31
31
|
unknown extends ResponseType ? 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'
|
|
32
32
|
: // @ts-ignore
|
|
33
33
|
ResponseType;
|
|
34
34
|
// @ts-ignore
|
|
35
|
-
type _BodyInit =
|
|
35
|
+
type _BodyInit = BodyInit;
|
|
36
36
|
// @ts-ignore
|
|
37
|
-
type _Headers =
|
|
37
|
+
type _Headers = Headers;
|
|
38
38
|
// @ts-ignore
|
|
39
|
-
type _HeadersInit =
|
|
39
|
+
type _HeadersInit = HeadersInit;
|
|
40
40
|
|
|
41
41
|
declare const _fetch: _fetch;
|
|
42
42
|
declare const _Request: {
|
package/src/_shims/fetch.d.ts
CHANGED
|
@@ -14,25 +14,25 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
type _fetch =
|
|
17
|
+
type _fetch = typeof fetch;
|
|
18
18
|
// @ts-ignore
|
|
19
|
-
type _Request =
|
|
19
|
+
type _Request = Request;
|
|
20
20
|
// @ts-ignore
|
|
21
|
-
type _RequestInfo =
|
|
21
|
+
type _RequestInfo = RequestInfo;
|
|
22
22
|
// @ts-ignore
|
|
23
|
-
type _RequestInit =
|
|
23
|
+
type _RequestInit = RequestInit;
|
|
24
24
|
// @ts-ignore
|
|
25
|
-
type _Response =
|
|
25
|
+
type _Response = Response;
|
|
26
26
|
// @ts-ignore
|
|
27
|
-
type _ResponseInit =
|
|
27
|
+
type _ResponseInit = ResponseInit;
|
|
28
28
|
// @ts-ignore
|
|
29
|
-
type _ResponseType =
|
|
29
|
+
type _ResponseType = ResponseType;
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
type _BodyInit =
|
|
31
|
+
type _BodyInit = BodyInit;
|
|
32
32
|
// @ts-ignore
|
|
33
|
-
type _Headers =
|
|
33
|
+
type _Headers = Headers;
|
|
34
34
|
// @ts-ignore
|
|
35
|
-
type _HeadersInit =
|
|
35
|
+
type _HeadersInit = HeadersInit;
|
|
36
36
|
|
|
37
37
|
declare const _fetch: _fetch;
|
|
38
38
|
declare const _Request: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { fileFromPath as _fileFromPath } from 'formdata-node/file-from-path';
|
|
6
|
-
import type { File, FilePropertyBag } from './
|
|
6
|
+
import type { File, FilePropertyBag } from './form-data-node.js';
|
|
7
7
|
|
|
8
8
|
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
9
9
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*
|
|
4
|
-
* This is a stub that gets replaced by fileFromPath
|
|
4
|
+
* This is a stub that gets replaced by fileFromPath-node.js for node environments
|
|
5
5
|
* in the package export map
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { FilePropertyBag, File } from './
|
|
8
|
+
import type { FilePropertyBag, File } from './form-data.js';
|
|
9
9
|
|
|
10
10
|
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as fd from 'formdata-node';
|
|
6
6
|
|
|
7
|
-
import type { BlobPart } from '../uploads';
|
|
7
|
+
import type { BlobPart } from '../uploads.js';
|
|
8
8
|
|
|
9
9
|
type EndingType = 'native' | 'transparent';
|
|
10
10
|
|
|
@@ -21,11 +21,11 @@ export interface FilePropertyBag extends BlobPropertyBag {
|
|
|
21
21
|
// Use builtin web types if present; else formdata-node types
|
|
22
22
|
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
type _FormData =
|
|
24
|
+
type _FormData = FormData;
|
|
25
25
|
// @ts-ignore
|
|
26
|
-
type _File =
|
|
26
|
+
type _File = File;
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
type _Blob =
|
|
28
|
+
type _Blob = Blob;
|
|
29
29
|
|
|
30
30
|
declare const _FormData: {
|
|
31
31
|
new (form?: any): _FormData;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { BlobPart } from '../uploads';
|
|
5
|
+
import type { BlobPart } from '../uploads.js';
|
|
6
6
|
|
|
7
7
|
type EndingType = 'native' | 'transparent';
|
|
8
8
|
|
|
@@ -19,11 +19,11 @@ export interface FilePropertyBag extends BlobPropertyBag {
|
|
|
19
19
|
// add appropriate lib or types to tsconfig)
|
|
20
20
|
|
|
21
21
|
// @ts-ignore
|
|
22
|
-
type _FormData =
|
|
22
|
+
type _FormData = FormData;
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
type _File =
|
|
24
|
+
type _File = File;
|
|
25
25
|
// @ts-ignore
|
|
26
|
-
type _Blob =
|
|
26
|
+
type _Blob = Blob;
|
|
27
27
|
|
|
28
28
|
declare const _FormData: {
|
|
29
29
|
new (form?: any): _FormData;
|
package/src/_shims/{getMultipartRequestOptions.node.ts → getMultipartRequestOptions-node.ts}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { FormData } from './
|
|
6
|
-
import type { RequestOptions } from '../core';
|
|
5
|
+
import { FormData } from './form-data-node.js';
|
|
6
|
+
import type { RequestOptions } from '../core.js';
|
|
7
7
|
import { Readable } from 'node:stream';
|
|
8
8
|
import { FormDataEncoder } from 'form-data-encoder';
|
|
9
|
-
import { MultipartBody } from '../uploads';
|
|
9
|
+
import { MultipartBody } from '../uploads.js';
|
|
10
10
|
|
|
11
11
|
export async function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
|
|
12
12
|
form: FormData,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { FormData } from './
|
|
6
|
-
import type { RequestOptions } from '../core';
|
|
7
|
-
import { MultipartBody } from '../uploads';
|
|
5
|
+
import { FormData } from './form-data.js';
|
|
6
|
+
import type { RequestOptions } from '../core.js';
|
|
7
|
+
import { MultipartBody } from '../uploads.js';
|
|
8
8
|
|
|
9
9
|
export async function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
|
|
10
10
|
form: FormData,
|
package/src/core.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { VERSION } from './version';
|
|
2
|
-
import { Stream } from './streaming';
|
|
3
|
-
import { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError } from './error';
|
|
4
|
-
import type { Readable } from './_shims/node-readable';
|
|
5
|
-
import { getDefaultAgent, type Agent } from './_shims/agent';
|
|
1
|
+
import { VERSION } from './version.js';
|
|
2
|
+
import { Stream } from './streaming.js';
|
|
3
|
+
import { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError } from './error.js';
|
|
4
|
+
import type { Readable } from './_shims/node-readable.js';
|
|
5
|
+
import { getDefaultAgent, type Agent } from './_shims/agent.js';
|
|
6
6
|
import {
|
|
7
7
|
fetch,
|
|
8
8
|
isPolyfilled as fetchIsPolyfilled,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
type HeadersInit,
|
|
13
13
|
} from './_shims/fetch.js';
|
|
14
14
|
export { type Response };
|
|
15
|
-
import { isMultipartBody } from './uploads';
|
|
15
|
+
import { isMultipartBody } from './uploads.js';
|
|
16
16
|
export {
|
|
17
17
|
maybeMultipartFormRequestOptions,
|
|
18
18
|
multipartFormRequestOptions,
|
|
19
19
|
createForm,
|
|
20
20
|
type Uploadable,
|
|
21
|
-
} from './uploads';
|
|
21
|
+
} from './uploads.js';
|
|
22
22
|
|
|
23
23
|
const MAX_RETRIES = 2;
|
|
24
24
|
|
|
@@ -52,7 +52,7 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
|
52
52
|
// TODO handle blob, arraybuffer, other content types, etc.
|
|
53
53
|
const text = await response.text();
|
|
54
54
|
debug('response', response.status, response.url, response.headers, text);
|
|
55
|
-
return text as T;
|
|
55
|
+
return text as any as T;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -313,7 +313,8 @@ export abstract class APIClient {
|
|
|
313
313
|
protected parseHeaders(headers: HeadersInit | null | undefined): Record<string, string> {
|
|
314
314
|
return (
|
|
315
315
|
!headers ? {}
|
|
316
|
-
: Symbol.iterator in headers ?
|
|
316
|
+
: Symbol.iterator in headers ?
|
|
317
|
+
Object.fromEntries(Array.from(headers as Iterable<string[]>).map((header) => [...header]))
|
|
317
318
|
: { ...headers }
|
|
318
319
|
);
|
|
319
320
|
}
|
|
@@ -397,7 +398,7 @@ export abstract class APIClient {
|
|
|
397
398
|
return new PagePromise<PageClass, Item>(this, request, Page);
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
buildURL<Req
|
|
401
|
+
buildURL<Req extends Record<string, unknown>>(path: string, query: Req | null | undefined): string {
|
|
401
402
|
const url =
|
|
402
403
|
isAbsoluteURL(path) ?
|
|
403
404
|
new URL(path)
|
|
@@ -900,7 +901,7 @@ const isAbsoluteURL = (url: string): boolean => {
|
|
|
900
901
|
return startsWithSchemeRegexp.test(url);
|
|
901
902
|
};
|
|
902
903
|
|
|
903
|
-
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
904
|
+
export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
904
905
|
|
|
905
906
|
const validatePositiveInteger = (name: string, n: unknown): number => {
|
|
906
907
|
if (typeof n !== 'number' || !Number.isInteger(n)) {
|
package/src/error.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { castToError, Headers } from './core';
|
|
3
|
+
import { castToError, Headers } from './core.js';
|
|
4
4
|
|
|
5
5
|
export class APIError extends Error {
|
|
6
6
|
readonly status: number | undefined;
|
|
@@ -106,8 +106,8 @@ export class APIConnectionError extends APIError {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export class APIConnectionTimeoutError extends APIConnectionError {
|
|
109
|
-
constructor() {
|
|
110
|
-
super({ message: 'Request timed out.' });
|
|
109
|
+
constructor({ message }: { message?: string } = {}) {
|
|
110
|
+
super({ message: message ?? 'Request timed out.' });
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from './core';
|
|
4
|
-
import * as Pagination from './pagination';
|
|
5
|
-
import * as API from './resources/index';
|
|
6
|
-
import * as Errors from './error';
|
|
7
|
-
import type { Agent } from './_shims/agent';
|
|
8
|
-
import * as Uploads from './uploads';
|
|
3
|
+
import * as Core from './core.js';
|
|
4
|
+
import * as Pagination from './pagination.js';
|
|
5
|
+
import * as API from './resources/index.js';
|
|
6
|
+
import * as Errors from './error.js';
|
|
7
|
+
import type { Agent } from './_shims/agent.js';
|
|
8
|
+
import * as Uploads from './uploads.js';
|
|
9
9
|
|
|
10
10
|
export interface ClientOptions {
|
|
11
11
|
/**
|
|
@@ -111,8 +111,8 @@ export class OpenAI extends Core.APIClient {
|
|
|
111
111
|
const options: ClientOptions = {
|
|
112
112
|
apiKey,
|
|
113
113
|
organization,
|
|
114
|
-
baseURL: `https://api.openai.com/v1`,
|
|
115
114
|
...opts,
|
|
115
|
+
baseURL: opts.baseURL ?? `https://api.openai.com/v1`,
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
if (!options.dangerouslyAllowBrowser && Core.isRunningInBrowser()) {
|
package/src/pagination.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core';
|
|
3
|
+
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core.js';
|
|
4
4
|
|
|
5
5
|
export interface PageResponse<Item> {
|
|
6
6
|
data: Array<Item>;
|
package/src/resource.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '../../resource';
|
|
4
|
-
import { Transcriptions } from './transcriptions';
|
|
5
|
-
import { Translations } from './translations';
|
|
6
|
-
import * as API from './index';
|
|
3
|
+
import { APIResource } from '../../resource.js';
|
|
4
|
+
import { Transcriptions } from './transcriptions.js';
|
|
5
|
+
import { Translations } from './translations.js';
|
|
6
|
+
import * as API from './index.js';
|
|
7
7
|
|
|
8
8
|
export class Audio extends APIResource {
|
|
9
9
|
transcriptions: Transcriptions = new Transcriptions(this.client);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
export { Audio } from './audio';
|
|
4
|
-
export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions';
|
|
5
|
-
export { Translation, TranslationCreateParams, Translations } from './translations';
|
|
3
|
+
export { Audio } from './audio.js';
|
|
4
|
+
export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions.js';
|
|
5
|
+
export { Translation, TranslationCreateParams, Translations } from './translations.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from '../../core';
|
|
4
|
-
import { APIResource } from '../../resource';
|
|
5
|
-
import * as API from './index';
|
|
6
|
-
import { type Uploadable, multipartFormRequestOptions } from '../../core';
|
|
3
|
+
import * as Core from '../../core.js';
|
|
4
|
+
import { APIResource } from '../../resource.js';
|
|
5
|
+
import * as API from './index.js';
|
|
6
|
+
import { type Uploadable, multipartFormRequestOptions } from '../../core.js';
|
|
7
7
|
|
|
8
8
|
export class Transcriptions extends APIResource {
|
|
9
9
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import * as Core from '../../core';
|
|
4
|
-
import { APIResource } from '../../resource';
|
|
5
|
-
import * as API from './index';
|
|
6
|
-
import { type Uploadable, multipartFormRequestOptions } from '../../core';
|
|
3
|
+
import * as Core from '../../core.js';
|
|
4
|
+
import { APIResource } from '../../resource.js';
|
|
5
|
+
import * as API from './index.js';
|
|
6
|
+
import { type Uploadable, multipartFormRequestOptions } from '../../core.js';
|
|
7
7
|
|
|
8
8
|
export class Translations extends APIResource {
|
|
9
9
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '../../resource';
|
|
4
|
-
import { Completions } from './completions';
|
|
5
|
-
import * as API from './index';
|
|
3
|
+
import { APIResource } from '../../resource.js';
|
|
4
|
+
import { Completions } from './completions.js';
|
|
5
|
+
import * as API from './index.js';
|
|
6
6
|
|
|
7
7
|
export class Chat extends APIResource {
|
|
8
8
|
completions: Completions = new Completions(this.client);
|
|
@@ -14,6 +14,7 @@ export namespace Chat {
|
|
|
14
14
|
export import ChatCompletionChunk = API.ChatCompletionChunk;
|
|
15
15
|
export import ChatCompletionMessage = API.ChatCompletionMessage;
|
|
16
16
|
export import ChatCompletionMessageParam = API.ChatCompletionMessageParam;
|
|
17
|
+
export import ChatCompletionRole = API.ChatCompletionRole;
|
|
17
18
|
export import CreateChatCompletionRequestMessage = API.CreateChatCompletionRequestMessage;
|
|
18
19
|
export import ChatCompletionCreateParams = API.ChatCompletionCreateParams;
|
|
19
20
|
export import CompletionCreateParams = API.CompletionCreateParams;
|