@tambo-ai/typescript-sdk 0.80.0 → 0.82.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.
Files changed (132) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +1 -3
  3. package/bin/migration-config.json +66 -0
  4. package/client.d.mts +6 -0
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +6 -0
  7. package/client.d.ts.map +1 -1
  8. package/client.js +6 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +6 -0
  11. package/client.mjs.map +1 -1
  12. package/lib/advance-stream.d.mts +2 -2
  13. package/lib/advance-stream.d.mts.map +1 -1
  14. package/lib/advance-stream.d.ts +2 -2
  15. package/lib/advance-stream.d.ts.map +1 -1
  16. package/lib/advance-stream.js.map +1 -1
  17. package/lib/advance-stream.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/beta/beta.d.mts +2 -2
  20. package/resources/beta/beta.d.mts.map +1 -1
  21. package/resources/beta/beta.d.ts +2 -2
  22. package/resources/beta/beta.d.ts.map +1 -1
  23. package/resources/beta/beta.js.map +1 -1
  24. package/resources/beta/beta.mjs.map +1 -1
  25. package/resources/beta/index.d.mts +1 -1
  26. package/resources/beta/index.d.mts.map +1 -1
  27. package/resources/beta/index.d.ts +1 -1
  28. package/resources/beta/index.d.ts.map +1 -1
  29. package/resources/beta/index.js.map +1 -1
  30. package/resources/beta/index.mjs.map +1 -1
  31. package/resources/beta/threads/index.d.mts +1 -1
  32. package/resources/beta/threads/index.d.mts.map +1 -1
  33. package/resources/beta/threads/index.d.ts +1 -1
  34. package/resources/beta/threads/index.d.ts.map +1 -1
  35. package/resources/beta/threads/index.js.map +1 -1
  36. package/resources/beta/threads/index.mjs.map +1 -1
  37. package/resources/beta/threads/messages.d.mts +5 -2
  38. package/resources/beta/threads/messages.d.mts.map +1 -1
  39. package/resources/beta/threads/messages.d.ts +5 -2
  40. package/resources/beta/threads/messages.d.ts.map +1 -1
  41. package/resources/beta/threads/messages.js +4 -1
  42. package/resources/beta/threads/messages.js.map +1 -1
  43. package/resources/beta/threads/messages.mjs +4 -1
  44. package/resources/beta/threads/messages.mjs.map +1 -1
  45. package/resources/beta/threads/threads.d.mts +6 -135
  46. package/resources/beta/threads/threads.d.mts.map +1 -1
  47. package/resources/beta/threads/threads.d.ts +6 -135
  48. package/resources/beta/threads/threads.d.ts.map +1 -1
  49. package/resources/beta/threads/threads.js +6 -25
  50. package/resources/beta/threads/threads.js.map +1 -1
  51. package/resources/beta/threads/threads.mjs +6 -25
  52. package/resources/beta/threads/threads.mjs.map +1 -1
  53. package/resources/index.d.mts +2 -0
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +2 -0
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js +5 -1
  58. package/resources/index.js.map +1 -1
  59. package/resources/index.mjs +2 -0
  60. package/resources/index.mjs.map +1 -1
  61. package/resources/shared.d.mts +3 -0
  62. package/resources/shared.d.mts.map +1 -1
  63. package/resources/shared.d.ts +3 -0
  64. package/resources/shared.d.ts.map +1 -1
  65. package/resources/storage.d.mts +46 -0
  66. package/resources/storage.d.mts.map +1 -0
  67. package/resources/storage.d.ts +46 -0
  68. package/resources/storage.d.ts.map +1 -0
  69. package/resources/storage.js +24 -0
  70. package/resources/storage.js.map +1 -0
  71. package/resources/storage.mjs +20 -0
  72. package/resources/storage.mjs.map +1 -0
  73. package/resources/threads/index.d.mts +4 -0
  74. package/resources/threads/index.d.mts.map +1 -0
  75. package/resources/threads/index.d.ts +4 -0
  76. package/resources/threads/index.d.ts.map +1 -0
  77. package/resources/threads/index.js +11 -0
  78. package/resources/threads/index.js.map +1 -0
  79. package/resources/threads/index.mjs +5 -0
  80. package/resources/threads/index.mjs.map +1 -0
  81. package/resources/threads/messages.d.mts +112 -0
  82. package/resources/threads/messages.d.mts.map +1 -0
  83. package/resources/threads/messages.d.ts +112 -0
  84. package/resources/threads/messages.d.ts.map +1 -0
  85. package/resources/threads/messages.js +38 -0
  86. package/resources/threads/messages.js.map +1 -0
  87. package/resources/threads/messages.mjs +34 -0
  88. package/resources/threads/messages.mjs.map +1 -0
  89. package/resources/threads/runs.d.mts +270 -0
  90. package/resources/threads/runs.d.mts.map +1 -0
  91. package/resources/threads/runs.d.ts +270 -0
  92. package/resources/threads/runs.d.ts.map +1 -0
  93. package/resources/threads/runs.js +63 -0
  94. package/resources/threads/runs.js.map +1 -0
  95. package/resources/threads/runs.mjs +59 -0
  96. package/resources/threads/runs.mjs.map +1 -0
  97. package/resources/threads/threads.d.mts +312 -0
  98. package/resources/threads/threads.d.mts.map +1 -0
  99. package/resources/threads/threads.d.ts +312 -0
  100. package/resources/threads/threads.d.ts.map +1 -0
  101. package/resources/threads/threads.js +75 -0
  102. package/resources/threads/threads.js.map +1 -0
  103. package/resources/threads/threads.mjs +70 -0
  104. package/resources/threads/threads.mjs.map +1 -0
  105. package/resources/threads.d.mts +2 -0
  106. package/resources/threads.d.mts.map +1 -0
  107. package/resources/threads.d.ts +2 -0
  108. package/resources/threads.d.ts.map +1 -0
  109. package/resources/threads.js +6 -0
  110. package/resources/threads.js.map +1 -0
  111. package/resources/threads.mjs +3 -0
  112. package/resources/threads.mjs.map +1 -0
  113. package/src/client.ts +30 -0
  114. package/src/lib/advance-stream.ts +2 -2
  115. package/src/resources/beta/beta.ts +0 -2
  116. package/src/resources/beta/index.ts +0 -1
  117. package/src/resources/beta/threads/index.ts +0 -1
  118. package/src/resources/beta/threads/messages.ts +5 -2
  119. package/src/resources/beta/threads/threads.ts +6 -157
  120. package/src/resources/index.ts +10 -0
  121. package/src/resources/shared.ts +3 -0
  122. package/src/resources/storage.ts +59 -0
  123. package/src/resources/threads/index.ts +26 -0
  124. package/src/resources/threads/messages.ts +148 -0
  125. package/src/resources/threads/runs.ts +347 -0
  126. package/src/resources/threads/threads.ts +429 -0
  127. package/src/resources/threads.ts +3 -0
  128. package/src/version.ts +1 -1
  129. package/version.d.mts +1 -1
  130. package/version.d.ts +1 -1
  131. package/version.js +1 -1
  132. package/version.mjs +1 -1
@@ -0,0 +1,270 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as RunsAPI from "./runs.js";
3
+ import { APIPromise } from "../../core/api-promise.js";
4
+ import { RequestOptions } from "../../internal/request-options.js";
5
+ export declare class Runs extends APIResource {
6
+ /**
7
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
8
+ * stream of AG-UI events.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * await client.threads.runs.create({
13
+ * message: { content: [{}], role: 'user' },
14
+ * });
15
+ * ```
16
+ */
17
+ create(body: RunCreateParams, options?: RequestOptions): APIPromise<void>;
18
+ /**
19
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
20
+ * the run.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const run = await client.threads.runs.delete(
25
+ * 'run_xyz789abc',
26
+ * { threadId: 'thr_abc123xyz' },
27
+ * );
28
+ * ```
29
+ */
30
+ delete(runID: string, params: RunDeleteParams, options?: RequestOptions): APIPromise<RunDeleteResponse>;
31
+ /**
32
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
33
+ * events.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await client.threads.runs.run('thr_abc123xyz', {
38
+ * message: { content: [{}], role: 'user' },
39
+ * });
40
+ * ```
41
+ */
42
+ run(threadID: string, body: RunRunParams, options?: RequestOptions): APIPromise<void>;
43
+ }
44
+ export interface InputMessage {
45
+ /**
46
+ * Content blocks (text, resource, or tool_result)
47
+ */
48
+ content: Array<unknown>;
49
+ /**
50
+ * Message role - must be 'user' for input messages
51
+ */
52
+ role: 'user';
53
+ /**
54
+ * Additional metadata to attach to the message
55
+ */
56
+ metadata?: unknown;
57
+ }
58
+ export interface RunDeleteResponse {
59
+ /**
60
+ * The run ID that was cancelled
61
+ */
62
+ runId: string;
63
+ /**
64
+ * New status after cancellation (always 'cancelled')
65
+ */
66
+ status: 'cancelled';
67
+ }
68
+ export interface RunCreateParams {
69
+ /**
70
+ * The user's message
71
+ */
72
+ message: InputMessage;
73
+ /**
74
+ * Available UI components the model can render
75
+ */
76
+ availableComponents?: Array<RunCreateParams.AvailableComponent>;
77
+ /**
78
+ * Maximum tokens to generate
79
+ */
80
+ maxTokens?: number;
81
+ /**
82
+ * Override the default model
83
+ */
84
+ model?: string;
85
+ /**
86
+ * ID of the previous run. Required when continuing a thread that already has
87
+ * messages.
88
+ */
89
+ previousRunId?: string;
90
+ /**
91
+ * Metadata for the run
92
+ */
93
+ runMetadata?: unknown;
94
+ /**
95
+ * Temperature for generation (0-2)
96
+ */
97
+ temperature?: number;
98
+ /**
99
+ * Thread configuration
100
+ */
101
+ thread?: RunCreateParams.Thread;
102
+ /**
103
+ * Metadata for the thread
104
+ */
105
+ threadMetadata?: unknown;
106
+ /**
107
+ * How the model should use tools
108
+ */
109
+ toolChoice?: 'auto' | 'required' | 'none' | RunCreateParams.Name;
110
+ /**
111
+ * Client-side tools the model can call
112
+ */
113
+ tools?: Array<RunCreateParams.Tool>;
114
+ }
115
+ export declare namespace RunCreateParams {
116
+ interface AvailableComponent {
117
+ /**
118
+ * Description of what this component displays
119
+ */
120
+ description: string;
121
+ /**
122
+ * Component name (e.g., 'StockChart')
123
+ */
124
+ name: string;
125
+ /**
126
+ * JSON Schema for component props
127
+ */
128
+ propsSchema: unknown;
129
+ /**
130
+ * Optional JSON Schema for component state
131
+ */
132
+ stateSchema?: unknown;
133
+ }
134
+ /**
135
+ * Thread configuration
136
+ */
137
+ interface Thread {
138
+ /**
139
+ * Optional context key for thread organization
140
+ */
141
+ contextKey?: string;
142
+ /**
143
+ * Initial messages to seed the thread with
144
+ */
145
+ initialMessages?: Array<RunsAPI.InputMessage>;
146
+ /**
147
+ * Additional metadata to attach to the thread
148
+ */
149
+ metadata?: unknown;
150
+ }
151
+ interface Name {
152
+ name?: string;
153
+ }
154
+ interface Tool {
155
+ /**
156
+ * Description of what the tool does
157
+ */
158
+ description: string;
159
+ /**
160
+ * JSON Schema for the tool's input parameters
161
+ */
162
+ inputSchema: unknown;
163
+ /**
164
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
165
+ */
166
+ name: string;
167
+ /**
168
+ * Optional JSON Schema for structured output
169
+ */
170
+ outputSchema?: unknown;
171
+ /**
172
+ * Enable strict schema validation (OpenAI feature)
173
+ */
174
+ strict?: boolean;
175
+ }
176
+ }
177
+ export interface RunDeleteParams {
178
+ /**
179
+ * Thread ID
180
+ */
181
+ threadId: string;
182
+ }
183
+ export interface RunRunParams {
184
+ /**
185
+ * The user's message
186
+ */
187
+ message: InputMessage;
188
+ /**
189
+ * Available UI components the model can render
190
+ */
191
+ availableComponents?: Array<RunRunParams.AvailableComponent>;
192
+ /**
193
+ * Maximum tokens to generate
194
+ */
195
+ maxTokens?: number;
196
+ /**
197
+ * Override the default model
198
+ */
199
+ model?: string;
200
+ /**
201
+ * ID of the previous run. Required when continuing a thread that already has
202
+ * messages.
203
+ */
204
+ previousRunId?: string;
205
+ /**
206
+ * Metadata for the run
207
+ */
208
+ runMetadata?: unknown;
209
+ /**
210
+ * Temperature for generation (0-2)
211
+ */
212
+ temperature?: number;
213
+ /**
214
+ * How the model should use tools
215
+ */
216
+ toolChoice?: 'auto' | 'required' | 'none' | RunRunParams.Name;
217
+ /**
218
+ * Client-side tools the model can call
219
+ */
220
+ tools?: Array<RunRunParams.Tool>;
221
+ }
222
+ export declare namespace RunRunParams {
223
+ interface AvailableComponent {
224
+ /**
225
+ * Description of what this component displays
226
+ */
227
+ description: string;
228
+ /**
229
+ * Component name (e.g., 'StockChart')
230
+ */
231
+ name: string;
232
+ /**
233
+ * JSON Schema for component props
234
+ */
235
+ propsSchema: unknown;
236
+ /**
237
+ * Optional JSON Schema for component state
238
+ */
239
+ stateSchema?: unknown;
240
+ }
241
+ interface Name {
242
+ name?: string;
243
+ }
244
+ interface Tool {
245
+ /**
246
+ * Description of what the tool does
247
+ */
248
+ description: string;
249
+ /**
250
+ * JSON Schema for the tool's input parameters
251
+ */
252
+ inputSchema: unknown;
253
+ /**
254
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
255
+ */
256
+ name: string;
257
+ /**
258
+ * Optional JSON Schema for structured output
259
+ */
260
+ outputSchema?: unknown;
261
+ /**
262
+ * Enable strict schema validation (OpenAI feature)
263
+ */
264
+ strict?: boolean;
265
+ }
266
+ }
267
+ export declare namespace Runs {
268
+ export { type InputMessage as InputMessage, type RunDeleteResponse as RunDeleteResponse, type RunCreateParams as RunCreateParams, type RunDeleteParams as RunDeleteParams, type RunRunParams as RunRunParams, };
269
+ }
270
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAQzE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAKvG;;;;;;;;;;OAUG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAOtF;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAExB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW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EAAE,MAAM,CAAC;KACf;IAED,UAAiB,IAAI;QACnB;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,WAAW,EAAE,OAAO,CAAC;QAErB;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QAEvB;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB;CACF;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,YAAY,IAAI,YAAY,GAClC,CAAC;CACH"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Runs = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Runs extends resource_1.APIResource {
9
+ /**
10
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
11
+ * stream of AG-UI events.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * await client.threads.runs.create({
16
+ * message: { content: [{}], role: 'user' },
17
+ * });
18
+ * ```
19
+ */
20
+ create(body, options) {
21
+ return this._client.post('/v1/threads/runs', {
22
+ body,
23
+ ...options,
24
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
25
+ });
26
+ }
27
+ /**
28
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
29
+ * the run.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const run = await client.threads.runs.delete(
34
+ * 'run_xyz789abc',
35
+ * { threadId: 'thr_abc123xyz' },
36
+ * );
37
+ * ```
38
+ */
39
+ delete(runID, params, options) {
40
+ const { threadId } = params;
41
+ return this._client.delete((0, path_1.path) `/v1/threads/${threadId}/runs/${runID}`, options);
42
+ }
43
+ /**
44
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
45
+ * events.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * await client.threads.runs.run('thr_abc123xyz', {
50
+ * message: { content: [{}], role: 'user' },
51
+ * });
52
+ * ```
53
+ */
54
+ run(threadID, body, options) {
55
+ return this._client.post((0, path_1.path) `/v1/threads/${threadID}/runs`, {
56
+ body,
57
+ ...options,
58
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
59
+ });
60
+ }
61
+ }
62
+ exports.Runs = Runs;
63
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAqB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAa,EAAE,MAAuB,EAAE,OAAwB;QACrE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,QAAgB,EAAE,IAAkB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,OAAO,EAAE;YAC3D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAvDD,oBAuDC"}
@@ -0,0 +1,59 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class Runs extends APIResource {
6
+ /**
7
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
8
+ * stream of AG-UI events.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * await client.threads.runs.create({
13
+ * message: { content: [{}], role: 'user' },
14
+ * });
15
+ * ```
16
+ */
17
+ create(body, options) {
18
+ return this._client.post('/v1/threads/runs', {
19
+ body,
20
+ ...options,
21
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
22
+ });
23
+ }
24
+ /**
25
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
26
+ * the run.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const run = await client.threads.runs.delete(
31
+ * 'run_xyz789abc',
32
+ * { threadId: 'thr_abc123xyz' },
33
+ * );
34
+ * ```
35
+ */
36
+ delete(runID, params, options) {
37
+ const { threadId } = params;
38
+ return this._client.delete(path `/v1/threads/${threadId}/runs/${runID}`, options);
39
+ }
40
+ /**
41
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
42
+ * events.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * await client.threads.runs.run('thr_abc123xyz', {
47
+ * message: { content: [{}], role: 'user' },
48
+ * });
49
+ * ```
50
+ */
51
+ run(threadID, body, options) {
52
+ return this._client.post(path `/v1/threads/${threadID}/runs`, {
53
+ body,
54
+ ...options,
55
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
56
+ });
57
+ }
58
+ }
59
+ //# sourceMappingURL=runs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.mjs","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAqB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAa,EAAE,MAAuB,EAAE,OAAwB;QACrE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,eAAe,QAAQ,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,QAAgB,EAAE,IAAkB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,QAAQ,OAAO,EAAE;YAC3D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}