openai 4.30.0 → 4.32.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 +37 -0
- package/README.md +21 -4
- package/lib/AssistantStream.js +1 -1
- package/lib/AssistantStream.js.map +1 -1
- package/lib/AssistantStream.mjs +1 -1
- package/lib/AssistantStream.mjs.map +1 -1
- package/package.json +1 -2
- package/resources/beta/beta.d.ts +1 -0
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/threads/index.d.ts +2 -2
- package/resources/beta/threads/index.d.ts.map +1 -1
- package/resources/beta/threads/index.js.map +1 -1
- package/resources/beta/threads/index.mjs.map +1 -1
- package/resources/beta/threads/messages/messages.d.ts +14 -6
- package/resources/beta/threads/messages/messages.d.ts.map +1 -1
- package/resources/beta/threads/messages/messages.js.map +1 -1
- package/resources/beta/threads/messages/messages.mjs.map +1 -1
- package/resources/beta/threads/runs/index.d.ts +1 -1
- package/resources/beta/threads/runs/index.d.ts.map +1 -1
- package/resources/beta/threads/runs/index.js.map +1 -1
- package/resources/beta/threads/runs/index.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +160 -1
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js +74 -1
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs +74 -1
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +137 -9
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js +9 -0
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs +9 -0
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/src/lib/AssistantStream.ts +1 -1
- package/src/resources/beta/beta.ts +1 -0
- package/src/resources/beta/index.ts +1 -0
- package/src/resources/beta/threads/index.ts +4 -0
- package/src/resources/beta/threads/messages/messages.ts +15 -6
- package/src/resources/beta/threads/runs/index.ts +3 -0
- package/src/resources/beta/threads/runs/runs.ts +242 -1
- package/src/resources/beta/threads/threads.ts +159 -9
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -5,6 +5,7 @@ import { APIPromise } from "../../../../core";
|
|
|
5
5
|
import { APIResource } from "../../../../resource";
|
|
6
6
|
import { isRequestOptions } from "../../../../core";
|
|
7
7
|
import { AssistantStream, RunCreateParamsBaseStream } from "../../../../lib/AssistantStream";
|
|
8
|
+
import { sleep } from "../../../../core";
|
|
8
9
|
import { RunSubmitToolOutputsParamsStream } from "../../../../lib/AssistantStream";
|
|
9
10
|
import * as RunsAPI from "./runs";
|
|
10
11
|
import * as AssistantsAPI from "../../assistants/assistants";
|
|
@@ -102,8 +103,24 @@ export class Runs extends APIResource {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
/**
|
|
107
|
+
* A helper to create a run an poll for a terminal state. More information on Run
|
|
108
|
+
* lifecycles can be found here:
|
|
109
|
+
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
|
110
|
+
*/
|
|
111
|
+
async createAndPoll(
|
|
112
|
+
threadId: string,
|
|
113
|
+
body: RunCreateParamsNonStreaming,
|
|
114
|
+
options?: Core.RequestOptions & { pollIntervalMs?: number },
|
|
115
|
+
): Promise<Run> {
|
|
116
|
+
const run = await this.create(threadId, body, options);
|
|
117
|
+
return await this.poll(threadId, run.id, options);
|
|
118
|
+
}
|
|
119
|
+
|
|
105
120
|
/**
|
|
106
121
|
* Create a Run stream
|
|
122
|
+
*
|
|
123
|
+
* @deprecated use `stream` instead
|
|
107
124
|
*/
|
|
108
125
|
createAndStream(
|
|
109
126
|
threadId: string,
|
|
@@ -113,6 +130,66 @@ export class Runs extends APIResource {
|
|
|
113
130
|
return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
|
114
131
|
}
|
|
115
132
|
|
|
133
|
+
/**
|
|
134
|
+
* A helper to poll a run status until it reaches a terminal state. More
|
|
135
|
+
* information on Run lifecycles can be found here:
|
|
136
|
+
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
|
137
|
+
*/
|
|
138
|
+
async poll(
|
|
139
|
+
threadId: string,
|
|
140
|
+
runId: string,
|
|
141
|
+
options?: Core.RequestOptions & { pollIntervalMs?: number },
|
|
142
|
+
): Promise<Run> {
|
|
143
|
+
const headers: { [key: string]: string } = { ...options?.headers, 'X-Stainless-Poll-Helper': 'true' };
|
|
144
|
+
|
|
145
|
+
if (options?.pollIntervalMs) {
|
|
146
|
+
headers['X-Stainless-Custom-Poll-Interval'] = options.pollIntervalMs.toString();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
while (true) {
|
|
150
|
+
const { data: run, response } = await this.retrieve(threadId, runId, {
|
|
151
|
+
...options,
|
|
152
|
+
headers: { ...options?.headers, ...headers },
|
|
153
|
+
}).withResponse();
|
|
154
|
+
|
|
155
|
+
switch (run.status) {
|
|
156
|
+
//If we are in any sort of intermediate state we poll
|
|
157
|
+
case 'queued':
|
|
158
|
+
case 'in_progress':
|
|
159
|
+
case 'cancelling':
|
|
160
|
+
let sleepInterval = 5000;
|
|
161
|
+
|
|
162
|
+
if (options?.pollIntervalMs) {
|
|
163
|
+
sleepInterval = options.pollIntervalMs;
|
|
164
|
+
} else {
|
|
165
|
+
const headerInterval = response.headers.get('openai-poll-after-ms');
|
|
166
|
+
if (headerInterval) {
|
|
167
|
+
const headerIntervalMs = parseInt(headerInterval);
|
|
168
|
+
if (!isNaN(headerIntervalMs)) {
|
|
169
|
+
sleepInterval = headerIntervalMs;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
await sleep(sleepInterval);
|
|
174
|
+
break;
|
|
175
|
+
//We return the run in any terminal state.
|
|
176
|
+
case 'requires_action':
|
|
177
|
+
case 'cancelled':
|
|
178
|
+
case 'completed':
|
|
179
|
+
case 'failed':
|
|
180
|
+
case 'expired':
|
|
181
|
+
return run;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Create a Run stream
|
|
188
|
+
*/
|
|
189
|
+
stream(threadId: string, body: RunCreateParamsBaseStream, options?: Core.RequestOptions): AssistantStream {
|
|
190
|
+
return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
|
191
|
+
}
|
|
192
|
+
|
|
116
193
|
/**
|
|
117
194
|
* When a run has the `status: "requires_action"` and `required_action.type` is
|
|
118
195
|
* `submit_tool_outputs`, this endpoint can be used to submit the outputs from the
|
|
@@ -151,9 +228,25 @@ export class Runs extends APIResource {
|
|
|
151
228
|
}) as APIPromise<Run> | APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
|
152
229
|
}
|
|
153
230
|
|
|
231
|
+
/**
|
|
232
|
+
* A helper to submit a tool output to a run and poll for a terminal run state.
|
|
233
|
+
* More information on Run lifecycles can be found here:
|
|
234
|
+
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
|
235
|
+
*/
|
|
236
|
+
async submitToolOutputsAndPoll(
|
|
237
|
+
threadId: string,
|
|
238
|
+
runId: string,
|
|
239
|
+
body: RunSubmitToolOutputsParamsNonStreaming,
|
|
240
|
+
options?: Core.RequestOptions & { pollIntervalMs?: number },
|
|
241
|
+
): Promise<Run> {
|
|
242
|
+
const run = await this.submitToolOutputs(threadId, runId, body, options);
|
|
243
|
+
return await this.poll(threadId, run.id, options);
|
|
244
|
+
}
|
|
245
|
+
|
|
154
246
|
/**
|
|
155
247
|
* Submit the tool outputs from a previous run and stream the run to a terminal
|
|
156
|
-
* state.
|
|
248
|
+
* state. More information on Run lifecycles can be found here:
|
|
249
|
+
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
|
157
250
|
*/
|
|
158
251
|
submitToolOutputsStream(
|
|
159
252
|
threadId: string,
|
|
@@ -331,6 +424,11 @@ export interface Run {
|
|
|
331
424
|
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
|
|
332
425
|
*/
|
|
333
426
|
usage: Run.Usage | null;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The sampling temperature used for this run. If not set, defaults to 1.
|
|
430
|
+
*/
|
|
431
|
+
temperature?: number | null;
|
|
334
432
|
}
|
|
335
433
|
|
|
336
434
|
export namespace Run {
|
|
@@ -461,6 +559,13 @@ export interface RunCreateParamsBase {
|
|
|
461
559
|
*/
|
|
462
560
|
stream?: boolean | null;
|
|
463
561
|
|
|
562
|
+
/**
|
|
563
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
564
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
565
|
+
* focused and deterministic.
|
|
566
|
+
*/
|
|
567
|
+
temperature?: number | null;
|
|
568
|
+
|
|
464
569
|
/**
|
|
465
570
|
* Override the tools the assistant can use for this run. This is useful for
|
|
466
571
|
* modifying the behavior on a per-run basis.
|
|
@@ -517,6 +622,58 @@ export interface RunListParams extends CursorPageParams {
|
|
|
517
622
|
order?: 'asc' | 'desc';
|
|
518
623
|
}
|
|
519
624
|
|
|
625
|
+
export interface RunCreateAndPollParams {
|
|
626
|
+
/**
|
|
627
|
+
* The ID of the
|
|
628
|
+
* [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
|
|
629
|
+
* execute this run.
|
|
630
|
+
*/
|
|
631
|
+
assistant_id: string;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Appends additional instructions at the end of the instructions for the run. This
|
|
635
|
+
* is useful for modifying the behavior on a per-run basis without overriding other
|
|
636
|
+
* instructions.
|
|
637
|
+
*/
|
|
638
|
+
additional_instructions?: string | null;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Overrides the
|
|
642
|
+
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
|
|
643
|
+
* of the assistant. This is useful for modifying the behavior on a per-run basis.
|
|
644
|
+
*/
|
|
645
|
+
instructions?: string | null;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
649
|
+
* for storing additional information about the object in a structured format. Keys
|
|
650
|
+
* can be a maximum of 64 characters long and values can be a maxium of 512
|
|
651
|
+
* characters long.
|
|
652
|
+
*/
|
|
653
|
+
metadata?: unknown | null;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
|
|
657
|
+
* be used to execute this run. If a value is provided here, it will override the
|
|
658
|
+
* model associated with the assistant. If not, the model associated with the
|
|
659
|
+
* assistant will be used.
|
|
660
|
+
*/
|
|
661
|
+
model?: string | null;
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
665
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
666
|
+
* focused and deterministic.
|
|
667
|
+
*/
|
|
668
|
+
temperature?: number | null;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Override the tools the assistant can use for this run. This is useful for
|
|
672
|
+
* modifying the behavior on a per-run basis.
|
|
673
|
+
*/
|
|
674
|
+
tools?: Array<AssistantsAPI.AssistantTool> | null;
|
|
675
|
+
}
|
|
676
|
+
|
|
520
677
|
export interface RunCreateAndStreamParams {
|
|
521
678
|
/**
|
|
522
679
|
* The ID of the
|
|
@@ -555,6 +712,65 @@ export interface RunCreateAndStreamParams {
|
|
|
555
712
|
*/
|
|
556
713
|
model?: string | null;
|
|
557
714
|
|
|
715
|
+
/**
|
|
716
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
717
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
718
|
+
* focused and deterministic.
|
|
719
|
+
*/
|
|
720
|
+
temperature?: number | null;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Override the tools the assistant can use for this run. This is useful for
|
|
724
|
+
* modifying the behavior on a per-run basis.
|
|
725
|
+
*/
|
|
726
|
+
tools?: Array<AssistantsAPI.AssistantTool> | null;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface RunStreamParams {
|
|
730
|
+
/**
|
|
731
|
+
* The ID of the
|
|
732
|
+
* [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
|
|
733
|
+
* execute this run.
|
|
734
|
+
*/
|
|
735
|
+
assistant_id: string;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Appends additional instructions at the end of the instructions for the run. This
|
|
739
|
+
* is useful for modifying the behavior on a per-run basis without overriding other
|
|
740
|
+
* instructions.
|
|
741
|
+
*/
|
|
742
|
+
additional_instructions?: string | null;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Overrides the
|
|
746
|
+
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
|
|
747
|
+
* of the assistant. This is useful for modifying the behavior on a per-run basis.
|
|
748
|
+
*/
|
|
749
|
+
instructions?: string | null;
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
753
|
+
* for storing additional information about the object in a structured format. Keys
|
|
754
|
+
* can be a maximum of 64 characters long and values can be a maxium of 512
|
|
755
|
+
* characters long.
|
|
756
|
+
*/
|
|
757
|
+
metadata?: unknown | null;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
|
|
761
|
+
* be used to execute this run. If a value is provided here, it will override the
|
|
762
|
+
* model associated with the assistant. If not, the model associated with the
|
|
763
|
+
* assistant will be used.
|
|
764
|
+
*/
|
|
765
|
+
model?: string | null;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
769
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
770
|
+
* focused and deterministic.
|
|
771
|
+
*/
|
|
772
|
+
temperature?: number | null;
|
|
773
|
+
|
|
558
774
|
/**
|
|
559
775
|
* Override the tools the assistant can use for this run. This is useful for
|
|
560
776
|
* modifying the behavior on a per-run basis.
|
|
@@ -616,6 +832,28 @@ export interface RunSubmitToolOutputsParamsStreaming extends RunSubmitToolOutput
|
|
|
616
832
|
stream: true;
|
|
617
833
|
}
|
|
618
834
|
|
|
835
|
+
export interface RunSubmitToolOutputsAndPollParams {
|
|
836
|
+
/**
|
|
837
|
+
* A list of tools for which the outputs are being submitted.
|
|
838
|
+
*/
|
|
839
|
+
tool_outputs: Array<RunSubmitToolOutputsAndPollParams.ToolOutput>;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export namespace RunSubmitToolOutputsAndPollParams {
|
|
843
|
+
export interface ToolOutput {
|
|
844
|
+
/**
|
|
845
|
+
* The output of the tool call to be submitted to continue the run.
|
|
846
|
+
*/
|
|
847
|
+
output?: string;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* The ID of the tool call in the `required_action` object within the run object
|
|
851
|
+
* the output is being submitted for.
|
|
852
|
+
*/
|
|
853
|
+
tool_call_id?: string;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
619
857
|
export interface RunSubmitToolOutputsStreamParams {
|
|
620
858
|
/**
|
|
621
859
|
* A list of tools for which the outputs are being submitted.
|
|
@@ -648,10 +886,13 @@ export namespace Runs {
|
|
|
648
886
|
export import RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming;
|
|
649
887
|
export import RunUpdateParams = RunsAPI.RunUpdateParams;
|
|
650
888
|
export import RunListParams = RunsAPI.RunListParams;
|
|
889
|
+
export import RunCreateAndPollParams = RunsAPI.RunCreateAndPollParams;
|
|
651
890
|
export import RunCreateAndStreamParams = RunsAPI.RunCreateAndStreamParams;
|
|
891
|
+
export import RunStreamParams = RunsAPI.RunStreamParams;
|
|
652
892
|
export import RunSubmitToolOutputsParams = RunsAPI.RunSubmitToolOutputsParams;
|
|
653
893
|
export import RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming;
|
|
654
894
|
export import RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming;
|
|
895
|
+
export import RunSubmitToolOutputsAndPollParams = RunsAPI.RunSubmitToolOutputsAndPollParams;
|
|
655
896
|
export import RunSubmitToolOutputsStreamParams = RunsAPI.RunSubmitToolOutputsStreamParams;
|
|
656
897
|
export import Steps = StepsAPI.Steps;
|
|
657
898
|
export import CodeInterpreterLogs = StepsAPI.CodeInterpreterLogs;
|
|
@@ -92,6 +92,19 @@ export class Threads extends APIResource {
|
|
|
92
92
|
}) as APIPromise<RunsAPI.Run> | APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* A helper to create a thread, start a run and then poll for a terminal state.
|
|
97
|
+
* More information on Run lifecycles can be found here:
|
|
98
|
+
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
|
99
|
+
*/
|
|
100
|
+
async createAndRunPoll(
|
|
101
|
+
body: ThreadCreateAndRunParamsNonStreaming,
|
|
102
|
+
options?: Core.RequestOptions & { pollIntervalMs?: number },
|
|
103
|
+
): Promise<Threads.Run> {
|
|
104
|
+
const run = await this.createAndRun(body, options);
|
|
105
|
+
return await this.runs.poll(run.thread_id, run.id, options);
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
/**
|
|
96
109
|
* Create a thread and stream the run back
|
|
97
110
|
*/
|
|
@@ -164,10 +177,14 @@ export namespace ThreadCreateParams {
|
|
|
164
177
|
content: string;
|
|
165
178
|
|
|
166
179
|
/**
|
|
167
|
-
* The role of the entity that is creating the message.
|
|
168
|
-
*
|
|
180
|
+
* The role of the entity that is creating the message. Allowed values include:
|
|
181
|
+
*
|
|
182
|
+
* - `user`: Indicates the message is sent by an actual user and should be used in
|
|
183
|
+
* most cases to represent user-generated messages.
|
|
184
|
+
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
|
185
|
+
* value to insert messages from the assistant into the conversation.
|
|
169
186
|
*/
|
|
170
|
-
role: 'user';
|
|
187
|
+
role: 'user' | 'assistant';
|
|
171
188
|
|
|
172
189
|
/**
|
|
173
190
|
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
|
|
@@ -238,6 +255,13 @@ export interface ThreadCreateAndRunParamsBase {
|
|
|
238
255
|
*/
|
|
239
256
|
stream?: boolean | null;
|
|
240
257
|
|
|
258
|
+
/**
|
|
259
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
260
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
261
|
+
* focused and deterministic.
|
|
262
|
+
*/
|
|
263
|
+
temperature?: number | null;
|
|
264
|
+
|
|
241
265
|
/**
|
|
242
266
|
* If no thread is provided, an empty thread will be created.
|
|
243
267
|
*/
|
|
@@ -280,10 +304,14 @@ export namespace ThreadCreateAndRunParams {
|
|
|
280
304
|
content: string;
|
|
281
305
|
|
|
282
306
|
/**
|
|
283
|
-
* The role of the entity that is creating the message.
|
|
284
|
-
*
|
|
307
|
+
* The role of the entity that is creating the message. Allowed values include:
|
|
308
|
+
*
|
|
309
|
+
* - `user`: Indicates the message is sent by an actual user and should be used in
|
|
310
|
+
* most cases to represent user-generated messages.
|
|
311
|
+
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
|
312
|
+
* value to insert messages from the assistant into the conversation.
|
|
285
313
|
*/
|
|
286
|
-
role: 'user';
|
|
314
|
+
role: 'user' | 'assistant';
|
|
287
315
|
|
|
288
316
|
/**
|
|
289
317
|
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
|
|
@@ -325,6 +353,113 @@ export interface ThreadCreateAndRunParamsStreaming extends ThreadCreateAndRunPar
|
|
|
325
353
|
stream: true;
|
|
326
354
|
}
|
|
327
355
|
|
|
356
|
+
export interface ThreadCreateAndRunPollParams {
|
|
357
|
+
/**
|
|
358
|
+
* The ID of the
|
|
359
|
+
* [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
|
|
360
|
+
* execute this run.
|
|
361
|
+
*/
|
|
362
|
+
assistant_id: string;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Override the default system message of the assistant. This is useful for
|
|
366
|
+
* modifying the behavior on a per-run basis.
|
|
367
|
+
*/
|
|
368
|
+
instructions?: string | null;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
372
|
+
* for storing additional information about the object in a structured format. Keys
|
|
373
|
+
* can be a maximum of 64 characters long and values can be a maxium of 512
|
|
374
|
+
* characters long.
|
|
375
|
+
*/
|
|
376
|
+
metadata?: unknown | null;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
|
|
380
|
+
* be used to execute this run. If a value is provided here, it will override the
|
|
381
|
+
* model associated with the assistant. If not, the model associated with the
|
|
382
|
+
* assistant will be used.
|
|
383
|
+
*/
|
|
384
|
+
model?: string | null;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
388
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
389
|
+
* focused and deterministic.
|
|
390
|
+
*/
|
|
391
|
+
temperature?: number | null;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* If no thread is provided, an empty thread will be created.
|
|
395
|
+
*/
|
|
396
|
+
thread?: ThreadCreateAndRunPollParams.Thread;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Override the tools the assistant can use for this run. This is useful for
|
|
400
|
+
* modifying the behavior on a per-run basis.
|
|
401
|
+
*/
|
|
402
|
+
tools?: Array<
|
|
403
|
+
AssistantsAPI.CodeInterpreterTool | AssistantsAPI.RetrievalTool | AssistantsAPI.FunctionTool
|
|
404
|
+
> | null;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export namespace ThreadCreateAndRunPollParams {
|
|
408
|
+
/**
|
|
409
|
+
* If no thread is provided, an empty thread will be created.
|
|
410
|
+
*/
|
|
411
|
+
export interface Thread {
|
|
412
|
+
/**
|
|
413
|
+
* A list of [messages](https://platform.openai.com/docs/api-reference/messages) to
|
|
414
|
+
* start the thread with.
|
|
415
|
+
*/
|
|
416
|
+
messages?: Array<Thread.Message>;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
420
|
+
* for storing additional information about the object in a structured format. Keys
|
|
421
|
+
* can be a maximum of 64 characters long and values can be a maxium of 512
|
|
422
|
+
* characters long.
|
|
423
|
+
*/
|
|
424
|
+
metadata?: unknown | null;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export namespace Thread {
|
|
428
|
+
export interface Message {
|
|
429
|
+
/**
|
|
430
|
+
* The content of the message.
|
|
431
|
+
*/
|
|
432
|
+
content: string;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* The role of the entity that is creating the message. Allowed values include:
|
|
436
|
+
*
|
|
437
|
+
* - `user`: Indicates the message is sent by an actual user and should be used in
|
|
438
|
+
* most cases to represent user-generated messages.
|
|
439
|
+
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
|
440
|
+
* value to insert messages from the assistant into the conversation.
|
|
441
|
+
*/
|
|
442
|
+
role: 'user' | 'assistant';
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
|
|
446
|
+
* the message should use. There can be a maximum of 10 files attached to a
|
|
447
|
+
* message. Useful for tools like `retrieval` and `code_interpreter` that can
|
|
448
|
+
* access and use files.
|
|
449
|
+
*/
|
|
450
|
+
file_ids?: Array<string>;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
454
|
+
* for storing additional information about the object in a structured format. Keys
|
|
455
|
+
* can be a maximum of 64 characters long and values can be a maxium of 512
|
|
456
|
+
* characters long.
|
|
457
|
+
*/
|
|
458
|
+
metadata?: unknown | null;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
328
463
|
export interface ThreadCreateAndRunStreamParams {
|
|
329
464
|
/**
|
|
330
465
|
* The ID of the
|
|
@@ -355,6 +490,13 @@ export interface ThreadCreateAndRunStreamParams {
|
|
|
355
490
|
*/
|
|
356
491
|
model?: string | null;
|
|
357
492
|
|
|
493
|
+
/**
|
|
494
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
495
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
496
|
+
* focused and deterministic.
|
|
497
|
+
*/
|
|
498
|
+
temperature?: number | null;
|
|
499
|
+
|
|
358
500
|
/**
|
|
359
501
|
* If no thread is provided, an empty thread will be created.
|
|
360
502
|
*/
|
|
@@ -397,10 +539,14 @@ export namespace ThreadCreateAndRunStreamParams {
|
|
|
397
539
|
content: string;
|
|
398
540
|
|
|
399
541
|
/**
|
|
400
|
-
* The role of the entity that is creating the message.
|
|
401
|
-
*
|
|
542
|
+
* The role of the entity that is creating the message. Allowed values include:
|
|
543
|
+
*
|
|
544
|
+
* - `user`: Indicates the message is sent by an actual user and should be used in
|
|
545
|
+
* most cases to represent user-generated messages.
|
|
546
|
+
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
|
547
|
+
* value to insert messages from the assistant into the conversation.
|
|
402
548
|
*/
|
|
403
|
-
role: 'user';
|
|
549
|
+
role: 'user' | 'assistant';
|
|
404
550
|
|
|
405
551
|
/**
|
|
406
552
|
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
|
|
@@ -429,6 +575,7 @@ export namespace Threads {
|
|
|
429
575
|
export import ThreadCreateAndRunParams = ThreadsAPI.ThreadCreateAndRunParams;
|
|
430
576
|
export import ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming;
|
|
431
577
|
export import ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming;
|
|
578
|
+
export import ThreadCreateAndRunPollParams = ThreadsAPI.ThreadCreateAndRunPollParams;
|
|
432
579
|
export import ThreadCreateAndRunStreamParams = ThreadsAPI.ThreadCreateAndRunStreamParams;
|
|
433
580
|
export import Runs = RunsAPI.Runs;
|
|
434
581
|
export import RequiredActionFunctionToolCall = RunsAPI.RequiredActionFunctionToolCall;
|
|
@@ -440,10 +587,13 @@ export namespace Threads {
|
|
|
440
587
|
export import RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming;
|
|
441
588
|
export import RunUpdateParams = RunsAPI.RunUpdateParams;
|
|
442
589
|
export import RunListParams = RunsAPI.RunListParams;
|
|
590
|
+
export import RunCreateAndPollParams = RunsAPI.RunCreateAndPollParams;
|
|
443
591
|
export import RunCreateAndStreamParams = RunsAPI.RunCreateAndStreamParams;
|
|
592
|
+
export import RunStreamParams = RunsAPI.RunStreamParams;
|
|
444
593
|
export import RunSubmitToolOutputsParams = RunsAPI.RunSubmitToolOutputsParams;
|
|
445
594
|
export import RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming;
|
|
446
595
|
export import RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming;
|
|
596
|
+
export import RunSubmitToolOutputsAndPollParams = RunsAPI.RunSubmitToolOutputsAndPollParams;
|
|
447
597
|
export import RunSubmitToolOutputsStreamParams = RunsAPI.RunSubmitToolOutputsStreamParams;
|
|
448
598
|
export import Messages = MessagesAPI.Messages;
|
|
449
599
|
export import Annotation = MessagesAPI.Annotation;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.32.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.32.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.32.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|