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
|
@@ -2,239 +2,230 @@ import * as Core from 'openai/core';
|
|
|
2
2
|
import { APIPromise } from 'openai/core';
|
|
3
3
|
import { APIResource } from 'openai/resource';
|
|
4
4
|
import * as Completions_ from 'openai/resources/completions';
|
|
5
|
-
import * as API from
|
|
5
|
+
import * as API from "./index.js";
|
|
6
6
|
import { Stream } from 'openai/streaming';
|
|
7
7
|
export declare class Completions extends APIResource {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
body:
|
|
13
|
-
options?: Core.RequestOptions
|
|
14
|
-
): APIPromise<ChatCompletion>;
|
|
15
|
-
create(
|
|
16
|
-
body: ChatCompletionCreateParamsStreaming,
|
|
17
|
-
options?: Core.RequestOptions,
|
|
18
|
-
): APIPromise<Stream<ChatCompletionChunk>>;
|
|
19
|
-
create(
|
|
20
|
-
body: ChatCompletionCreateParamsBase,
|
|
21
|
-
options?: Core.RequestOptions,
|
|
22
|
-
): APIPromise<Stream<ChatCompletionChunk> | ChatCompletion>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a model response for the given chat conversation.
|
|
10
|
+
*/
|
|
11
|
+
create(body: ChatCompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<ChatCompletion>;
|
|
12
|
+
create(body: ChatCompletionCreateParamsStreaming, options?: Core.RequestOptions): APIPromise<Stream<ChatCompletionChunk>>;
|
|
13
|
+
create(body: ChatCompletionCreateParamsBase, options?: Core.RequestOptions): APIPromise<Stream<ChatCompletionChunk> | ChatCompletion>;
|
|
23
14
|
}
|
|
24
15
|
/**
|
|
25
16
|
* Represents a chat completion response returned by model, based on the provided
|
|
26
17
|
* input.
|
|
27
18
|
*/
|
|
28
19
|
export interface ChatCompletion {
|
|
29
|
-
/**
|
|
30
|
-
* A unique identifier for the chat completion.
|
|
31
|
-
*/
|
|
32
|
-
id: string;
|
|
33
|
-
/**
|
|
34
|
-
* A list of chat completion choices. Can be more than one if `n` is greater
|
|
35
|
-
* than 1.
|
|
36
|
-
*/
|
|
37
|
-
choices: Array<ChatCompletion.Choice>;
|
|
38
|
-
/**
|
|
39
|
-
* The Unix timestamp (in seconds) of when the chat completion was created.
|
|
40
|
-
*/
|
|
41
|
-
created: number;
|
|
42
|
-
/**
|
|
43
|
-
* The model used for the chat completion.
|
|
44
|
-
*/
|
|
45
|
-
model: string;
|
|
46
|
-
/**
|
|
47
|
-
* The object type, which is always `chat.completion`.
|
|
48
|
-
*/
|
|
49
|
-
object: string;
|
|
50
|
-
/**
|
|
51
|
-
* Usage statistics for the completion request.
|
|
52
|
-
*/
|
|
53
|
-
usage?: Completions_.CompletionUsage;
|
|
54
|
-
}
|
|
55
|
-
export declare namespace ChatCompletion {
|
|
56
|
-
interface Choice {
|
|
57
20
|
/**
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
21
|
+
* A unique identifier for the chat completion.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* A list of chat completion choices. Can be more than one if `n` is greater
|
|
26
|
+
* than 1.
|
|
27
|
+
*/
|
|
28
|
+
choices: Array<ChatCompletion.Choice>;
|
|
29
|
+
/**
|
|
30
|
+
* The Unix timestamp (in seconds) of when the chat completion was created.
|
|
62
31
|
*/
|
|
63
|
-
|
|
32
|
+
created: number;
|
|
64
33
|
/**
|
|
65
|
-
* The
|
|
34
|
+
* The model used for the chat completion.
|
|
66
35
|
*/
|
|
67
|
-
|
|
36
|
+
model: string;
|
|
68
37
|
/**
|
|
69
|
-
*
|
|
38
|
+
* The object type, which is always `chat.completion`.
|
|
70
39
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
40
|
+
object: string;
|
|
41
|
+
/**
|
|
42
|
+
* Usage statistics for the completion request.
|
|
43
|
+
*/
|
|
44
|
+
usage?: Completions_.CompletionUsage;
|
|
45
|
+
}
|
|
46
|
+
export declare namespace ChatCompletion {
|
|
47
|
+
interface Choice {
|
|
48
|
+
/**
|
|
49
|
+
* The reason the model stopped generating tokens. This will be `stop` if the model
|
|
50
|
+
* hit a natural stop point or a provided stop sequence, `length` if the maximum
|
|
51
|
+
* number of tokens specified in the request was reached, or `function_call` if the
|
|
52
|
+
* model called a function.
|
|
53
|
+
*/
|
|
54
|
+
finish_reason: 'stop' | 'length' | 'function_call';
|
|
55
|
+
/**
|
|
56
|
+
* The index of the choice in the list of choices.
|
|
57
|
+
*/
|
|
58
|
+
index: number;
|
|
59
|
+
/**
|
|
60
|
+
* A chat completion message generated by the model.
|
|
61
|
+
*/
|
|
62
|
+
message: ChatCompletionMessage;
|
|
63
|
+
}
|
|
73
64
|
}
|
|
74
65
|
/**
|
|
75
66
|
* Represents a streamed chunk of a chat completion response returned by model,
|
|
76
67
|
* based on the provided input.
|
|
77
68
|
*/
|
|
78
69
|
export interface ChatCompletionChunk {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
/**
|
|
71
|
+
* A unique identifier for the chat completion chunk.
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
/**
|
|
75
|
+
* A list of chat completion choices. Can be more than one if `n` is greater
|
|
76
|
+
* than 1.
|
|
77
|
+
*/
|
|
78
|
+
choices: Array<ChatCompletionChunk.Choice>;
|
|
79
|
+
/**
|
|
80
|
+
* The Unix timestamp (in seconds) of when the chat completion chunk was created.
|
|
81
|
+
*/
|
|
82
|
+
created: number;
|
|
83
|
+
/**
|
|
84
|
+
* The model to generate the completion.
|
|
85
|
+
*/
|
|
86
|
+
model: string;
|
|
87
|
+
/**
|
|
88
|
+
* The object type, which is always `chat.completion.chunk`.
|
|
89
|
+
*/
|
|
90
|
+
object: string;
|
|
100
91
|
}
|
|
101
92
|
export declare namespace ChatCompletionChunk {
|
|
102
|
-
|
|
93
|
+
interface Choice {
|
|
94
|
+
/**
|
|
95
|
+
* A chat completion delta generated by streamed model responses.
|
|
96
|
+
*/
|
|
97
|
+
delta: Choice.Delta;
|
|
98
|
+
/**
|
|
99
|
+
* The reason the model stopped generating tokens. This will be `stop` if the model
|
|
100
|
+
* hit a natural stop point or a provided stop sequence, `length` if the maximum
|
|
101
|
+
* number of tokens specified in the request was reached, or `function_call` if the
|
|
102
|
+
* model called a function.
|
|
103
|
+
*/
|
|
104
|
+
finish_reason: 'stop' | 'length' | 'function_call' | null;
|
|
105
|
+
/**
|
|
106
|
+
* The index of the choice in the list of choices.
|
|
107
|
+
*/
|
|
108
|
+
index: number;
|
|
109
|
+
}
|
|
110
|
+
namespace Choice {
|
|
111
|
+
/**
|
|
112
|
+
* A chat completion delta generated by streamed model responses.
|
|
113
|
+
*/
|
|
114
|
+
interface Delta {
|
|
115
|
+
/**
|
|
116
|
+
* The contents of the chunk message.
|
|
117
|
+
*/
|
|
118
|
+
content?: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
121
|
+
* model.
|
|
122
|
+
*/
|
|
123
|
+
function_call?: Delta.FunctionCall;
|
|
124
|
+
/**
|
|
125
|
+
* The role of the author of this message.
|
|
126
|
+
*/
|
|
127
|
+
role?: ChatCompletionRole;
|
|
128
|
+
}
|
|
129
|
+
namespace Delta {
|
|
130
|
+
/**
|
|
131
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
132
|
+
* model.
|
|
133
|
+
*/
|
|
134
|
+
interface FunctionCall {
|
|
135
|
+
/**
|
|
136
|
+
* The arguments to call the function with, as generated by the model in JSON
|
|
137
|
+
* format. Note that the model does not always generate valid JSON, and may
|
|
138
|
+
* hallucinate parameters not defined by your function schema. Validate the
|
|
139
|
+
* arguments in your code before calling your function.
|
|
140
|
+
*/
|
|
141
|
+
arguments?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The name of the function to call.
|
|
144
|
+
*/
|
|
145
|
+
name?: string;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A chat completion message generated by the model.
|
|
152
|
+
*/
|
|
153
|
+
export interface ChatCompletionMessage {
|
|
103
154
|
/**
|
|
104
|
-
*
|
|
155
|
+
* The contents of the message.
|
|
105
156
|
*/
|
|
106
|
-
|
|
157
|
+
content: string | null;
|
|
107
158
|
/**
|
|
108
|
-
* The
|
|
109
|
-
* hit a natural stop point or a provided stop sequence, `length` if the maximum
|
|
110
|
-
* number of tokens specified in the request was reached, or `function_call` if the
|
|
111
|
-
* model called a function.
|
|
159
|
+
* The role of the author of this message.
|
|
112
160
|
*/
|
|
113
|
-
|
|
161
|
+
role: ChatCompletionRole;
|
|
114
162
|
/**
|
|
115
|
-
* The
|
|
163
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
164
|
+
* model.
|
|
116
165
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
166
|
+
function_call?: ChatCompletionMessage.FunctionCall;
|
|
167
|
+
}
|
|
168
|
+
export declare namespace ChatCompletionMessage {
|
|
120
169
|
/**
|
|
121
|
-
*
|
|
170
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
171
|
+
* model.
|
|
122
172
|
*/
|
|
123
|
-
interface
|
|
124
|
-
/**
|
|
125
|
-
* The contents of the chunk message.
|
|
126
|
-
*/
|
|
127
|
-
content?: string | null;
|
|
128
|
-
/**
|
|
129
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
130
|
-
* model.
|
|
131
|
-
*/
|
|
132
|
-
function_call?: Delta.FunctionCall;
|
|
133
|
-
/**
|
|
134
|
-
* The role of the author of this message.
|
|
135
|
-
*/
|
|
136
|
-
role?: ChatCompletionRole;
|
|
137
|
-
}
|
|
138
|
-
namespace Delta {
|
|
139
|
-
/**
|
|
140
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
141
|
-
* model.
|
|
142
|
-
*/
|
|
143
|
-
interface FunctionCall {
|
|
173
|
+
interface FunctionCall {
|
|
144
174
|
/**
|
|
145
175
|
* The arguments to call the function with, as generated by the model in JSON
|
|
146
176
|
* format. Note that the model does not always generate valid JSON, and may
|
|
147
177
|
* hallucinate parameters not defined by your function schema. Validate the
|
|
148
178
|
* arguments in your code before calling your function.
|
|
149
179
|
*/
|
|
150
|
-
arguments
|
|
180
|
+
arguments: string;
|
|
151
181
|
/**
|
|
152
182
|
* The name of the function to call.
|
|
153
183
|
*/
|
|
154
|
-
name
|
|
155
|
-
}
|
|
184
|
+
name: string;
|
|
156
185
|
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* A chat completion message generated by the model.
|
|
161
|
-
*/
|
|
162
|
-
export interface ChatCompletionMessage {
|
|
163
|
-
/**
|
|
164
|
-
* The contents of the message.
|
|
165
|
-
*/
|
|
166
|
-
content: string | null;
|
|
167
|
-
/**
|
|
168
|
-
* The role of the author of this message.
|
|
169
|
-
*/
|
|
170
|
-
role: ChatCompletionRole;
|
|
171
|
-
/**
|
|
172
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
173
|
-
* model.
|
|
174
|
-
*/
|
|
175
|
-
function_call?: ChatCompletionMessage.FunctionCall;
|
|
176
186
|
}
|
|
177
|
-
export
|
|
178
|
-
/**
|
|
179
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
180
|
-
* model.
|
|
181
|
-
*/
|
|
182
|
-
interface FunctionCall {
|
|
187
|
+
export interface ChatCompletionMessageParam {
|
|
183
188
|
/**
|
|
184
|
-
* The
|
|
185
|
-
*
|
|
186
|
-
* hallucinate parameters not defined by your function schema. Validate the
|
|
187
|
-
* arguments in your code before calling your function.
|
|
189
|
+
* The contents of the message. `content` is required for all messages, and may be
|
|
190
|
+
* null for assistant messages with function calls.
|
|
188
191
|
*/
|
|
189
|
-
|
|
192
|
+
content: string | null;
|
|
190
193
|
/**
|
|
191
|
-
* The
|
|
194
|
+
* The role of the messages author. One of `system`, `user`, `assistant`, or
|
|
195
|
+
* `function`.
|
|
192
196
|
*/
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
export interface ChatCompletionMessageParam {
|
|
197
|
-
/**
|
|
198
|
-
* The contents of the message. `content` is required for all messages, and may be
|
|
199
|
-
* null for assistant messages with function calls.
|
|
200
|
-
*/
|
|
201
|
-
content: string | null;
|
|
202
|
-
/**
|
|
203
|
-
* The role of the messages author. One of `system`, `user`, `assistant`, or
|
|
204
|
-
* `function`.
|
|
205
|
-
*/
|
|
206
|
-
role: 'system' | 'user' | 'assistant' | 'function';
|
|
207
|
-
/**
|
|
208
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
209
|
-
* model.
|
|
210
|
-
*/
|
|
211
|
-
function_call?: ChatCompletionMessageParam.FunctionCall;
|
|
212
|
-
/**
|
|
213
|
-
* The name of the author of this message. `name` is required if role is
|
|
214
|
-
* `function`, and it should be the name of the function whose response is in the
|
|
215
|
-
* `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of
|
|
216
|
-
* 64 characters.
|
|
217
|
-
*/
|
|
218
|
-
name?: string;
|
|
219
|
-
}
|
|
220
|
-
export declare namespace ChatCompletionMessageParam {
|
|
221
|
-
/**
|
|
222
|
-
* The name and arguments of a function that should be called, as generated by the
|
|
223
|
-
* model.
|
|
224
|
-
*/
|
|
225
|
-
interface FunctionCall {
|
|
197
|
+
role: 'system' | 'user' | 'assistant' | 'function';
|
|
226
198
|
/**
|
|
227
|
-
* The arguments
|
|
228
|
-
*
|
|
229
|
-
* hallucinate parameters not defined by your function schema. Validate the
|
|
230
|
-
* arguments in your code before calling your function.
|
|
199
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
200
|
+
* model.
|
|
231
201
|
*/
|
|
232
|
-
|
|
202
|
+
function_call?: ChatCompletionMessageParam.FunctionCall;
|
|
233
203
|
/**
|
|
234
|
-
* The name of the
|
|
204
|
+
* The name of the author of this message. `name` is required if role is
|
|
205
|
+
* `function`, and it should be the name of the function whose response is in the
|
|
206
|
+
* `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of
|
|
207
|
+
* 64 characters.
|
|
235
208
|
*/
|
|
236
|
-
name
|
|
237
|
-
|
|
209
|
+
name?: string;
|
|
210
|
+
}
|
|
211
|
+
export declare namespace ChatCompletionMessageParam {
|
|
212
|
+
/**
|
|
213
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
214
|
+
* model.
|
|
215
|
+
*/
|
|
216
|
+
interface FunctionCall {
|
|
217
|
+
/**
|
|
218
|
+
* The arguments to call the function with, as generated by the model in JSON
|
|
219
|
+
* format. Note that the model does not always generate valid JSON, and may
|
|
220
|
+
* hallucinate parameters not defined by your function schema. Validate the
|
|
221
|
+
* arguments in your code before calling your function.
|
|
222
|
+
*/
|
|
223
|
+
arguments: string;
|
|
224
|
+
/**
|
|
225
|
+
* The name of the function to call.
|
|
226
|
+
*/
|
|
227
|
+
name: string;
|
|
228
|
+
}
|
|
238
229
|
}
|
|
239
230
|
/**
|
|
240
231
|
* The role of the author of this message.
|
|
@@ -244,201 +235,187 @@ export type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'function';
|
|
|
244
235
|
* @deprecated ChatCompletionMessageParam should be used instead
|
|
245
236
|
*/
|
|
246
237
|
export type CreateChatCompletionRequestMessage = ChatCompletionMessageParam;
|
|
247
|
-
export type ChatCompletionCreateParams =
|
|
248
|
-
| ChatCompletionCreateParamsNonStreaming
|
|
249
|
-
| ChatCompletionCreateParamsStreaming;
|
|
238
|
+
export type ChatCompletionCreateParams = ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming;
|
|
250
239
|
export interface ChatCompletionCreateParamsBase {
|
|
251
|
-
/**
|
|
252
|
-
* A list of messages comprising the conversation so far.
|
|
253
|
-
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
|
|
254
|
-
*/
|
|
255
|
-
messages: Array<ChatCompletionMessageParam>;
|
|
256
|
-
/**
|
|
257
|
-
* ID of the model to use. See the
|
|
258
|
-
* [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility)
|
|
259
|
-
* table for details on which models work with the Chat API.
|
|
260
|
-
*/
|
|
261
|
-
model:
|
|
262
|
-
| (string & {})
|
|
263
|
-
| 'gpt-4'
|
|
264
|
-
| 'gpt-4-0314'
|
|
265
|
-
| 'gpt-4-0613'
|
|
266
|
-
| 'gpt-4-32k'
|
|
267
|
-
| 'gpt-4-32k-0314'
|
|
268
|
-
| 'gpt-4-32k-0613'
|
|
269
|
-
| 'gpt-3.5-turbo'
|
|
270
|
-
| 'gpt-3.5-turbo-16k'
|
|
271
|
-
| 'gpt-3.5-turbo-0301'
|
|
272
|
-
| 'gpt-3.5-turbo-0613'
|
|
273
|
-
| 'gpt-3.5-turbo-16k-0613';
|
|
274
|
-
/**
|
|
275
|
-
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
276
|
-
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
277
|
-
* repeat the same line verbatim.
|
|
278
|
-
*
|
|
279
|
-
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
280
|
-
*/
|
|
281
|
-
frequency_penalty?: number | null;
|
|
282
|
-
/**
|
|
283
|
-
* Controls how the model responds to function calls. "none" means the model does
|
|
284
|
-
* not call a function, and responds to the end-user. "auto" means the model can
|
|
285
|
-
* pick between an end-user or calling a function. Specifying a particular function
|
|
286
|
-
* via `{"name": "my_function"}` forces the model to call that function. "none" is
|
|
287
|
-
* the default when no functions are present. "auto" is the default if functions
|
|
288
|
-
* are present.
|
|
289
|
-
*/
|
|
290
|
-
function_call?: 'none' | 'auto' | ChatCompletionCreateParams.FunctionCallOption;
|
|
291
|
-
/**
|
|
292
|
-
* A list of functions the model may generate JSON inputs for.
|
|
293
|
-
*/
|
|
294
|
-
functions?: Array<ChatCompletionCreateParams.Function>;
|
|
295
|
-
/**
|
|
296
|
-
* Modify the likelihood of specified tokens appearing in the completion.
|
|
297
|
-
*
|
|
298
|
-
* Accepts a json object that maps tokens (specified by their token ID in the
|
|
299
|
-
* tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
|
300
|
-
* bias is added to the logits generated by the model prior to sampling. The exact
|
|
301
|
-
* effect will vary per model, but values between -1 and 1 should decrease or
|
|
302
|
-
* increase likelihood of selection; values like -100 or 100 should result in a ban
|
|
303
|
-
* or exclusive selection of the relevant token.
|
|
304
|
-
*/
|
|
305
|
-
logit_bias?: Record<string, number> | null;
|
|
306
|
-
/**
|
|
307
|
-
* The maximum number of [tokens](/tokenizer) to generate in the chat completion.
|
|
308
|
-
*
|
|
309
|
-
* The total length of input tokens and generated tokens is limited by the model's
|
|
310
|
-
* context length.
|
|
311
|
-
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb)
|
|
312
|
-
* for counting tokens.
|
|
313
|
-
*/
|
|
314
|
-
max_tokens?: number;
|
|
315
|
-
/**
|
|
316
|
-
* How many chat completion choices to generate for each input message.
|
|
317
|
-
*/
|
|
318
|
-
n?: number | null;
|
|
319
|
-
/**
|
|
320
|
-
* Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
321
|
-
* whether they appear in the text so far, increasing the model's likelihood to
|
|
322
|
-
* talk about new topics.
|
|
323
|
-
*
|
|
324
|
-
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
325
|
-
*/
|
|
326
|
-
presence_penalty?: number | null;
|
|
327
|
-
/**
|
|
328
|
-
* Up to 4 sequences where the API will stop generating further tokens.
|
|
329
|
-
*/
|
|
330
|
-
stop?: string | null | Array<string>;
|
|
331
|
-
/**
|
|
332
|
-
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
333
|
-
* sent as data-only
|
|
334
|
-
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
|
|
335
|
-
* as they become available, with the stream terminated by a `data: [DONE]`
|
|
336
|
-
* message.
|
|
337
|
-
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb).
|
|
338
|
-
*/
|
|
339
|
-
stream?: boolean | null;
|
|
340
|
-
/**
|
|
341
|
-
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
342
|
-
* make the output more random, while lower values like 0.2 will make it more
|
|
343
|
-
* focused and deterministic.
|
|
344
|
-
*
|
|
345
|
-
* We generally recommend altering this or `top_p` but not both.
|
|
346
|
-
*/
|
|
347
|
-
temperature?: number | null;
|
|
348
|
-
/**
|
|
349
|
-
* An alternative to sampling with temperature, called nucleus sampling, where the
|
|
350
|
-
* model considers the results of the tokens with top_p probability mass. So 0.1
|
|
351
|
-
* means only the tokens comprising the top 10% probability mass are considered.
|
|
352
|
-
*
|
|
353
|
-
* We generally recommend altering this or `temperature` but not both.
|
|
354
|
-
*/
|
|
355
|
-
top_p?: number | null;
|
|
356
|
-
/**
|
|
357
|
-
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
358
|
-
* and detect abuse.
|
|
359
|
-
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
|
|
360
|
-
*/
|
|
361
|
-
user?: string;
|
|
362
|
-
}
|
|
363
|
-
export declare namespace ChatCompletionCreateParams {
|
|
364
|
-
interface FunctionCallOption {
|
|
365
240
|
/**
|
|
366
|
-
*
|
|
241
|
+
* A list of messages comprising the conversation so far.
|
|
242
|
+
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
|
|
243
|
+
*/
|
|
244
|
+
messages: Array<ChatCompletionMessageParam>;
|
|
245
|
+
/**
|
|
246
|
+
* ID of the model to use. See the
|
|
247
|
+
* [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility)
|
|
248
|
+
* table for details on which models work with the Chat API.
|
|
249
|
+
*/
|
|
250
|
+
model: (string & {}) | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-16k-0613';
|
|
251
|
+
/**
|
|
252
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
253
|
+
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
254
|
+
* repeat the same line verbatim.
|
|
255
|
+
*
|
|
256
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
257
|
+
*/
|
|
258
|
+
frequency_penalty?: number | null;
|
|
259
|
+
/**
|
|
260
|
+
* Controls how the model responds to function calls. "none" means the model does
|
|
261
|
+
* not call a function, and responds to the end-user. "auto" means the model can
|
|
262
|
+
* pick between an end-user or calling a function. Specifying a particular function
|
|
263
|
+
* via `{"name": "my_function"}` forces the model to call that function. "none" is
|
|
264
|
+
* the default when no functions are present. "auto" is the default if functions
|
|
265
|
+
* are present.
|
|
266
|
+
*/
|
|
267
|
+
function_call?: 'none' | 'auto' | ChatCompletionCreateParams.FunctionCallOption;
|
|
268
|
+
/**
|
|
269
|
+
* A list of functions the model may generate JSON inputs for.
|
|
270
|
+
*/
|
|
271
|
+
functions?: Array<ChatCompletionCreateParams.Function>;
|
|
272
|
+
/**
|
|
273
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
|
274
|
+
*
|
|
275
|
+
* Accepts a json object that maps tokens (specified by their token ID in the
|
|
276
|
+
* tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
|
277
|
+
* bias is added to the logits generated by the model prior to sampling. The exact
|
|
278
|
+
* effect will vary per model, but values between -1 and 1 should decrease or
|
|
279
|
+
* increase likelihood of selection; values like -100 or 100 should result in a ban
|
|
280
|
+
* or exclusive selection of the relevant token.
|
|
281
|
+
*/
|
|
282
|
+
logit_bias?: Record<string, number> | null;
|
|
283
|
+
/**
|
|
284
|
+
* The maximum number of [tokens](/tokenizer) to generate in the chat completion.
|
|
285
|
+
*
|
|
286
|
+
* The total length of input tokens and generated tokens is limited by the model's
|
|
287
|
+
* context length.
|
|
288
|
+
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb)
|
|
289
|
+
* for counting tokens.
|
|
367
290
|
*/
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
interface Function {
|
|
291
|
+
max_tokens?: number;
|
|
371
292
|
/**
|
|
372
|
-
*
|
|
373
|
-
* underscores and dashes, with a maximum length of 64.
|
|
293
|
+
* How many chat completion choices to generate for each input message.
|
|
374
294
|
*/
|
|
375
|
-
|
|
295
|
+
n?: number | null;
|
|
376
296
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
381
|
-
* documentation about the format.
|
|
297
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
298
|
+
* whether they appear in the text so far, increasing the model's likelihood to
|
|
299
|
+
* talk about new topics.
|
|
382
300
|
*
|
|
383
|
-
*
|
|
384
|
-
|
|
301
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
302
|
+
*/
|
|
303
|
+
presence_penalty?: number | null;
|
|
304
|
+
/**
|
|
305
|
+
* Up to 4 sequences where the API will stop generating further tokens.
|
|
385
306
|
*/
|
|
386
|
-
|
|
307
|
+
stop?: string | null | Array<string>;
|
|
387
308
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
309
|
+
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
310
|
+
* sent as data-only
|
|
311
|
+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
|
|
312
|
+
* as they become available, with the stream terminated by a `data: [DONE]`
|
|
313
|
+
* message.
|
|
314
|
+
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb).
|
|
390
315
|
*/
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
316
|
+
stream?: boolean | null;
|
|
317
|
+
/**
|
|
318
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
319
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
320
|
+
* focused and deterministic.
|
|
321
|
+
*
|
|
322
|
+
* We generally recommend altering this or `top_p` but not both.
|
|
323
|
+
*/
|
|
324
|
+
temperature?: number | null;
|
|
325
|
+
/**
|
|
326
|
+
* An alternative to sampling with temperature, called nucleus sampling, where the
|
|
327
|
+
* model considers the results of the tokens with top_p probability mass. So 0.1
|
|
328
|
+
* means only the tokens comprising the top 10% probability mass are considered.
|
|
329
|
+
*
|
|
330
|
+
* We generally recommend altering this or `temperature` but not both.
|
|
331
|
+
*/
|
|
332
|
+
top_p?: number | null;
|
|
333
|
+
/**
|
|
334
|
+
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
335
|
+
* and detect abuse.
|
|
336
|
+
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
|
|
337
|
+
*/
|
|
338
|
+
user?: string;
|
|
339
|
+
}
|
|
340
|
+
export declare namespace ChatCompletionCreateParams {
|
|
341
|
+
interface FunctionCallOption {
|
|
342
|
+
/**
|
|
343
|
+
* The name of the function to call.
|
|
344
|
+
*/
|
|
345
|
+
name: string;
|
|
346
|
+
}
|
|
347
|
+
interface Function {
|
|
348
|
+
/**
|
|
349
|
+
* The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
|
|
350
|
+
* underscores and dashes, with a maximum length of 64.
|
|
351
|
+
*/
|
|
352
|
+
name: string;
|
|
353
|
+
/**
|
|
354
|
+
* The parameters the functions accepts, described as a JSON Schema object. See the
|
|
355
|
+
* [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for
|
|
356
|
+
* examples, and the
|
|
357
|
+
* [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
358
|
+
* documentation about the format.
|
|
359
|
+
*
|
|
360
|
+
* To describe a function that accepts no parameters, provide the value
|
|
361
|
+
* `{"type": "object", "properties": {}}`.
|
|
362
|
+
*/
|
|
363
|
+
parameters: Record<string, unknown>;
|
|
364
|
+
/**
|
|
365
|
+
* A description of what the function does, used by the model to choose when and
|
|
366
|
+
* how to call the function.
|
|
367
|
+
*/
|
|
368
|
+
description?: string;
|
|
369
|
+
}
|
|
370
|
+
type ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
|
|
371
|
+
type ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
|
|
395
372
|
}
|
|
396
373
|
/**
|
|
397
374
|
* @deprecated Use ChatCompletionCreateParams instead
|
|
398
375
|
*/
|
|
399
376
|
export type CompletionCreateParams = ChatCompletionCreateParams;
|
|
400
377
|
export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
378
|
+
/**
|
|
379
|
+
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
380
|
+
* sent as data-only
|
|
381
|
+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
|
|
382
|
+
* as they become available, with the stream terminated by a `data: [DONE]`
|
|
383
|
+
* message.
|
|
384
|
+
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb).
|
|
385
|
+
*/
|
|
386
|
+
stream?: false | null;
|
|
410
387
|
}
|
|
411
388
|
/**
|
|
412
389
|
* @deprecated Use ChatCompletionCreateParamsNonStreaming instead
|
|
413
390
|
*/
|
|
414
391
|
export type CompletionCreateParamsNonStreaming = ChatCompletionCreateParamsNonStreaming;
|
|
415
392
|
export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
393
|
+
/**
|
|
394
|
+
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
395
|
+
* sent as data-only
|
|
396
|
+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
|
|
397
|
+
* as they become available, with the stream terminated by a `data: [DONE]`
|
|
398
|
+
* message.
|
|
399
|
+
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb).
|
|
400
|
+
*/
|
|
401
|
+
stream: true;
|
|
425
402
|
}
|
|
426
403
|
/**
|
|
427
404
|
* @deprecated Use ChatCompletionCreateParamsStreaming instead
|
|
428
405
|
*/
|
|
429
406
|
export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreaming;
|
|
430
407
|
export declare namespace Completions {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
408
|
+
export import ChatCompletion = API.ChatCompletion;
|
|
409
|
+
export import ChatCompletionChunk = API.ChatCompletionChunk;
|
|
410
|
+
export import ChatCompletionMessage = API.ChatCompletionMessage;
|
|
411
|
+
export import ChatCompletionMessageParam = API.ChatCompletionMessageParam;
|
|
412
|
+
export import ChatCompletionRole = API.ChatCompletionRole;
|
|
413
|
+
export import CreateChatCompletionRequestMessage = API.CreateChatCompletionRequestMessage;
|
|
414
|
+
export import ChatCompletionCreateParams = API.ChatCompletionCreateParams;
|
|
415
|
+
export import CompletionCreateParams = API.CompletionCreateParams;
|
|
416
|
+
export import ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
|
|
417
|
+
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
|
|
418
|
+
export import ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
|
|
419
|
+
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
443
420
|
}
|
|
444
|
-
//# sourceMappingURL=completions.d.ts.map
|
|
421
|
+
//# sourceMappingURL=completions.d.ts.map
|