@tambo-ai/typescript-sdk 0.80.0 → 0.83.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 +67 -0
- package/README.md +1 -3
- package/bin/migration-config.json +66 -0
- package/client.d.mts +6 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -0
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/lib/advance-stream.d.mts +2 -2
- package/lib/advance-stream.d.mts.map +1 -1
- package/lib/advance-stream.d.ts +2 -2
- package/lib/advance-stream.d.ts.map +1 -1
- package/lib/advance-stream.js.map +1 -1
- package/lib/advance-stream.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +2 -2
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +2 -2
- 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.mts +1 -1
- package/resources/beta/index.d.mts.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.mts +1 -1
- package/resources/beta/threads/index.d.mts.map +1 -1
- package/resources/beta/threads/index.d.ts +1 -1
- 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.d.mts +5 -2
- package/resources/beta/threads/messages.d.mts.map +1 -1
- package/resources/beta/threads/messages.d.ts +5 -2
- package/resources/beta/threads/messages.d.ts.map +1 -1
- package/resources/beta/threads/messages.js +4 -1
- package/resources/beta/threads/messages.js.map +1 -1
- package/resources/beta/threads/messages.mjs +4 -1
- package/resources/beta/threads/messages.mjs.map +1 -1
- package/resources/beta/threads/threads.d.mts +6 -135
- package/resources/beta/threads/threads.d.mts.map +1 -1
- package/resources/beta/threads/threads.d.ts +6 -135
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js +6 -25
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs +6 -25
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/index.d.mts +2 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.mts +3 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +3 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/storage.d.mts +46 -0
- package/resources/storage.d.mts.map +1 -0
- package/resources/storage.d.ts +46 -0
- package/resources/storage.d.ts.map +1 -0
- package/resources/storage.js +24 -0
- package/resources/storage.js.map +1 -0
- package/resources/storage.mjs +20 -0
- package/resources/storage.mjs.map +1 -0
- package/resources/threads/index.d.mts +4 -0
- package/resources/threads/index.d.mts.map +1 -0
- package/resources/threads/index.d.ts +4 -0
- package/resources/threads/index.d.ts.map +1 -0
- package/resources/threads/index.js +11 -0
- package/resources/threads/index.js.map +1 -0
- package/resources/threads/index.mjs +5 -0
- package/resources/threads/index.mjs.map +1 -0
- package/resources/threads/messages.d.mts +113 -0
- package/resources/threads/messages.d.mts.map +1 -0
- package/resources/threads/messages.d.ts +113 -0
- package/resources/threads/messages.d.ts.map +1 -0
- package/resources/threads/messages.js +38 -0
- package/resources/threads/messages.js.map +1 -0
- package/resources/threads/messages.mjs +34 -0
- package/resources/threads/messages.mjs.map +1 -0
- package/resources/threads/runs.d.mts +277 -0
- package/resources/threads/runs.d.mts.map +1 -0
- package/resources/threads/runs.d.ts +277 -0
- package/resources/threads/runs.d.ts.map +1 -0
- package/resources/threads/runs.js +69 -0
- package/resources/threads/runs.js.map +1 -0
- package/resources/threads/runs.mjs +65 -0
- package/resources/threads/runs.mjs.map +1 -0
- package/resources/threads/threads.d.mts +391 -0
- package/resources/threads/threads.d.mts.map +1 -0
- package/resources/threads/threads.d.ts +391 -0
- package/resources/threads/threads.d.ts.map +1 -0
- package/resources/threads/threads.js +75 -0
- package/resources/threads/threads.js.map +1 -0
- package/resources/threads/threads.mjs +70 -0
- package/resources/threads/threads.mjs.map +1 -0
- package/resources/threads.d.mts +2 -0
- package/resources/threads.d.mts.map +1 -0
- package/resources/threads.d.ts +2 -0
- package/resources/threads.d.ts.map +1 -0
- package/resources/threads.js +6 -0
- package/resources/threads.js.map +1 -0
- package/resources/threads.mjs +3 -0
- package/resources/threads.mjs.map +1 -0
- package/src/client.ts +40 -0
- package/src/lib/advance-stream.ts +2 -2
- package/src/resources/beta/beta.ts +0 -2
- package/src/resources/beta/index.ts +0 -1
- package/src/resources/beta/threads/index.ts +0 -1
- package/src/resources/beta/threads/messages.ts +5 -2
- package/src/resources/beta/threads/threads.ts +6 -157
- package/src/resources/index.ts +15 -0
- package/src/resources/shared.ts +3 -0
- package/src/resources/storage.ts +59 -0
- package/src/resources/threads/index.ts +31 -0
- package/src/resources/threads/messages.ts +161 -0
- package/src/resources/threads/runs.ts +354 -0
- package/src/resources/threads/threads.ts +536 -0
- package/src/resources/threads.ts +3 -0
- 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
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
Thread,
|
|
28
28
|
ThreadAdvanceByIDParams,
|
|
29
29
|
ThreadAdvanceByIDResponse,
|
|
30
|
-
ThreadAdvanceParams,
|
|
31
30
|
ThreadAdvanceResponse,
|
|
32
31
|
ThreadCreateParams,
|
|
33
32
|
ThreadGenerateNameParams,
|
|
@@ -78,7 +77,6 @@ export declare namespace Beta {
|
|
|
78
77
|
type ThreadRetrieveParams as ThreadRetrieveParams,
|
|
79
78
|
type ThreadUpdateParams as ThreadUpdateParams,
|
|
80
79
|
type ThreadListParams as ThreadListParams,
|
|
81
|
-
type ThreadAdvanceParams as ThreadAdvanceParams,
|
|
82
80
|
type ThreadAdvanceByIDParams as ThreadAdvanceByIDParams,
|
|
83
81
|
type ThreadGenerateNameParams as ThreadGenerateNameParams,
|
|
84
82
|
};
|
|
@@ -59,7 +59,10 @@ export class Messages extends APIResource {
|
|
|
59
59
|
* const threadMessage =
|
|
60
60
|
* await client.beta.threads.messages.updateComponentState(
|
|
61
61
|
* 'msg_123.456',
|
|
62
|
-
* {
|
|
62
|
+
* {
|
|
63
|
+
* id: 'thr_123.456',
|
|
64
|
+
* state: { foo: 'bar' },
|
|
65
|
+
* },
|
|
63
66
|
* );
|
|
64
67
|
* ```
|
|
65
68
|
*/
|
|
@@ -150,7 +153,7 @@ export interface MessageUpdateComponentStateParams {
|
|
|
150
153
|
id: string;
|
|
151
154
|
|
|
152
155
|
/**
|
|
153
|
-
* Body param
|
|
156
|
+
* Body param
|
|
154
157
|
*/
|
|
155
158
|
state: { [key: string]: unknown };
|
|
156
159
|
}
|
|
@@ -107,37 +107,18 @@ export class Threads extends APIResource {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* This endpoint has been deprecated. Use POST /advancestream instead.
|
|
111
111
|
*
|
|
112
|
-
* @
|
|
113
|
-
* ```ts
|
|
114
|
-
* const response = await client.beta.threads.advance({
|
|
115
|
-
* messageToAppend: {
|
|
116
|
-
* content: [{ type: 'text' }],
|
|
117
|
-
* role: 'user',
|
|
118
|
-
* },
|
|
119
|
-
* });
|
|
120
|
-
* ```
|
|
112
|
+
* @deprecated
|
|
121
113
|
*/
|
|
122
|
-
advance(
|
|
123
|
-
return this._client.post('/threads/advance',
|
|
114
|
+
advance(options?: RequestOptions): APIPromise<ThreadAdvanceResponse> {
|
|
115
|
+
return this._client.post('/threads/advance', options);
|
|
124
116
|
}
|
|
125
117
|
|
|
126
118
|
/**
|
|
127
|
-
*
|
|
119
|
+
* This endpoint has been deprecated. Use POST /:id/advancestream instead.
|
|
128
120
|
*
|
|
129
|
-
* @
|
|
130
|
-
* ```ts
|
|
131
|
-
* const response = await client.beta.threads.advanceByID(
|
|
132
|
-
* 'thr_123.456',
|
|
133
|
-
* {
|
|
134
|
-
* messageToAppend: {
|
|
135
|
-
* content: [{ type: 'text' }],
|
|
136
|
-
* role: 'user',
|
|
137
|
-
* },
|
|
138
|
-
* },
|
|
139
|
-
* );
|
|
140
|
-
* ```
|
|
121
|
+
* @deprecated
|
|
141
122
|
*/
|
|
142
123
|
advanceByID(
|
|
143
124
|
id: string,
|
|
@@ -498,137 +479,6 @@ export interface ThreadListParams extends OffsetAndLimitParams {
|
|
|
498
479
|
contextKey?: string;
|
|
499
480
|
}
|
|
500
481
|
|
|
501
|
-
export interface ThreadAdvanceParams {
|
|
502
|
-
messageToAppend: ThreadAdvanceParams.MessageToAppend;
|
|
503
|
-
|
|
504
|
-
availableComponents?: Array<Shared.AvailableComponent>;
|
|
505
|
-
|
|
506
|
-
clientTools?: Array<Shared.ComponentContextToolMetadata>;
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Unique user identifier for the thread
|
|
510
|
-
*/
|
|
511
|
-
contextKey?: string;
|
|
512
|
-
|
|
513
|
-
forceToolChoice?: string;
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Initial messages to include when creating a new thread
|
|
517
|
-
*/
|
|
518
|
-
initialMessages?: Array<ThreadAdvanceParams.InitialMessage>;
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Tool call counts
|
|
522
|
-
*/
|
|
523
|
-
toolCallCounts?: { [key: string]: number };
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
export namespace ThreadAdvanceParams {
|
|
527
|
-
export interface MessageToAppend {
|
|
528
|
-
content: Array<ThreadsAPI.ChatCompletionContentPart>;
|
|
529
|
-
|
|
530
|
-
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* @deprecated No longer used - instead set role and the tool call information
|
|
534
|
-
*/
|
|
535
|
-
actionType?: 'tool_call' | 'tool_response';
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* Additional context to provide to the AI beyond the user query, such as the info
|
|
539
|
-
* about the current page the user is visiting.
|
|
540
|
-
*/
|
|
541
|
-
additionalContext?: { [key: string]: unknown };
|
|
542
|
-
|
|
543
|
-
component?: ThreadsAPI.ComponentDecisionV2;
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* The initial state of the component
|
|
547
|
-
*/
|
|
548
|
-
componentState?: { [key: string]: unknown };
|
|
549
|
-
|
|
550
|
-
error?: string;
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Whether the message has been cancelled
|
|
554
|
-
*/
|
|
555
|
-
isCancelled?: boolean;
|
|
556
|
-
|
|
557
|
-
metadata?: { [key: string]: unknown };
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* Reasoning text from the LLM, if the model supports it.
|
|
561
|
-
*/
|
|
562
|
-
reasoning?: Array<string>;
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Duration of reasoning in milliseconds
|
|
566
|
-
*/
|
|
567
|
-
reasoningDurationMS?: number;
|
|
568
|
-
|
|
569
|
-
tool_call_id?: string;
|
|
570
|
-
|
|
571
|
-
toolCallRequest?: Shared.ToolCallRequest;
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* @deprecated Put the response in the content instead
|
|
575
|
-
*/
|
|
576
|
-
toolResponse?: unknown;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
export interface InitialMessage {
|
|
580
|
-
content: Array<ThreadsAPI.ChatCompletionContentPart>;
|
|
581
|
-
|
|
582
|
-
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* @deprecated No longer used - instead set role and the tool call information
|
|
586
|
-
*/
|
|
587
|
-
actionType?: 'tool_call' | 'tool_response';
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Additional context to provide to the AI beyond the user query, such as the info
|
|
591
|
-
* about the current page the user is visiting.
|
|
592
|
-
*/
|
|
593
|
-
additionalContext?: { [key: string]: unknown };
|
|
594
|
-
|
|
595
|
-
component?: ThreadsAPI.ComponentDecisionV2;
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* The initial state of the component
|
|
599
|
-
*/
|
|
600
|
-
componentState?: { [key: string]: unknown };
|
|
601
|
-
|
|
602
|
-
error?: string;
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Whether the message has been cancelled
|
|
606
|
-
*/
|
|
607
|
-
isCancelled?: boolean;
|
|
608
|
-
|
|
609
|
-
metadata?: { [key: string]: unknown };
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* Reasoning text from the LLM, if the model supports it.
|
|
613
|
-
*/
|
|
614
|
-
reasoning?: Array<string>;
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Duration of reasoning in milliseconds
|
|
618
|
-
*/
|
|
619
|
-
reasoningDurationMS?: number;
|
|
620
|
-
|
|
621
|
-
tool_call_id?: string;
|
|
622
|
-
|
|
623
|
-
toolCallRequest?: Shared.ToolCallRequest;
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* @deprecated Put the response in the content instead
|
|
627
|
-
*/
|
|
628
|
-
toolResponse?: unknown;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
482
|
export interface ThreadAdvanceByIDParams {
|
|
633
483
|
messageToAppend: ThreadAdvanceByIDParams.MessageToAppend;
|
|
634
484
|
|
|
@@ -784,7 +634,6 @@ export declare namespace Threads {
|
|
|
784
634
|
type ThreadRetrieveParams as ThreadRetrieveParams,
|
|
785
635
|
type ThreadUpdateParams as ThreadUpdateParams,
|
|
786
636
|
type ThreadListParams as ThreadListParams,
|
|
787
|
-
type ThreadAdvanceParams as ThreadAdvanceParams,
|
|
788
637
|
type ThreadAdvanceByIDParams as ThreadAdvanceByIDParams,
|
|
789
638
|
type ThreadGenerateNameParams as ThreadGenerateNameParams,
|
|
790
639
|
};
|
package/src/resources/index.ts
CHANGED
|
@@ -2,3 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
export * from './shared';
|
|
4
4
|
export { Beta } from './beta/beta';
|
|
5
|
+
export { Storage, type StoragePresignResponse, type StoragePresignParams } from './storage';
|
|
6
|
+
export {
|
|
7
|
+
Threads,
|
|
8
|
+
type ComponentContent,
|
|
9
|
+
type ResourceContent,
|
|
10
|
+
type RunError,
|
|
11
|
+
type TextContent,
|
|
12
|
+
type ToolResultContent,
|
|
13
|
+
type ToolUseContent,
|
|
14
|
+
type ThreadCreateResponse,
|
|
15
|
+
type ThreadRetrieveResponse,
|
|
16
|
+
type ThreadListResponse,
|
|
17
|
+
type ThreadCreateParams,
|
|
18
|
+
type ThreadListParams,
|
|
19
|
+
} from './threads/threads';
|
package/src/resources/shared.ts
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
export class Storage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a presigned URL that allows direct file upload to S3. The client should
|
|
10
|
+
* PUT the file directly to the returned uploadUrl.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const response = await client.storage.presign({
|
|
15
|
+
* contentType: 'application/pdf',
|
|
16
|
+
* size: 1024000,
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
presign(body: StoragePresignParams, options?: RequestOptions): APIPromise<StoragePresignResponse> {
|
|
21
|
+
return this._client.post('/storage/presign', { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface StoragePresignResponse {
|
|
26
|
+
/**
|
|
27
|
+
* The attachment URI to reference this file in messages
|
|
28
|
+
*/
|
|
29
|
+
attachmentUri: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Time in seconds until the presigned URL expires
|
|
33
|
+
*/
|
|
34
|
+
expiresIn: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The presigned URL to PUT the file directly to S3
|
|
38
|
+
*/
|
|
39
|
+
uploadUrl: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface StoragePresignParams {
|
|
43
|
+
/**
|
|
44
|
+
* The MIME type of the file
|
|
45
|
+
*/
|
|
46
|
+
contentType: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The file size in bytes (max 10MB)
|
|
50
|
+
*/
|
|
51
|
+
size: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export declare namespace Storage {
|
|
55
|
+
export {
|
|
56
|
+
type StoragePresignResponse as StoragePresignResponse,
|
|
57
|
+
type StoragePresignParams as StoragePresignParams,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Messages,
|
|
5
|
+
type MessageListResponse,
|
|
6
|
+
type MessageGetResponse,
|
|
7
|
+
type MessageListParams,
|
|
8
|
+
type MessageGetParams,
|
|
9
|
+
} from './messages';
|
|
10
|
+
export {
|
|
11
|
+
Runs,
|
|
12
|
+
type InputMessage,
|
|
13
|
+
type RunDeleteResponse,
|
|
14
|
+
type RunCreateParams,
|
|
15
|
+
type RunDeleteParams,
|
|
16
|
+
type RunRunParams,
|
|
17
|
+
} from './runs';
|
|
18
|
+
export {
|
|
19
|
+
Threads,
|
|
20
|
+
type ComponentContent,
|
|
21
|
+
type ResourceContent,
|
|
22
|
+
type RunError,
|
|
23
|
+
type TextContent,
|
|
24
|
+
type ToolResultContent,
|
|
25
|
+
type ToolUseContent,
|
|
26
|
+
type ThreadCreateResponse,
|
|
27
|
+
type ThreadRetrieveResponse,
|
|
28
|
+
type ThreadListResponse,
|
|
29
|
+
type ThreadCreateParams,
|
|
30
|
+
type ThreadListParams,
|
|
31
|
+
} from './threads';
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as ThreadsAPI from './threads';
|
|
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 Messages extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* List messages in a thread. Supports cursor-based pagination and ordering.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const messages = await client.threads.messages.list(
|
|
16
|
+
* 'thr_abc123xyz',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
list(
|
|
21
|
+
threadID: string,
|
|
22
|
+
query: MessageListParams | null | undefined = {},
|
|
23
|
+
options?: RequestOptions,
|
|
24
|
+
): APIPromise<MessageListResponse> {
|
|
25
|
+
return this._client.get(path`/v1/threads/${threadID}/messages`, { query, ...options });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get a specific message by ID from a thread.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const message = await client.threads.messages.get(
|
|
34
|
+
* 'msg_xyz789abc',
|
|
35
|
+
* { threadId: 'thr_abc123xyz' },
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
get(messageID: string, params: MessageGetParams, options?: RequestOptions): APIPromise<MessageGetResponse> {
|
|
40
|
+
const { threadId } = params;
|
|
41
|
+
return this._client.get(path`/v1/threads/${threadId}/messages/${messageID}`, options);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface MessageListResponse {
|
|
46
|
+
/**
|
|
47
|
+
* Whether there are more results
|
|
48
|
+
*/
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* List of messages in the thread
|
|
53
|
+
*/
|
|
54
|
+
messages: Array<MessageListResponse.Message>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Cursor for the next page of results
|
|
58
|
+
*/
|
|
59
|
+
nextCursor?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export namespace MessageListResponse {
|
|
63
|
+
export interface Message {
|
|
64
|
+
/**
|
|
65
|
+
* Unique identifier for this message
|
|
66
|
+
*/
|
|
67
|
+
id: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Content blocks in this message
|
|
71
|
+
*/
|
|
72
|
+
content: Array<
|
|
73
|
+
| ThreadsAPI.TextContent
|
|
74
|
+
| ThreadsAPI.ResourceContent
|
|
75
|
+
| ThreadsAPI.ToolUseContent
|
|
76
|
+
| ThreadsAPI.ToolResultContent
|
|
77
|
+
| ThreadsAPI.ComponentContent
|
|
78
|
+
>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Message role
|
|
82
|
+
*/
|
|
83
|
+
role: 'user' | 'assistant' | 'system';
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* When the message was created (ISO 8601)
|
|
87
|
+
*/
|
|
88
|
+
createdAt?: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Additional metadata
|
|
92
|
+
*/
|
|
93
|
+
metadata?: unknown;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface MessageGetResponse {
|
|
98
|
+
/**
|
|
99
|
+
* Unique identifier for this message
|
|
100
|
+
*/
|
|
101
|
+
id: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Content blocks in this message
|
|
105
|
+
*/
|
|
106
|
+
content: Array<
|
|
107
|
+
| ThreadsAPI.TextContent
|
|
108
|
+
| ThreadsAPI.ResourceContent
|
|
109
|
+
| ThreadsAPI.ToolUseContent
|
|
110
|
+
| ThreadsAPI.ToolResultContent
|
|
111
|
+
| ThreadsAPI.ComponentContent
|
|
112
|
+
>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Message role
|
|
116
|
+
*/
|
|
117
|
+
role: 'user' | 'assistant' | 'system';
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* When the message was created (ISO 8601)
|
|
121
|
+
*/
|
|
122
|
+
createdAt?: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Additional metadata
|
|
126
|
+
*/
|
|
127
|
+
metadata?: unknown;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface MessageListParams {
|
|
131
|
+
/**
|
|
132
|
+
* Cursor for pagination
|
|
133
|
+
*/
|
|
134
|
+
cursor?: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Maximum number of messages to return
|
|
138
|
+
*/
|
|
139
|
+
limit?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Sort order: 'asc' for oldest first, 'desc' for newest first
|
|
143
|
+
*/
|
|
144
|
+
order?: 'asc' | 'desc';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface MessageGetParams {
|
|
148
|
+
/**
|
|
149
|
+
* Thread ID
|
|
150
|
+
*/
|
|
151
|
+
threadId: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export declare namespace Messages {
|
|
155
|
+
export {
|
|
156
|
+
type MessageListResponse as MessageListResponse,
|
|
157
|
+
type MessageGetResponse as MessageGetResponse,
|
|
158
|
+
type MessageListParams as MessageListParams,
|
|
159
|
+
type MessageGetParams as MessageGetParams,
|
|
160
|
+
};
|
|
161
|
+
}
|