openai 4.8.0 → 4.9.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 +8 -0
- package/README.md +4 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/{src/_shims/ReadableStream-node.ts → _shims/auto/runtime-bun.d.ts} +2 -3
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +99 -0
- package/_shims/{ReadableStream.js → auto/types.js} +0 -2
- package/{src/_shims/ReadableStream.js → _shims/auto/types.mjs} +0 -2
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +79 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +87 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +54 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +35 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +39 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +35 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +70 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +63 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +82 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +170 -218
- package/core.d.ts.map +1 -1
- package/core.js +679 -737
- package/core.js.map +1 -1
- package/core.mjs +673 -688
- package/core.mjs.map +1 -1
- package/error.d.ts +32 -34
- package/error.js +95 -109
- package/error.mjs +92 -94
- package/index.d.mts +164 -175
- package/index.d.ts +164 -175
- package/index.d.ts.map +1 -1
- package/index.js +110 -161
- package/index.mjs +88 -109
- package/package.json +31 -58
- package/pagination.d.ts +31 -41
- package/pagination.js +52 -48
- package/pagination.mjs +50 -46
- package/resource.d.ts +10 -10
- package/resource.js +12 -12
- package/resource.mjs +10 -10
- package/resources/audio/audio.d.ts +12 -12
- package/resources/audio/audio.js +33 -50
- package/resources/audio/audio.mjs +11 -11
- package/resources/audio/index.d.ts +4 -4
- package/resources/audio/index.js +9 -24
- package/resources/audio/index.mjs +4 -4
- package/resources/audio/transcriptions.d.ts +44 -44
- package/resources/audio/transcriptions.js +13 -12
- package/resources/audio/transcriptions.mjs +9 -8
- package/resources/audio/translations.d.ts +38 -38
- package/resources/audio/translations.js +13 -12
- package/resources/audio/translations.mjs +9 -8
- package/resources/chat/chat.d.ts +17 -17
- package/resources/chat/chat.js +30 -47
- package/resources/chat/chat.mjs +8 -8
- package/resources/chat/completions.d.ts +330 -353
- package/resources/chat/completions.js +10 -13
- package/resources/chat/completions.mjs +7 -10
- package/resources/chat/index.d.ts +3 -17
- package/resources/chat/index.js +7 -17
- package/resources/chat/index.mjs +3 -3
- package/resources/completions.d.ts +216 -232
- package/resources/completions.js +10 -13
- package/resources/completions.mjs +7 -10
- package/resources/edits.d.ts +73 -73
- package/resources/edits.js +16 -15
- package/resources/edits.mjs +13 -12
- package/resources/embeddings.d.ts +73 -76
- package/resources/embeddings.js +12 -11
- package/resources/embeddings.mjs +9 -8
- package/resources/files.d.ts +91 -96
- package/resources/files.js +64 -65
- package/resources/files.mjs +57 -58
- package/resources/fine-tunes.d.ts +277 -290
- package/resources/fine-tunes.js +49 -50
- package/resources/fine-tunes.mjs +45 -46
- package/resources/fine-tuning/fine-tuning.d.ts +12 -12
- package/resources/fine-tuning/fine-tuning.js +32 -49
- package/resources/fine-tuning/fine-tuning.mjs +10 -10
- package/resources/fine-tuning/index.d.ts +3 -12
- package/resources/fine-tuning/index.js +9 -29
- package/resources/fine-tuning/index.mjs +3 -3
- package/resources/fine-tuning/jobs.d.ts +173 -179
- package/resources/fine-tuning/jobs.js +50 -47
- package/resources/fine-tuning/jobs.mjs +45 -42
- package/resources/images.d.ts +116 -119
- package/resources/images.js +25 -24
- package/resources/images.mjs +21 -20
- package/resources/index.d.ts +12 -37
- package/resources/index.js +29 -113
- package/resources/index.mjs +12 -12
- package/resources/models.d.ts +41 -40
- package/resources/models.js +30 -28
- package/resources/models.mjs +26 -24
- package/resources/moderations.d.ts +153 -156
- package/resources/moderations.js +12 -11
- package/resources/moderations.mjs +9 -8
- package/shims/node.d.ts +29 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +99 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +79 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +79 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +62 -0
- package/src/_shims/web-runtime.ts +91 -0
- package/src/_shims/web-types.d.ts +82 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +34 -17
- package/src/error.ts +1 -1
- package/src/index.ts +6 -6
- 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 +3 -3
- package/src/resources/chat/completions.ts +6 -6
- package/src/resources/chat/index.ts +2 -2
- package/src/resources/completions.ts +5 -5
- package/src/resources/edits.ts +4 -4
- package/src/resources/embeddings.ts +3 -3
- package/src/resources/files.ts +7 -7
- package/src/resources/fine-tunes.ts +7 -7
- 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 +6 -6
- package/src/resources/images.ts +4 -4
- package/src/resources/index.ts +11 -11
- package/src/resources/models.ts +4 -4
- package/src/resources/moderations.ts +3 -3
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/streaming.ts +1 -1
- package/src/uploads.ts +12 -16
- package/src/version.ts +1 -1
- package/streaming.d.ts +9 -8
- package/streaming.d.ts.map +1 -1
- package/streaming.js +194 -185
- package/streaming.mjs +192 -183
- package/uploads.d.ts +23 -39
- package/uploads.d.ts.map +1 -1
- package/uploads.js +115 -157
- package/uploads.js.map +1 -1
- package/uploads.mjs +111 -133
- package/uploads.mjs.map +1 -1
- package/version.d.ts +2 -2
- package/version.js +4 -4
- package/version.mjs +2 -2
- package/_shims/ReadableStream-node.d.ts +0 -6
- package/_shims/ReadableStream-node.d.ts.map +0 -1
- package/_shims/ReadableStream-node.js +0 -14
- package/_shims/ReadableStream-node.js.map +0 -1
- package/_shims/ReadableStream-node.mjs +0 -3
- package/_shims/ReadableStream-node.mjs.map +0 -1
- package/_shims/ReadableStream.d.ts +0 -38
- package/_shims/ReadableStream.mjs +0 -7
- package/_shims/agent-node.d.ts +0 -7
- package/_shims/agent-node.d.ts.map +0 -1
- package/_shims/agent-node.js +0 -28
- package/_shims/agent-node.js.map +0 -1
- package/_shims/agent-node.mjs +0 -16
- package/_shims/agent-node.mjs.map +0 -1
- package/_shims/agent.d.ts +0 -9
- package/_shims/agent.d.ts.map +0 -1
- package/_shims/agent.js +0 -14
- package/_shims/agent.js.map +0 -1
- package/_shims/agent.mjs +0 -10
- package/_shims/agent.mjs.map +0 -1
- package/_shims/fetch-node.d.ts +0 -64
- package/_shims/fetch-node.js +0 -12
- package/_shims/fetch-node.mjs +0 -14
- package/_shims/fetch.d.ts +0 -60
- package/_shims/fetch.js +0 -13
- package/_shims/fetch.mjs +0 -15
- package/_shims/fileFromPath-node.d.ts +0 -17
- package/_shims/fileFromPath-node.d.ts.map +0 -1
- package/_shims/fileFromPath-node.js +0 -17
- package/_shims/fileFromPath-node.js.map +0 -1
- package/_shims/fileFromPath-node.mjs +0 -13
- package/_shims/fileFromPath-node.mjs.map +0 -1
- package/_shims/fileFromPath.d.ts +0 -22
- package/_shims/fileFromPath.d.ts.map +0 -1
- package/_shims/fileFromPath.js +0 -16
- package/_shims/fileFromPath.js.map +0 -1
- package/_shims/fileFromPath.mjs +0 -12
- package/_shims/fileFromPath.mjs.map +0 -1
- package/_shims/form-data-node.d.ts +0 -45
- package/_shims/form-data-node.js +0 -11
- package/_shims/form-data-node.mjs +0 -9
- package/_shims/form-data.d.ts +0 -43
- package/_shims/form-data.js +0 -17
- package/_shims/form-data.mjs +0 -20
- package/_shims/getMultipartRequestOptions-node.d.ts +0 -10
- package/_shims/getMultipartRequestOptions-node.d.ts.map +0 -1
- package/_shims/getMultipartRequestOptions-node.js +0 -22
- package/_shims/getMultipartRequestOptions-node.js.map +0 -1
- package/_shims/getMultipartRequestOptions-node.mjs +0 -18
- package/_shims/getMultipartRequestOptions-node.mjs.map +0 -1
- package/_shims/getMultipartRequestOptions.d.ts +0 -10
- package/_shims/getMultipartRequestOptions.d.ts.map +0 -1
- package/_shims/getMultipartRequestOptions.js +0 -12
- package/_shims/getMultipartRequestOptions.js.map +0 -1
- package/_shims/getMultipartRequestOptions.mjs +0 -8
- package/_shims/getMultipartRequestOptions.mjs.map +0 -1
- package/_shims/node-readable-node.d.ts +0 -8
- package/_shims/node-readable-node.d.ts.map +0 -1
- package/_shims/node-readable-node.js +0 -9
- package/_shims/node-readable-node.js.map +0 -1
- package/_shims/node-readable-node.mjs +0 -5
- package/_shims/node-readable-node.mjs.map +0 -1
- package/_shims/node-readable.d.ts +0 -23
- package/_shims/node-readable.d.ts.map +0 -1
- package/_shims/node-readable.js +0 -11
- package/_shims/node-readable.js.map +0 -1
- package/_shims/node-readable.mjs +0 -7
- package/_shims/node-readable.mjs.map +0 -1
- package/src/_shims/ReadableStream.d.ts +0 -38
- package/src/_shims/ReadableStream.mjs +0 -7
- package/src/_shims/agent-node.ts +0 -22
- package/src/_shims/agent.ts +0 -12
- package/src/_shims/fetch-node.d.ts +0 -64
- package/src/_shims/fetch-node.js +0 -12
- package/src/_shims/fetch-node.mjs +0 -14
- package/src/_shims/fetch.d.ts +0 -60
- package/src/_shims/fetch.js +0 -13
- package/src/_shims/fetch.mjs +0 -15
- package/src/_shims/fileFromPath-node.ts +0 -29
- package/src/_shims/fileFromPath.ts +0 -29
- package/src/_shims/form-data-node.d.ts +0 -45
- package/src/_shims/form-data-node.js +0 -11
- package/src/_shims/form-data-node.mjs +0 -9
- package/src/_shims/form-data.d.ts +0 -43
- package/src/_shims/form-data.js +0 -17
- package/src/_shims/form-data.mjs +0 -20
- package/src/_shims/getMultipartRequestOptions-node.ts +0 -25
- package/src/_shims/getMultipartRequestOptions.ts +0 -14
- package/src/_shims/node-readable-node.ts +0 -10
- package/src/_shims/node-readable.ts +0 -30
package/resources/models.d.ts
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
import * as Core from 'openai/core';
|
|
2
2
|
import { APIResource } from 'openai/resource';
|
|
3
|
-
import * as API from
|
|
3
|
+
import * as API from "./index.js";
|
|
4
4
|
import { Page } from 'openai/pagination';
|
|
5
5
|
export declare class Models extends APIResource {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves a model instance, providing basic information about the model such as
|
|
8
|
+
* the owner and permissioning.
|
|
9
|
+
*/
|
|
10
|
+
retrieve(model: string, options?: Core.RequestOptions): Core.APIPromise<Model>;
|
|
11
|
+
/**
|
|
12
|
+
* Lists the currently available models, and provides basic information about each
|
|
13
|
+
* one such as the owner and availability.
|
|
14
|
+
*/
|
|
15
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ModelsPage, Model>;
|
|
16
|
+
/**
|
|
17
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
18
|
+
* delete a model.
|
|
19
|
+
*/
|
|
20
|
+
del(model: string, options?: Core.RequestOptions): Core.APIPromise<ModelDeleted>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
24
24
|
*/
|
|
25
|
-
export declare class ModelsPage extends Page<Model> {
|
|
25
|
+
export declare class ModelsPage extends Page<Model> {
|
|
26
|
+
}
|
|
26
27
|
type _ModelsPage = ModelsPage;
|
|
27
28
|
/**
|
|
28
29
|
* Describes an OpenAI model offering that can be used with the API.
|
|
29
30
|
*/
|
|
30
31
|
export interface Model {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The model identifier, which can be referenced in the API endpoints.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* The Unix timestamp (in seconds) when the model was created.
|
|
38
|
+
*/
|
|
39
|
+
created: number;
|
|
40
|
+
/**
|
|
41
|
+
* The object type, which is always "model".
|
|
42
|
+
*/
|
|
43
|
+
object: string;
|
|
44
|
+
/**
|
|
45
|
+
* The organization that owns the model.
|
|
46
|
+
*/
|
|
47
|
+
owned_by: string;
|
|
47
48
|
}
|
|
48
49
|
export interface ModelDeleted {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
id: string;
|
|
51
|
+
deleted: boolean;
|
|
52
|
+
object: string;
|
|
52
53
|
}
|
|
53
54
|
export declare namespace Models {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
export import Model = API.Model;
|
|
56
|
+
export import ModelDeleted = API.ModelDeleted;
|
|
57
|
+
type ModelsPage = _ModelsPage;
|
|
57
58
|
}
|
|
58
59
|
export {};
|
|
59
|
-
//# sourceMappingURL=models.d.ts.map
|
|
60
|
+
//# sourceMappingURL=models.d.ts.map
|
package/resources/models.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless.
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ModelsPage = exports.Models = void 0;
|
|
5
|
-
const resource_1 = require(
|
|
6
|
-
const pagination_1 = require(
|
|
5
|
+
const resource_1 = require("openai/resource");
|
|
6
|
+
const pagination_1 = require("openai/pagination");
|
|
7
7
|
class Models extends resource_1.APIResource {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves a model instance, providing basic information about the model such as
|
|
10
|
+
* the owner and permissioning.
|
|
11
|
+
*/
|
|
12
|
+
retrieve(model, options) {
|
|
13
|
+
return this.get(`/models/${model}`, options);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Lists the currently available models, and provides basic information about each
|
|
17
|
+
* one such as the owner and availability.
|
|
18
|
+
*/
|
|
19
|
+
list(options) {
|
|
20
|
+
return this.getAPIList('/models', ModelsPage, options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
24
|
+
* delete a model.
|
|
25
|
+
*/
|
|
26
|
+
del(model, options) {
|
|
27
|
+
return this.delete(`/models/${model}`, options);
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
30
|
exports.Models = Models;
|
|
31
31
|
/**
|
|
32
32
|
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
33
33
|
*/
|
|
34
|
-
class ModelsPage extends pagination_1.Page {
|
|
34
|
+
class ModelsPage extends pagination_1.Page {
|
|
35
|
+
}
|
|
35
36
|
exports.ModelsPage = ModelsPage;
|
|
36
|
-
(function (Models) {
|
|
37
|
-
|
|
37
|
+
(function (Models) {
|
|
38
|
+
})(Models = exports.Models || (exports.Models = {}));
|
|
39
|
+
//# sourceMappingURL=models.js.map
|
package/resources/models.mjs
CHANGED
|
@@ -2,31 +2,33 @@
|
|
|
2
2
|
import { APIResource } from 'openai/resource';
|
|
3
3
|
import { Page } from 'openai/pagination';
|
|
4
4
|
export class Models extends APIResource {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves a model instance, providing basic information about the model such as
|
|
7
|
+
* the owner and permissioning.
|
|
8
|
+
*/
|
|
9
|
+
retrieve(model, options) {
|
|
10
|
+
return this.get(`/models/${model}`, options);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Lists the currently available models, and provides basic information about each
|
|
14
|
+
* one such as the owner and availability.
|
|
15
|
+
*/
|
|
16
|
+
list(options) {
|
|
17
|
+
return this.getAPIList('/models', ModelsPage, options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
21
|
+
* delete a model.
|
|
22
|
+
*/
|
|
23
|
+
del(model, options) {
|
|
24
|
+
return this.delete(`/models/${model}`, options);
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
29
29
|
*/
|
|
30
|
-
export class ModelsPage extends Page {
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export class ModelsPage extends Page {
|
|
31
|
+
}
|
|
32
|
+
(function (Models) {
|
|
33
|
+
})(Models || (Models = {}));
|
|
34
|
+
//# sourceMappingURL=models.mjs.map
|
|
@@ -1,181 +1,178 @@
|
|
|
1
1
|
import * as Core from 'openai/core';
|
|
2
2
|
import { APIResource } from 'openai/resource';
|
|
3
|
-
import * as API from
|
|
3
|
+
import * as API from "./index.js";
|
|
4
4
|
export declare class Moderations extends APIResource {
|
|
5
|
-
/**
|
|
6
|
-
* Classifies if text violates OpenAI's Content Policy
|
|
7
|
-
*/
|
|
8
|
-
create(
|
|
9
|
-
body: ModerationCreateParams,
|
|
10
|
-
options?: Core.RequestOptions,
|
|
11
|
-
): Core.APIPromise<ModerationCreateResponse>;
|
|
12
|
-
}
|
|
13
|
-
export interface Moderation {
|
|
14
|
-
/**
|
|
15
|
-
* A list of the categories, and whether they are flagged or not.
|
|
16
|
-
*/
|
|
17
|
-
categories: Moderation.Categories;
|
|
18
|
-
/**
|
|
19
|
-
* A list of the categories along with their scores as predicted by model.
|
|
20
|
-
*/
|
|
21
|
-
category_scores: Moderation.CategoryScores;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the content violates
|
|
24
|
-
* [OpenAI's usage policies](/policies/usage-policies).
|
|
25
|
-
*/
|
|
26
|
-
flagged: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare namespace Moderation {
|
|
29
|
-
/**
|
|
30
|
-
* A list of the categories, and whether they are flagged or not.
|
|
31
|
-
*/
|
|
32
|
-
interface Categories {
|
|
33
5
|
/**
|
|
34
|
-
*
|
|
35
|
-
* target.
|
|
6
|
+
* Classifies if text violates OpenAI's Content Policy
|
|
36
7
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* target.
|
|
41
|
-
*/
|
|
42
|
-
'harassment/threatening': boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Content that expresses, incites, or promotes hate based on race, gender,
|
|
45
|
-
* ethnicity, religion, nationality, sexual orientation, disability status, or
|
|
46
|
-
* caste. Hateful content aimed at non-protected groups (e.g., chess players) is
|
|
47
|
-
* harrassment.
|
|
48
|
-
*/
|
|
49
|
-
hate: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Hateful content that also includes violence or serious harm towards the targeted
|
|
52
|
-
* group based on race, gender, ethnicity, religion, nationality, sexual
|
|
53
|
-
* orientation, disability status, or caste.
|
|
54
|
-
*/
|
|
55
|
-
'hate/threatening': boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Content that promotes, encourages, or depicts acts of self-harm, such as
|
|
58
|
-
* suicide, cutting, and eating disorders.
|
|
59
|
-
*/
|
|
60
|
-
'self-harm': boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Content that encourages performing acts of self-harm, such as suicide, cutting,
|
|
63
|
-
* and eating disorders, or that gives instructions or advice on how to commit such
|
|
64
|
-
* acts.
|
|
65
|
-
*/
|
|
66
|
-
'self-harm/instructions': boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Content where the speaker expresses that they are engaging or intend to engage
|
|
69
|
-
* in acts of self-harm, such as suicide, cutting, and eating disorders.
|
|
70
|
-
*/
|
|
71
|
-
'self-harm/intent': boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Content meant to arouse sexual excitement, such as the description of sexual
|
|
74
|
-
* activity, or that promotes sexual services (excluding sex education and
|
|
75
|
-
* wellness).
|
|
76
|
-
*/
|
|
77
|
-
sexual: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Sexual content that includes an individual who is under 18 years old.
|
|
80
|
-
*/
|
|
81
|
-
'sexual/minors': boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Content that depicts death, violence, or physical injury.
|
|
84
|
-
*/
|
|
85
|
-
violence: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Content that depicts death, violence, or physical injury in graphic detail.
|
|
88
|
-
*/
|
|
89
|
-
'violence/graphic': boolean;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* A list of the categories along with their scores as predicted by model.
|
|
93
|
-
*/
|
|
94
|
-
interface CategoryScores {
|
|
95
|
-
/**
|
|
96
|
-
* The score for the category 'harassment'.
|
|
97
|
-
*/
|
|
98
|
-
harassment: number;
|
|
99
|
-
/**
|
|
100
|
-
* The score for the category 'harassment/threatening'.
|
|
101
|
-
*/
|
|
102
|
-
'harassment/threatening': number;
|
|
8
|
+
create(body: ModerationCreateParams, options?: Core.RequestOptions): Core.APIPromise<ModerationCreateResponse>;
|
|
9
|
+
}
|
|
10
|
+
export interface Moderation {
|
|
103
11
|
/**
|
|
104
|
-
*
|
|
12
|
+
* A list of the categories, and whether they are flagged or not.
|
|
105
13
|
*/
|
|
106
|
-
|
|
14
|
+
categories: Moderation.Categories;
|
|
107
15
|
/**
|
|
108
|
-
*
|
|
16
|
+
* A list of the categories along with their scores as predicted by model.
|
|
109
17
|
*/
|
|
110
|
-
|
|
18
|
+
category_scores: Moderation.CategoryScores;
|
|
111
19
|
/**
|
|
112
|
-
*
|
|
20
|
+
* Whether the content violates
|
|
21
|
+
* [OpenAI's usage policies](/policies/usage-policies).
|
|
113
22
|
*/
|
|
114
|
-
|
|
23
|
+
flagged: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace Moderation {
|
|
115
26
|
/**
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
|
|
27
|
+
* A list of the categories, and whether they are flagged or not.
|
|
28
|
+
*/
|
|
29
|
+
interface Categories {
|
|
30
|
+
/**
|
|
31
|
+
* Content that expresses, incites, or promotes harassing language towards any
|
|
32
|
+
* target.
|
|
33
|
+
*/
|
|
34
|
+
harassment: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Harassment content that also includes violence or serious harm towards any
|
|
37
|
+
* target.
|
|
38
|
+
*/
|
|
39
|
+
'harassment/threatening': boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Content that expresses, incites, or promotes hate based on race, gender,
|
|
42
|
+
* ethnicity, religion, nationality, sexual orientation, disability status, or
|
|
43
|
+
* caste. Hateful content aimed at non-protected groups (e.g., chess players) is
|
|
44
|
+
* harrassment.
|
|
45
|
+
*/
|
|
46
|
+
hate: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Hateful content that also includes violence or serious harm towards the targeted
|
|
49
|
+
* group based on race, gender, ethnicity, religion, nationality, sexual
|
|
50
|
+
* orientation, disability status, or caste.
|
|
51
|
+
*/
|
|
52
|
+
'hate/threatening': boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Content that promotes, encourages, or depicts acts of self-harm, such as
|
|
55
|
+
* suicide, cutting, and eating disorders.
|
|
56
|
+
*/
|
|
57
|
+
'self-harm': boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Content that encourages performing acts of self-harm, such as suicide, cutting,
|
|
60
|
+
* and eating disorders, or that gives instructions or advice on how to commit such
|
|
61
|
+
* acts.
|
|
62
|
+
*/
|
|
63
|
+
'self-harm/instructions': boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Content where the speaker expresses that they are engaging or intend to engage
|
|
66
|
+
* in acts of self-harm, such as suicide, cutting, and eating disorders.
|
|
67
|
+
*/
|
|
68
|
+
'self-harm/intent': boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Content meant to arouse sexual excitement, such as the description of sexual
|
|
71
|
+
* activity, or that promotes sexual services (excluding sex education and
|
|
72
|
+
* wellness).
|
|
73
|
+
*/
|
|
74
|
+
sexual: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Sexual content that includes an individual who is under 18 years old.
|
|
77
|
+
*/
|
|
78
|
+
'sexual/minors': boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Content that depicts death, violence, or physical injury.
|
|
81
|
+
*/
|
|
82
|
+
violence: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Content that depicts death, violence, or physical injury in graphic detail.
|
|
85
|
+
*/
|
|
86
|
+
'violence/graphic': boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A list of the categories along with their scores as predicted by model.
|
|
90
|
+
*/
|
|
91
|
+
interface CategoryScores {
|
|
92
|
+
/**
|
|
93
|
+
* The score for the category 'harassment'.
|
|
94
|
+
*/
|
|
95
|
+
harassment: number;
|
|
96
|
+
/**
|
|
97
|
+
* The score for the category 'harassment/threatening'.
|
|
98
|
+
*/
|
|
99
|
+
'harassment/threatening': number;
|
|
100
|
+
/**
|
|
101
|
+
* The score for the category 'hate'.
|
|
102
|
+
*/
|
|
103
|
+
hate: number;
|
|
104
|
+
/**
|
|
105
|
+
* The score for the category 'hate/threatening'.
|
|
106
|
+
*/
|
|
107
|
+
'hate/threatening': number;
|
|
108
|
+
/**
|
|
109
|
+
* The score for the category 'self-harm'.
|
|
110
|
+
*/
|
|
111
|
+
'self-harm': number;
|
|
112
|
+
/**
|
|
113
|
+
* The score for the category 'self-harm/instructions'.
|
|
114
|
+
*/
|
|
115
|
+
'self-harm/instructions': number;
|
|
116
|
+
/**
|
|
117
|
+
* The score for the category 'self-harm/intent'.
|
|
118
|
+
*/
|
|
119
|
+
'self-harm/intent': number;
|
|
120
|
+
/**
|
|
121
|
+
* The score for the category 'sexual'.
|
|
122
|
+
*/
|
|
123
|
+
sexual: number;
|
|
124
|
+
/**
|
|
125
|
+
* The score for the category 'sexual/minors'.
|
|
126
|
+
*/
|
|
127
|
+
'sexual/minors': number;
|
|
128
|
+
/**
|
|
129
|
+
* The score for the category 'violence'.
|
|
130
|
+
*/
|
|
131
|
+
violence: number;
|
|
132
|
+
/**
|
|
133
|
+
* The score for the category 'violence/graphic'.
|
|
134
|
+
*/
|
|
135
|
+
'violence/graphic': number;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Represents policy compliance report by OpenAI's content moderation model against
|
|
140
|
+
* a given input.
|
|
141
|
+
*/
|
|
142
|
+
export interface ModerationCreateResponse {
|
|
119
143
|
/**
|
|
120
|
-
* The
|
|
144
|
+
* The unique identifier for the moderation request.
|
|
121
145
|
*/
|
|
122
|
-
|
|
146
|
+
id: string;
|
|
123
147
|
/**
|
|
124
|
-
* The
|
|
148
|
+
* The model used to generate the moderation results.
|
|
125
149
|
*/
|
|
126
|
-
|
|
150
|
+
model: string;
|
|
127
151
|
/**
|
|
128
|
-
*
|
|
152
|
+
* A list of moderation objects.
|
|
129
153
|
*/
|
|
130
|
-
|
|
154
|
+
results: Array<Moderation>;
|
|
155
|
+
}
|
|
156
|
+
export interface ModerationCreateParams {
|
|
131
157
|
/**
|
|
132
|
-
* The
|
|
158
|
+
* The input text to classify
|
|
133
159
|
*/
|
|
134
|
-
|
|
160
|
+
input: string | Array<string>;
|
|
135
161
|
/**
|
|
136
|
-
*
|
|
162
|
+
* Two content moderations models are available: `text-moderation-stable` and
|
|
163
|
+
* `text-moderation-latest`.
|
|
164
|
+
*
|
|
165
|
+
* The default is `text-moderation-latest` which will be automatically upgraded
|
|
166
|
+
* over time. This ensures you are always using our most accurate model. If you use
|
|
167
|
+
* `text-moderation-stable`, we will provide advanced notice before updating the
|
|
168
|
+
* model. Accuracy of `text-moderation-stable` may be slightly lower than for
|
|
169
|
+
* `text-moderation-latest`.
|
|
137
170
|
*/
|
|
138
|
-
'
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Represents policy compliance report by OpenAI's content moderation model against
|
|
143
|
-
* a given input.
|
|
144
|
-
*/
|
|
145
|
-
export interface ModerationCreateResponse {
|
|
146
|
-
/**
|
|
147
|
-
* The unique identifier for the moderation request.
|
|
148
|
-
*/
|
|
149
|
-
id: string;
|
|
150
|
-
/**
|
|
151
|
-
* The model used to generate the moderation results.
|
|
152
|
-
*/
|
|
153
|
-
model: string;
|
|
154
|
-
/**
|
|
155
|
-
* A list of moderation objects.
|
|
156
|
-
*/
|
|
157
|
-
results: Array<Moderation>;
|
|
158
|
-
}
|
|
159
|
-
export interface ModerationCreateParams {
|
|
160
|
-
/**
|
|
161
|
-
* The input text to classify
|
|
162
|
-
*/
|
|
163
|
-
input: string | Array<string>;
|
|
164
|
-
/**
|
|
165
|
-
* Two content moderations models are available: `text-moderation-stable` and
|
|
166
|
-
* `text-moderation-latest`.
|
|
167
|
-
*
|
|
168
|
-
* The default is `text-moderation-latest` which will be automatically upgraded
|
|
169
|
-
* over time. This ensures you are always using our most accurate model. If you use
|
|
170
|
-
* `text-moderation-stable`, we will provide advanced notice before updating the
|
|
171
|
-
* model. Accuracy of `text-moderation-stable` may be slightly lower than for
|
|
172
|
-
* `text-moderation-latest`.
|
|
173
|
-
*/
|
|
174
|
-
model?: (string & {}) | 'text-moderation-latest' | 'text-moderation-stable';
|
|
171
|
+
model?: (string & {}) | 'text-moderation-latest' | 'text-moderation-stable';
|
|
175
172
|
}
|
|
176
173
|
export declare namespace Moderations {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
export import Moderation = API.Moderation;
|
|
175
|
+
export import ModerationCreateResponse = API.ModerationCreateResponse;
|
|
176
|
+
export import ModerationCreateParams = API.ModerationCreateParams;
|
|
180
177
|
}
|
|
181
|
-
//# sourceMappingURL=moderations.d.ts.map
|
|
178
|
+
//# sourceMappingURL=moderations.d.ts.map
|
package/resources/moderations.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless.
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Moderations = void 0;
|
|
5
|
-
const resource_1 = require(
|
|
5
|
+
const resource_1 = require("openai/resource");
|
|
6
6
|
class Moderations extends resource_1.APIResource {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Classifies if text violates OpenAI's Content Policy
|
|
9
|
+
*/
|
|
10
|
+
create(body, options) {
|
|
11
|
+
return this.post('/moderations', { body, ...options });
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
14
|
exports.Moderations = Moderations;
|
|
15
|
-
(function (Moderations) {
|
|
16
|
-
|
|
15
|
+
(function (Moderations) {
|
|
16
|
+
})(Moderations = exports.Moderations || (exports.Moderations = {}));
|
|
17
|
+
//# sourceMappingURL=moderations.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
import { APIResource } from 'openai/resource';
|
|
3
3
|
export class Moderations extends APIResource {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Classifies if text violates OpenAI's Content Policy
|
|
6
|
+
*/
|
|
7
|
+
create(body, options) {
|
|
8
|
+
return this.post('/moderations', { body, ...options });
|
|
9
|
+
}
|
|
10
10
|
}
|
|
11
|
-
(function (Moderations) {
|
|
12
|
-
|
|
11
|
+
(function (Moderations) {
|
|
12
|
+
})(Moderations || (Moderations = {}));
|
|
13
|
+
//# sourceMappingURL=moderations.mjs.map
|
package/shims/node.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import * as types from "../_shims/node-types.js";
|
|
5
|
+
declare module '../_shims/manual-types' {
|
|
6
|
+
namespace manual {
|
|
7
|
+
type Agent = types.Agent;
|
|
8
|
+
export import fetch = types.fetch;
|
|
9
|
+
type Request = types.Request;
|
|
10
|
+
type RequestInfo = types.RequestInfo;
|
|
11
|
+
type RequestInit = types.RequestInit;
|
|
12
|
+
type Response = types.Response;
|
|
13
|
+
type ResponseInit = types.ResponseInit;
|
|
14
|
+
type ResponseType = types.ResponseType;
|
|
15
|
+
type BodyInit = types.BodyInit;
|
|
16
|
+
type Headers = types.Headers;
|
|
17
|
+
type HeadersInit = types.HeadersInit;
|
|
18
|
+
type BlobPropertyBag = types.BlobPropertyBag;
|
|
19
|
+
type FilePropertyBag = types.FilePropertyBag;
|
|
20
|
+
type FileFromPathOptions = types.FileFromPathOptions;
|
|
21
|
+
export import FormData = types.FormData;
|
|
22
|
+
export import File = types.File;
|
|
23
|
+
export import Blob = types.Blob;
|
|
24
|
+
type Readable = types.Readable;
|
|
25
|
+
type FsReadStream = types.FsReadStream;
|
|
26
|
+
type ReadableStream = types.ReadableStream;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACnD;CACF"}
|