openai 4.97.0 → 4.99.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 +29 -0
- package/index.d.mts +5 -2
- package/index.d.ts +5 -2
- package/index.d.ts.map +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/index.mjs +3 -0
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audio/speech.d.ts +12 -0
- package/resources/audio/speech.d.ts.map +1 -1
- package/resources/audio/speech.js +12 -0
- package/resources/audio/speech.js.map +1 -1
- package/resources/audio/speech.mjs +12 -0
- package/resources/audio/speech.mjs.map +1 -1
- package/resources/audio/transcriptions.d.ts +38 -0
- package/resources/audio/transcriptions.d.ts.map +1 -1
- package/resources/audio/transcriptions.js.map +1 -1
- package/resources/audio/transcriptions.mjs.map +1 -1
- package/resources/audio/translations.d.ts +8 -0
- package/resources/audio/translations.d.ts.map +1 -1
- package/resources/audio/translations.js.map +1 -1
- package/resources/audio/translations.mjs.map +1 -1
- package/resources/beta/assistants.d.ts +36 -0
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js +28 -0
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs +28 -0
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/beta/realtime/sessions.d.ts +6 -0
- package/resources/beta/realtime/sessions.d.ts.map +1 -1
- package/resources/beta/realtime/sessions.js +6 -0
- package/resources/beta/realtime/sessions.js.map +1 -1
- package/resources/beta/realtime/sessions.mjs +6 -0
- package/resources/beta/realtime/sessions.mjs.map +1 -1
- package/resources/beta/realtime/transcription-sessions.d.ts +6 -0
- package/resources/beta/realtime/transcription-sessions.d.ts.map +1 -1
- package/resources/beta/realtime/transcription-sessions.js +6 -0
- package/resources/beta/realtime/transcription-sessions.js.map +1 -1
- package/resources/beta/realtime/transcription-sessions.mjs +6 -0
- package/resources/beta/realtime/transcription-sessions.mjs.map +1 -1
- package/resources/beta/threads/messages.d.ts +43 -0
- package/resources/beta/threads/messages.d.ts.map +1 -1
- package/resources/beta/threads/messages.js +33 -0
- package/resources/beta/threads/messages.js.map +1 -1
- package/resources/beta/threads/messages.mjs +33 -0
- package/resources/beta/threads/messages.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +52 -0
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js +24 -0
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs +24 -0
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/runs/steps.d.ts +21 -0
- package/resources/beta/threads/runs/steps.d.ts.map +1 -1
- package/resources/beta/threads/runs/steps.js.map +1 -1
- package/resources/beta/threads/runs/steps.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +33 -0
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js +21 -0
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs +21 -0
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/chat/completions/completions.d.ts +38 -0
- package/resources/chat/completions/completions.d.ts.map +1 -1
- package/resources/chat/completions/completions.js +20 -0
- package/resources/chat/completions/completions.js.map +1 -1
- package/resources/chat/completions/completions.mjs +20 -0
- package/resources/chat/completions/completions.mjs.map +1 -1
- package/resources/chat/completions/messages.d.ts +10 -0
- package/resources/chat/completions/messages.d.ts.map +1 -1
- package/resources/chat/completions/messages.js.map +1 -1
- package/resources/chat/completions/messages.mjs.map +1 -1
- package/resources/completions.d.ts +8 -0
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs.map +1 -1
- package/resources/embeddings.d.ts +13 -3
- package/resources/embeddings.d.ts.map +1 -1
- package/resources/embeddings.js +9 -0
- package/resources/embeddings.js.map +1 -1
- package/resources/embeddings.mjs +9 -0
- package/resources/embeddings.mjs.map +1 -1
- package/resources/evals/evals.d.ts +164 -519
- package/resources/evals/evals.d.ts.map +1 -1
- package/resources/evals/evals.js.map +1 -1
- package/resources/evals/evals.mjs.map +1 -1
- package/resources/evals/index.d.ts +1 -1
- package/resources/evals/index.d.ts.map +1 -1
- package/resources/evals/index.js.map +1 -1
- package/resources/evals/index.mjs.map +1 -1
- package/resources/evals/runs/runs.d.ts +64 -69
- package/resources/evals/runs/runs.d.ts.map +1 -1
- package/resources/evals/runs/runs.js.map +1 -1
- package/resources/evals/runs/runs.mjs.map +1 -1
- package/resources/fine-tuning/alpha/alpha.d.ts +10 -0
- package/resources/fine-tuning/alpha/alpha.d.ts.map +1 -0
- package/resources/fine-tuning/alpha/alpha.js +39 -0
- package/resources/fine-tuning/alpha/alpha.js.map +1 -0
- package/resources/fine-tuning/alpha/alpha.mjs +12 -0
- package/resources/fine-tuning/alpha/alpha.mjs.map +1 -0
- package/resources/fine-tuning/alpha/graders.d.ts +107 -0
- package/resources/fine-tuning/alpha/graders.d.ts.map +1 -0
- package/resources/fine-tuning/alpha/graders.js +50 -0
- package/resources/fine-tuning/alpha/graders.js.map +1 -0
- package/resources/fine-tuning/alpha/graders.mjs +46 -0
- package/resources/fine-tuning/alpha/graders.mjs.map +1 -0
- package/resources/fine-tuning/alpha/index.d.ts +3 -0
- package/resources/fine-tuning/alpha/index.d.ts.map +1 -0
- package/resources/fine-tuning/alpha/index.js +9 -0
- package/resources/fine-tuning/alpha/index.js.map +1 -0
- package/resources/fine-tuning/alpha/index.mjs +4 -0
- package/resources/fine-tuning/alpha/index.mjs.map +1 -0
- package/resources/fine-tuning/alpha.d.ts +2 -0
- package/resources/fine-tuning/alpha.d.ts.map +1 -0
- package/resources/fine-tuning/alpha.js +19 -0
- package/resources/fine-tuning/alpha.js.map +1 -0
- package/resources/fine-tuning/alpha.mjs +3 -0
- package/resources/fine-tuning/alpha.mjs.map +1 -0
- package/resources/fine-tuning/checkpoints/permissions.d.ts +28 -0
- package/resources/fine-tuning/checkpoints/permissions.d.ts.map +1 -1
- package/resources/fine-tuning/checkpoints/permissions.js +20 -0
- package/resources/fine-tuning/checkpoints/permissions.js.map +1 -1
- package/resources/fine-tuning/checkpoints/permissions.mjs +20 -0
- package/resources/fine-tuning/checkpoints/permissions.mjs.map +1 -1
- package/resources/fine-tuning/fine-tuning.d.ts +8 -0
- package/resources/fine-tuning/fine-tuning.d.ts.map +1 -1
- package/resources/fine-tuning/fine-tuning.js +8 -0
- package/resources/fine-tuning/fine-tuning.js.map +1 -1
- package/resources/fine-tuning/fine-tuning.mjs +8 -0
- package/resources/fine-tuning/fine-tuning.mjs.map +1 -1
- package/resources/fine-tuning/index.d.ts +2 -0
- package/resources/fine-tuning/index.d.ts.map +1 -1
- package/resources/fine-tuning/index.js +11 -7
- package/resources/fine-tuning/index.js.map +1 -1
- package/resources/fine-tuning/index.mjs +2 -0
- package/resources/fine-tuning/index.mjs.map +1 -1
- package/resources/fine-tuning/jobs/checkpoints.d.ts +10 -0
- package/resources/fine-tuning/jobs/checkpoints.d.ts.map +1 -1
- package/resources/fine-tuning/jobs/checkpoints.js.map +1 -1
- package/resources/fine-tuning/jobs/checkpoints.mjs.map +1 -1
- package/resources/fine-tuning/jobs/jobs.d.ts +78 -145
- package/resources/fine-tuning/jobs/jobs.d.ts.map +1 -1
- package/resources/fine-tuning/jobs/jobs.js +48 -0
- package/resources/fine-tuning/jobs/jobs.js.map +1 -1
- package/resources/fine-tuning/jobs/jobs.mjs +48 -0
- package/resources/fine-tuning/jobs/jobs.mjs.map +1 -1
- package/resources/fine-tuning/methods.d.ts +120 -0
- package/resources/fine-tuning/methods.d.ts.map +1 -0
- package/resources/fine-tuning/methods.js +9 -0
- package/resources/fine-tuning/methods.js.map +1 -0
- package/resources/fine-tuning/methods.mjs +5 -0
- package/resources/fine-tuning/methods.mjs.map +1 -0
- package/resources/graders/grader-models.d.ts +234 -0
- package/resources/graders/grader-models.d.ts.map +1 -0
- package/resources/graders/grader-models.js +9 -0
- package/resources/graders/grader-models.js.map +1 -0
- package/resources/graders/grader-models.mjs +5 -0
- package/resources/graders/grader-models.mjs.map +1 -0
- package/resources/graders/graders.d.ts +10 -0
- package/resources/graders/graders.d.ts.map +1 -0
- package/resources/graders/graders.js +39 -0
- package/resources/graders/graders.js.map +1 -0
- package/resources/graders/graders.mjs +12 -0
- package/resources/graders/graders.mjs.map +1 -0
- package/resources/graders/index.d.ts +3 -0
- package/resources/graders/index.d.ts.map +1 -0
- package/resources/graders/index.js +9 -0
- package/resources/graders/index.js.map +1 -0
- package/resources/graders/index.mjs +4 -0
- package/resources/graders/index.mjs.map +1 -0
- package/resources/graders.d.ts +2 -0
- package/resources/graders.d.ts.map +1 -0
- package/resources/graders.js +19 -0
- package/resources/graders.js.map +1 -0
- package/resources/graders.mjs +3 -0
- package/resources/graders.mjs.map +1 -0
- package/resources/images.d.ts +22 -0
- package/resources/images.d.ts.map +1 -1
- package/resources/images.js +22 -0
- package/resources/images.js.map +1 -1
- package/resources/images.mjs +22 -0
- package/resources/images.mjs.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/responses/input-items.d.ts +10 -0
- package/resources/responses/input-items.d.ts.map +1 -1
- package/resources/responses/input-items.js.map +1 -1
- package/resources/responses/input-items.mjs.map +1 -1
- package/resources/responses/responses.d.ts +22 -0
- package/resources/responses/responses.d.ts.map +1 -1
- package/resources/responses/responses.js +7 -0
- package/resources/responses/responses.js.map +1 -1
- package/resources/responses/responses.mjs +7 -0
- package/resources/responses/responses.mjs.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/src/index.ts +5 -6
- package/src/resources/audio/speech.ts +12 -0
- package/src/resources/audio/transcriptions.ts +43 -0
- package/src/resources/audio/translations.ts +8 -0
- package/src/resources/beta/assistants.ts +36 -0
- package/src/resources/beta/realtime/sessions.ts +6 -0
- package/src/resources/beta/realtime/transcription-sessions.ts +6 -0
- package/src/resources/beta/threads/messages.ts +43 -0
- package/src/resources/beta/threads/runs/runs.ts +52 -0
- package/src/resources/beta/threads/runs/steps.ts +21 -0
- package/src/resources/beta/threads/threads.ts +33 -0
- package/src/resources/chat/completions/completions.ts +38 -0
- package/src/resources/chat/completions/messages.ts +10 -0
- package/src/resources/completions.ts +8 -0
- package/src/resources/embeddings.ts +13 -3
- package/src/resources/evals/evals.ts +194 -628
- package/src/resources/evals/index.ts +0 -3
- package/src/resources/evals/runs/runs.ts +69 -77
- package/src/resources/fine-tuning/alpha/alpha.ts +27 -0
- package/src/resources/fine-tuning/alpha/graders.ts +168 -0
- package/src/resources/fine-tuning/alpha/index.ts +10 -0
- package/src/resources/fine-tuning/alpha.ts +3 -0
- package/src/resources/fine-tuning/checkpoints/permissions.ts +28 -0
- package/src/resources/fine-tuning/fine-tuning.ts +28 -0
- package/src/resources/fine-tuning/index.ts +10 -0
- package/src/resources/fine-tuning/jobs/checkpoints.ts +10 -0
- package/src/resources/fine-tuning/jobs/jobs.ts +84 -161
- package/src/resources/fine-tuning/methods.ts +152 -0
- package/src/resources/graders/grader-models.ts +296 -0
- package/src/resources/graders/graders.ts +31 -0
- package/src/resources/graders/index.ts +12 -0
- package/src/resources/graders.ts +3 -0
- package/src/resources/images.ts +22 -0
- package/src/resources/index.ts +1 -3
- package/src/resources/responses/input-items.ts +10 -0
- package/src/resources/responses/responses.ts +22 -0
- package/src/resources/shared.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -10,6 +10,14 @@ import { CursorPage, type CursorPageParams } from '../../../pagination';
|
|
|
10
10
|
export class Messages extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Create a message.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const message = await client.beta.threads.messages.create(
|
|
17
|
+
* 'thread_id',
|
|
18
|
+
* { content: 'string', role: 'user' },
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
create(
|
|
15
23
|
threadId: string,
|
|
@@ -25,6 +33,14 @@ export class Messages extends APIResource {
|
|
|
25
33
|
|
|
26
34
|
/**
|
|
27
35
|
* Retrieve a message.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const message = await client.beta.threads.messages.retrieve(
|
|
40
|
+
* 'thread_id',
|
|
41
|
+
* 'message_id',
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
28
44
|
*/
|
|
29
45
|
retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise<Message> {
|
|
30
46
|
return this._client.get(`/threads/${threadId}/messages/${messageId}`, {
|
|
@@ -35,6 +51,14 @@ export class Messages extends APIResource {
|
|
|
35
51
|
|
|
36
52
|
/**
|
|
37
53
|
* Modifies a message.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const message = await client.beta.threads.messages.update(
|
|
58
|
+
* 'thread_id',
|
|
59
|
+
* 'message_id',
|
|
60
|
+
* );
|
|
61
|
+
* ```
|
|
38
62
|
*/
|
|
39
63
|
update(
|
|
40
64
|
threadId: string,
|
|
@@ -51,6 +75,16 @@ export class Messages extends APIResource {
|
|
|
51
75
|
|
|
52
76
|
/**
|
|
53
77
|
* Returns a list of messages for a given thread.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // Automatically fetches more pages as needed.
|
|
82
|
+
* for await (const message of client.beta.threads.messages.list(
|
|
83
|
+
* 'thread_id',
|
|
84
|
+
* )) {
|
|
85
|
+
* // ...
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
54
88
|
*/
|
|
55
89
|
list(
|
|
56
90
|
threadId: string,
|
|
@@ -75,6 +109,15 @@ export class Messages extends APIResource {
|
|
|
75
109
|
|
|
76
110
|
/**
|
|
77
111
|
* Deletes a message.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const messageDeleted =
|
|
116
|
+
* await client.beta.threads.messages.del(
|
|
117
|
+
* 'thread_id',
|
|
118
|
+
* 'message_id',
|
|
119
|
+
* );
|
|
120
|
+
* ```
|
|
78
121
|
*/
|
|
79
122
|
del(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise<MessageDeleted> {
|
|
80
123
|
return this._client.delete(`/threads/${threadId}/messages/${messageId}`, {
|
|
@@ -45,6 +45,14 @@ export class Runs extends APIResource {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Create a run.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const run = await client.beta.threads.runs.create(
|
|
52
|
+
* 'thread_id',
|
|
53
|
+
* { assistant_id: 'assistant_id' },
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
48
56
|
*/
|
|
49
57
|
create(
|
|
50
58
|
threadId: string,
|
|
@@ -78,6 +86,14 @@ export class Runs extends APIResource {
|
|
|
78
86
|
|
|
79
87
|
/**
|
|
80
88
|
* Retrieves a run.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const run = await client.beta.threads.runs.retrieve(
|
|
93
|
+
* 'thread_id',
|
|
94
|
+
* 'run_id',
|
|
95
|
+
* );
|
|
96
|
+
* ```
|
|
81
97
|
*/
|
|
82
98
|
retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise<Run> {
|
|
83
99
|
return this._client.get(`/threads/${threadId}/runs/${runId}`, {
|
|
@@ -88,6 +104,14 @@ export class Runs extends APIResource {
|
|
|
88
104
|
|
|
89
105
|
/**
|
|
90
106
|
* Modifies a run.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const run = await client.beta.threads.runs.update(
|
|
111
|
+
* 'thread_id',
|
|
112
|
+
* 'run_id',
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
91
115
|
*/
|
|
92
116
|
update(
|
|
93
117
|
threadId: string,
|
|
@@ -104,6 +128,16 @@ export class Runs extends APIResource {
|
|
|
104
128
|
|
|
105
129
|
/**
|
|
106
130
|
* Returns a list of runs belonging to a thread.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* // Automatically fetches more pages as needed.
|
|
135
|
+
* for await (const run of client.beta.threads.runs.list(
|
|
136
|
+
* 'thread_id',
|
|
137
|
+
* )) {
|
|
138
|
+
* // ...
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
107
141
|
*/
|
|
108
142
|
list(
|
|
109
143
|
threadId: string,
|
|
@@ -128,6 +162,14 @@ export class Runs extends APIResource {
|
|
|
128
162
|
|
|
129
163
|
/**
|
|
130
164
|
* Cancels a run that is `in_progress`.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const run = await client.beta.threads.runs.cancel(
|
|
169
|
+
* 'thread_id',
|
|
170
|
+
* 'run_id',
|
|
171
|
+
* );
|
|
172
|
+
* ```
|
|
131
173
|
*/
|
|
132
174
|
cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise<Run> {
|
|
133
175
|
return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, {
|
|
@@ -229,6 +271,16 @@ export class Runs extends APIResource {
|
|
|
229
271
|
* `submit_tool_outputs`, this endpoint can be used to submit the outputs from the
|
|
230
272
|
* tool calls once they're all completed. All outputs must be submitted in a single
|
|
231
273
|
* request.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const run =
|
|
278
|
+
* await client.beta.threads.runs.submitToolOutputs(
|
|
279
|
+
* 'thread_id',
|
|
280
|
+
* 'run_id',
|
|
281
|
+
* { tool_outputs: [{}] },
|
|
282
|
+
* );
|
|
283
|
+
* ```
|
|
232
284
|
*/
|
|
233
285
|
submitToolOutputs(
|
|
234
286
|
threadId: string,
|
|
@@ -10,6 +10,16 @@ import { CursorPage, type CursorPageParams } from '../../../../pagination';
|
|
|
10
10
|
export class Steps extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves a run step.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const runStep =
|
|
17
|
+
* await client.beta.threads.runs.steps.retrieve(
|
|
18
|
+
* 'thread_id',
|
|
19
|
+
* 'run_id',
|
|
20
|
+
* 'step_id',
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
13
23
|
*/
|
|
14
24
|
retrieve(
|
|
15
25
|
threadId: string,
|
|
@@ -43,6 +53,17 @@ export class Steps extends APIResource {
|
|
|
43
53
|
|
|
44
54
|
/**
|
|
45
55
|
* Returns a list of run steps belonging to a run.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // Automatically fetches more pages as needed.
|
|
60
|
+
* for await (const runStep of client.beta.threads.runs.steps.list(
|
|
61
|
+
* 'thread_id',
|
|
62
|
+
* 'run_id',
|
|
63
|
+
* )) {
|
|
64
|
+
* // ...
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
46
67
|
*/
|
|
47
68
|
list(
|
|
48
69
|
threadId: string,
|
|
@@ -73,6 +73,11 @@ export class Threads extends APIResource {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Create a thread.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const thread = await client.beta.threads.create();
|
|
80
|
+
* ```
|
|
76
81
|
*/
|
|
77
82
|
create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise<Thread>;
|
|
78
83
|
create(options?: Core.RequestOptions): Core.APIPromise<Thread>;
|
|
@@ -92,6 +97,13 @@ export class Threads extends APIResource {
|
|
|
92
97
|
|
|
93
98
|
/**
|
|
94
99
|
* Retrieves a thread.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const thread = await client.beta.threads.retrieve(
|
|
104
|
+
* 'thread_id',
|
|
105
|
+
* );
|
|
106
|
+
* ```
|
|
95
107
|
*/
|
|
96
108
|
retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise<Thread> {
|
|
97
109
|
return this._client.get(`/threads/${threadId}`, {
|
|
@@ -102,6 +114,13 @@ export class Threads extends APIResource {
|
|
|
102
114
|
|
|
103
115
|
/**
|
|
104
116
|
* Modifies a thread.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const thread = await client.beta.threads.update(
|
|
121
|
+
* 'thread_id',
|
|
122
|
+
* );
|
|
123
|
+
* ```
|
|
105
124
|
*/
|
|
106
125
|
update(threadId: string, body: ThreadUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Thread> {
|
|
107
126
|
return this._client.post(`/threads/${threadId}`, {
|
|
@@ -113,6 +132,13 @@ export class Threads extends APIResource {
|
|
|
113
132
|
|
|
114
133
|
/**
|
|
115
134
|
* Delete a thread.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* const threadDeleted = await client.beta.threads.del(
|
|
139
|
+
* 'thread_id',
|
|
140
|
+
* );
|
|
141
|
+
* ```
|
|
116
142
|
*/
|
|
117
143
|
del(threadId: string, options?: Core.RequestOptions): Core.APIPromise<ThreadDeleted> {
|
|
118
144
|
return this._client.delete(`/threads/${threadId}`, {
|
|
@@ -123,6 +149,13 @@ export class Threads extends APIResource {
|
|
|
123
149
|
|
|
124
150
|
/**
|
|
125
151
|
* Create a thread and run it in one request.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const run = await client.beta.threads.createAndRun({
|
|
156
|
+
* assistant_id: 'assistant_id',
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
126
159
|
*/
|
|
127
160
|
createAndRun(
|
|
128
161
|
body: ThreadCreateAndRunParamsNonStreaming,
|
|
@@ -33,6 +33,16 @@ export class Completions extends APIResource {
|
|
|
33
33
|
* supported for reasoning models are noted below. For the current state of
|
|
34
34
|
* unsupported parameters in reasoning models,
|
|
35
35
|
* [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const chatCompletion = await client.chat.completions.create(
|
|
40
|
+
* {
|
|
41
|
+
* messages: [{ content: 'string', role: 'developer' }],
|
|
42
|
+
* model: 'gpt-4o',
|
|
43
|
+
* },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
36
46
|
*/
|
|
37
47
|
create(
|
|
38
48
|
body: ChatCompletionCreateParamsNonStreaming,
|
|
@@ -58,6 +68,12 @@ export class Completions extends APIResource {
|
|
|
58
68
|
/**
|
|
59
69
|
* Get a stored chat completion. Only Chat Completions that have been created with
|
|
60
70
|
* the `store` parameter set to `true` will be returned.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const chatCompletion =
|
|
75
|
+
* await client.chat.completions.retrieve('completion_id');
|
|
76
|
+
* ```
|
|
61
77
|
*/
|
|
62
78
|
retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise<ChatCompletion> {
|
|
63
79
|
return this._client.get(`/chat/completions/${completionId}`, options);
|
|
@@ -67,6 +83,14 @@ export class Completions extends APIResource {
|
|
|
67
83
|
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
68
84
|
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
69
85
|
* supported modification is to update the `metadata` field.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const chatCompletion = await client.chat.completions.update(
|
|
90
|
+
* 'completion_id',
|
|
91
|
+
* { metadata: { foo: 'string' } },
|
|
92
|
+
* );
|
|
93
|
+
* ```
|
|
70
94
|
*/
|
|
71
95
|
update(
|
|
72
96
|
completionId: string,
|
|
@@ -79,6 +103,14 @@ export class Completions extends APIResource {
|
|
|
79
103
|
/**
|
|
80
104
|
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
81
105
|
* the `store` parameter set to `true` will be returned.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* // Automatically fetches more pages as needed.
|
|
110
|
+
* for await (const chatCompletion of client.chat.completions.list()) {
|
|
111
|
+
* // ...
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
82
114
|
*/
|
|
83
115
|
list(
|
|
84
116
|
query?: ChatCompletionListParams,
|
|
@@ -98,6 +130,12 @@ export class Completions extends APIResource {
|
|
|
98
130
|
/**
|
|
99
131
|
* Delete a stored chat completion. Only Chat Completions that have been created
|
|
100
132
|
* with the `store` parameter set to `true` can be deleted.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const chatCompletionDeleted =
|
|
137
|
+
* await client.chat.completions.del('completion_id');
|
|
138
|
+
* ```
|
|
101
139
|
*/
|
|
102
140
|
del(completionId: string, options?: Core.RequestOptions): Core.APIPromise<ChatCompletionDeleted> {
|
|
103
141
|
return this._client.delete(`/chat/completions/${completionId}`, options);
|
|
@@ -11,6 +11,16 @@ export class Messages extends APIResource {
|
|
|
11
11
|
/**
|
|
12
12
|
* Get the messages in a stored chat completion. Only Chat Completions that have
|
|
13
13
|
* been created with the `store` parameter set to `true` will be returned.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // Automatically fetches more pages as needed.
|
|
18
|
+
* for await (const chatCompletionStoreMessage of client.chat.completions.messages.list(
|
|
19
|
+
* 'completion_id',
|
|
20
|
+
* )) {
|
|
21
|
+
* // ...
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
14
24
|
*/
|
|
15
25
|
list(
|
|
16
26
|
completionId: string,
|
|
@@ -10,6 +10,14 @@ import { Stream } from '../streaming';
|
|
|
10
10
|
export class Completions extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Creates a completion for the provided prompt and parameters.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const completion = await client.completions.create({
|
|
17
|
+
* model: 'string',
|
|
18
|
+
* prompt: 'This is a test.',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>;
|
|
15
23
|
create(
|
|
@@ -6,6 +6,15 @@ import * as Core from '../core';
|
|
|
6
6
|
export class Embeddings extends APIResource {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an embedding vector representing the input text.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const createEmbeddingResponse =
|
|
13
|
+
* await client.embeddings.create({
|
|
14
|
+
* input: 'The quick brown fox jumped over the lazy dog',
|
|
15
|
+
* model: 'text-embedding-3-small',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
9
18
|
*/
|
|
10
19
|
create(
|
|
11
20
|
body: EmbeddingCreateParams,
|
|
@@ -121,11 +130,12 @@ export interface EmbeddingCreateParams {
|
|
|
121
130
|
* Input text to embed, encoded as a string or array of tokens. To embed multiple
|
|
122
131
|
* inputs in a single request, pass an array of strings or array of token arrays.
|
|
123
132
|
* The input must not exceed the max input tokens for the model (8192 tokens for
|
|
124
|
-
*
|
|
133
|
+
* all embedding models), cannot be an empty string, and any array must be 2048
|
|
125
134
|
* dimensions or less.
|
|
126
135
|
* [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
|
|
127
|
-
* for counting tokens.
|
|
128
|
-
* tokens summed across inputs
|
|
136
|
+
* for counting tokens. In addition to the per-input token limit, all embedding
|
|
137
|
+
* models enforce a maximum of 300,000 tokens summed across all inputs in a single
|
|
138
|
+
* request.
|
|
129
139
|
*/
|
|
130
140
|
input: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
131
141
|
|