@tambo-ai/typescript-sdk 0.86.0 → 0.88.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 +31 -0
- package/bin/migration-config.json +74 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/threads/index.d.mts +2 -1
- package/resources/threads/index.d.mts.map +1 -1
- package/resources/threads/index.d.ts +2 -1
- package/resources/threads/index.d.ts.map +1 -1
- package/resources/threads/index.js +3 -1
- package/resources/threads/index.js.map +1 -1
- package/resources/threads/index.mjs +1 -0
- package/resources/threads/index.mjs.map +1 -1
- package/resources/threads/runs.d.mts +12 -4
- package/resources/threads/runs.d.mts.map +1 -1
- package/resources/threads/runs.d.ts +12 -4
- package/resources/threads/runs.d.ts.map +1 -1
- package/resources/threads/state.d.mts +24 -38
- package/resources/threads/state.d.mts.map +1 -1
- package/resources/threads/state.d.ts +24 -38
- package/resources/threads/state.d.ts.map +1 -1
- package/resources/threads/state.js +1 -4
- package/resources/threads/state.js.map +1 -1
- package/resources/threads/state.mjs +1 -4
- package/resources/threads/state.mjs.map +1 -1
- package/resources/threads/suggestions.d.mts +122 -0
- package/resources/threads/suggestions.d.mts.map +1 -0
- package/resources/threads/suggestions.d.ts +122 -0
- package/resources/threads/suggestions.d.ts.map +1 -0
- package/resources/threads/suggestions.js +49 -0
- package/resources/threads/suggestions.js.map +1 -0
- package/resources/threads/suggestions.mjs +45 -0
- package/resources/threads/suggestions.mjs.map +1 -0
- package/resources/threads/threads.d.mts +32 -22
- package/resources/threads/threads.d.mts.map +1 -1
- package/resources/threads/threads.d.ts +32 -22
- package/resources/threads/threads.d.ts.map +1 -1
- package/resources/threads/threads.js +7 -3
- package/resources/threads/threads.js.map +1 -1
- package/resources/threads/threads.mjs +7 -3
- package/resources/threads/threads.mjs.map +1 -1
- package/src/client.ts +2 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/threads/index.ts +8 -0
- package/src/resources/threads/runs.ts +15 -5
- package/src/resources/threads/state.ts +27 -41
- package/src/resources/threads/suggestions.ts +170 -0
- package/src/resources/threads/threads.ts +56 -26
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as ThreadsSuggestionsAPI from '../beta/threads/suggestions';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Suggestions extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Generate AI-powered suggestions for the next action based on the thread context.
|
|
12
|
+
* Suggestions are persisted and can be retrieved later via the list endpoint.
|
|
13
|
+
* Calling this endpoint replaces any existing suggestions for the message.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const suggestion = await client.threads.suggestions.create(
|
|
18
|
+
* 'msg_xyz789abc',
|
|
19
|
+
* { threadId: 'thr_abc123xyz' },
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
create(
|
|
24
|
+
messageID: string,
|
|
25
|
+
params: SuggestionCreateParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<SuggestionCreateResponse> {
|
|
28
|
+
const { threadId, ...body } = params;
|
|
29
|
+
return this._client.post(path`/v1/threads/${threadId}/messages/${messageID}/suggestions`, {
|
|
30
|
+
body,
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* List suggestions that have been generated for a specific message. Supports
|
|
37
|
+
* cursor-based pagination.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const suggestions = await client.threads.suggestions.list(
|
|
42
|
+
* 'msg_xyz789abc',
|
|
43
|
+
* { threadId: 'thr_abc123xyz' },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
list(
|
|
48
|
+
messageID: string,
|
|
49
|
+
params: SuggestionListParams,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): APIPromise<SuggestionListResponse> {
|
|
52
|
+
const { threadId, ...query } = params;
|
|
53
|
+
return this._client.get(path`/v1/threads/${threadId}/messages/${messageID}/suggestions`, {
|
|
54
|
+
query,
|
|
55
|
+
...options,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface SuggestionCreateResponse {
|
|
61
|
+
/**
|
|
62
|
+
* Whether there are more results
|
|
63
|
+
*/
|
|
64
|
+
hasMore: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* List of suggestions for the message
|
|
68
|
+
*/
|
|
69
|
+
suggestions: Array<ThreadsSuggestionsAPI.Suggestion>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Cursor for the next page of results
|
|
73
|
+
*/
|
|
74
|
+
nextCursor?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface SuggestionListResponse {
|
|
78
|
+
/**
|
|
79
|
+
* Whether there are more results
|
|
80
|
+
*/
|
|
81
|
+
hasMore: boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* List of suggestions for the message
|
|
85
|
+
*/
|
|
86
|
+
suggestions: Array<ThreadsSuggestionsAPI.Suggestion>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Cursor for the next page of results
|
|
90
|
+
*/
|
|
91
|
+
nextCursor?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface SuggestionCreateParams {
|
|
95
|
+
/**
|
|
96
|
+
* Path param: Thread ID
|
|
97
|
+
*/
|
|
98
|
+
threadId: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Body param: Available components that suggestions can reference
|
|
102
|
+
*/
|
|
103
|
+
availableComponents?: Array<SuggestionCreateParams.AvailableComponent>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Body param: Maximum number of suggestions to generate (1-10)
|
|
107
|
+
*/
|
|
108
|
+
maxSuggestions?: number;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Body param: Identifier for a user in your system. Required if no bearer token is
|
|
112
|
+
* provided.
|
|
113
|
+
*/
|
|
114
|
+
userKey?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export namespace SuggestionCreateParams {
|
|
118
|
+
export interface AvailableComponent {
|
|
119
|
+
/**
|
|
120
|
+
* Description of what this component displays
|
|
121
|
+
*/
|
|
122
|
+
description: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Component name (e.g., 'StockChart')
|
|
126
|
+
*/
|
|
127
|
+
name: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* JSON Schema for component props
|
|
131
|
+
*/
|
|
132
|
+
propsSchema: unknown;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Optional JSON Schema for component state
|
|
136
|
+
*/
|
|
137
|
+
stateSchema?: unknown;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface SuggestionListParams {
|
|
142
|
+
/**
|
|
143
|
+
* Path param: Thread ID
|
|
144
|
+
*/
|
|
145
|
+
threadId: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Query param: Cursor for pagination
|
|
149
|
+
*/
|
|
150
|
+
cursor?: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Query param: Maximum number of suggestions to return
|
|
154
|
+
*/
|
|
155
|
+
limit?: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Query param: Optional user key for thread organization
|
|
159
|
+
*/
|
|
160
|
+
userKey?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export declare namespace Suggestions {
|
|
164
|
+
export {
|
|
165
|
+
type SuggestionCreateResponse as SuggestionCreateResponse,
|
|
166
|
+
type SuggestionListResponse as SuggestionListResponse,
|
|
167
|
+
type SuggestionCreateParams as SuggestionCreateParams,
|
|
168
|
+
type SuggestionListParams as SuggestionListParams,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -24,6 +24,14 @@ import {
|
|
|
24
24
|
} from './runs';
|
|
25
25
|
import * as StateAPI from './state';
|
|
26
26
|
import { State, StateUpdateStateParams, StateUpdateStateResponse } from './state';
|
|
27
|
+
import * as SuggestionsAPI from './suggestions';
|
|
28
|
+
import {
|
|
29
|
+
SuggestionCreateParams,
|
|
30
|
+
SuggestionCreateResponse,
|
|
31
|
+
SuggestionListParams,
|
|
32
|
+
SuggestionListResponse,
|
|
33
|
+
Suggestions,
|
|
34
|
+
} from './suggestions';
|
|
27
35
|
import { APIPromise } from '../../core/api-promise';
|
|
28
36
|
import { buildHeaders } from '../../internal/headers';
|
|
29
37
|
import { RequestOptions } from '../../internal/request-options';
|
|
@@ -33,6 +41,7 @@ export class Threads extends APIResource {
|
|
|
33
41
|
state: StateAPI.State = new StateAPI.State(this._client);
|
|
34
42
|
messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
|
|
35
43
|
runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
|
|
44
|
+
suggestions: SuggestionsAPI.Suggestions = new SuggestionsAPI.Suggestions(this._client);
|
|
36
45
|
|
|
37
46
|
/**
|
|
38
47
|
* Create a new empty thread. Note: initialMessages is not supported yet; create
|
|
@@ -58,13 +67,17 @@ export class Threads extends APIResource {
|
|
|
58
67
|
* );
|
|
59
68
|
* ```
|
|
60
69
|
*/
|
|
61
|
-
retrieve(
|
|
62
|
-
|
|
70
|
+
retrieve(
|
|
71
|
+
threadID: string,
|
|
72
|
+
query: ThreadRetrieveParams | null | undefined = {},
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): APIPromise<ThreadRetrieveResponse> {
|
|
75
|
+
return this._client.get(path`/v1/threads/${threadID}`, { query, ...options });
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
/**
|
|
66
79
|
* List all threads for the authenticated project. Supports cursor-based pagination
|
|
67
|
-
* and filtering by
|
|
80
|
+
* and filtering by user key.
|
|
68
81
|
*
|
|
69
82
|
* @example
|
|
70
83
|
* ```ts
|
|
@@ -223,11 +236,6 @@ export interface ThreadCreateResponse {
|
|
|
223
236
|
*/
|
|
224
237
|
updatedAt: string;
|
|
225
238
|
|
|
226
|
-
/**
|
|
227
|
-
* Optional context key for thread organization
|
|
228
|
-
*/
|
|
229
|
-
contextKey?: string;
|
|
230
|
-
|
|
231
239
|
/**
|
|
232
240
|
* ID of the currently active run (when not idle)
|
|
233
241
|
*/
|
|
@@ -264,6 +272,11 @@ export interface ThreadCreateResponse {
|
|
|
264
272
|
* Human-readable status message (e.g., 'Fetching weather data...')
|
|
265
273
|
*/
|
|
266
274
|
statusMessage?: string;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Optional user key for thread organization
|
|
278
|
+
*/
|
|
279
|
+
userKey?: string;
|
|
267
280
|
}
|
|
268
281
|
|
|
269
282
|
export interface ThreadRetrieveResponse {
|
|
@@ -293,11 +306,6 @@ export interface ThreadRetrieveResponse {
|
|
|
293
306
|
*/
|
|
294
307
|
updatedAt: string;
|
|
295
308
|
|
|
296
|
-
/**
|
|
297
|
-
* Optional context key for thread organization
|
|
298
|
-
*/
|
|
299
|
-
contextKey?: string;
|
|
300
|
-
|
|
301
309
|
/**
|
|
302
310
|
* ID of the currently active run (when not idle)
|
|
303
311
|
*/
|
|
@@ -334,6 +342,11 @@ export interface ThreadRetrieveResponse {
|
|
|
334
342
|
* Human-readable status message (e.g., 'Fetching weather data...')
|
|
335
343
|
*/
|
|
336
344
|
statusMessage?: string;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Optional user key for thread organization
|
|
348
|
+
*/
|
|
349
|
+
userKey?: string;
|
|
337
350
|
}
|
|
338
351
|
|
|
339
352
|
export namespace ThreadRetrieveResponse {
|
|
@@ -411,11 +424,6 @@ export namespace ThreadListResponse {
|
|
|
411
424
|
*/
|
|
412
425
|
updatedAt: string;
|
|
413
426
|
|
|
414
|
-
/**
|
|
415
|
-
* Optional context key for thread organization
|
|
416
|
-
*/
|
|
417
|
-
contextKey?: string;
|
|
418
|
-
|
|
419
427
|
/**
|
|
420
428
|
* ID of the currently active run (when not idle)
|
|
421
429
|
*/
|
|
@@ -452,15 +460,15 @@ export namespace ThreadListResponse {
|
|
|
452
460
|
* Human-readable status message (e.g., 'Fetching weather data...')
|
|
453
461
|
*/
|
|
454
462
|
statusMessage?: string;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Optional user key for thread organization
|
|
466
|
+
*/
|
|
467
|
+
userKey?: string;
|
|
455
468
|
}
|
|
456
469
|
}
|
|
457
470
|
|
|
458
471
|
export interface ThreadCreateParams {
|
|
459
|
-
/**
|
|
460
|
-
* Optional context key for thread organization
|
|
461
|
-
*/
|
|
462
|
-
contextKey?: string;
|
|
463
|
-
|
|
464
472
|
/**
|
|
465
473
|
* Initial messages to seed the thread with
|
|
466
474
|
*/
|
|
@@ -470,14 +478,21 @@ export interface ThreadCreateParams {
|
|
|
470
478
|
* Additional metadata to attach to the thread
|
|
471
479
|
*/
|
|
472
480
|
metadata?: unknown;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Identifier for a user in your system. Required if no bearer token is provided.
|
|
484
|
+
*/
|
|
485
|
+
userKey?: string;
|
|
473
486
|
}
|
|
474
487
|
|
|
475
|
-
export interface
|
|
488
|
+
export interface ThreadRetrieveParams {
|
|
476
489
|
/**
|
|
477
|
-
*
|
|
490
|
+
* Optional user key for thread organization
|
|
478
491
|
*/
|
|
479
|
-
|
|
492
|
+
userKey?: string;
|
|
493
|
+
}
|
|
480
494
|
|
|
495
|
+
export interface ThreadListParams {
|
|
481
496
|
/**
|
|
482
497
|
* Cursor for pagination
|
|
483
498
|
*/
|
|
@@ -487,11 +502,17 @@ export interface ThreadListParams {
|
|
|
487
502
|
* Maximum number of threads to return
|
|
488
503
|
*/
|
|
489
504
|
limit?: string;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Filter by user key
|
|
508
|
+
*/
|
|
509
|
+
userKey?: string;
|
|
490
510
|
}
|
|
491
511
|
|
|
492
512
|
Threads.State = State;
|
|
493
513
|
Threads.Messages = Messages;
|
|
494
514
|
Threads.Runs = Runs;
|
|
515
|
+
Threads.Suggestions = Suggestions;
|
|
495
516
|
|
|
496
517
|
export declare namespace Threads {
|
|
497
518
|
export {
|
|
@@ -505,6 +526,7 @@ export declare namespace Threads {
|
|
|
505
526
|
type ThreadRetrieveResponse as ThreadRetrieveResponse,
|
|
506
527
|
type ThreadListResponse as ThreadListResponse,
|
|
507
528
|
type ThreadCreateParams as ThreadCreateParams,
|
|
529
|
+
type ThreadRetrieveParams as ThreadRetrieveParams,
|
|
508
530
|
type ThreadListParams as ThreadListParams,
|
|
509
531
|
};
|
|
510
532
|
|
|
@@ -532,4 +554,12 @@ export declare namespace Threads {
|
|
|
532
554
|
type RunDeleteParams as RunDeleteParams,
|
|
533
555
|
type RunRunParams as RunRunParams,
|
|
534
556
|
};
|
|
557
|
+
|
|
558
|
+
export {
|
|
559
|
+
Suggestions as Suggestions,
|
|
560
|
+
type SuggestionCreateResponse as SuggestionCreateResponse,
|
|
561
|
+
type SuggestionListResponse as SuggestionListResponse,
|
|
562
|
+
type SuggestionCreateParams as SuggestionCreateParams,
|
|
563
|
+
type SuggestionListParams as SuggestionListParams,
|
|
564
|
+
};
|
|
535
565
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.88.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.88.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.88.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.88.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|