@zavudev/sdk 0.16.0 → 0.18.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 +16 -0
- package/client.d.mts +11 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +11 -5
- package/client.d.ts.map +1 -1
- package/client.js +7 -1
- package/client.js.map +1 -1
- package/client.mjs +7 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/addresses.d.mts +104 -0
- package/resources/addresses.d.mts.map +1 -0
- package/resources/addresses.d.ts +104 -0
- package/resources/addresses.d.ts.map +1 -0
- package/resources/addresses.js +72 -0
- package/resources/addresses.js.map +1 -0
- package/resources/addresses.mjs +68 -0
- package/resources/addresses.mjs.map +1 -0
- package/resources/broadcasts/broadcasts.d.mts +27 -5
- package/resources/broadcasts/broadcasts.d.mts.map +1 -1
- package/resources/broadcasts/broadcasts.d.ts +27 -5
- package/resources/broadcasts/broadcasts.d.ts.map +1 -1
- package/resources/broadcasts/broadcasts.js +15 -0
- package/resources/broadcasts/broadcasts.js.map +1 -1
- package/resources/broadcasts/broadcasts.mjs +15 -0
- package/resources/broadcasts/broadcasts.mjs.map +1 -1
- package/resources/broadcasts/index.d.mts +1 -1
- package/resources/broadcasts/index.d.mts.map +1 -1
- package/resources/broadcasts/index.d.ts +1 -1
- package/resources/broadcasts/index.d.ts.map +1 -1
- package/resources/broadcasts/index.js.map +1 -1
- package/resources/broadcasts/index.mjs.map +1 -1
- package/resources/index.d.mts +5 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +5 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +6 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -1
- package/resources/index.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +67 -1
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +67 -1
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers.js +15 -0
- package/resources/phone-numbers.js.map +1 -1
- package/resources/phone-numbers.mjs +15 -0
- package/resources/phone-numbers.mjs.map +1 -1
- package/resources/regulatory-documents.d.mts +114 -0
- package/resources/regulatory-documents.d.mts.map +1 -0
- package/resources/regulatory-documents.d.ts +114 -0
- package/resources/regulatory-documents.d.ts.map +1 -0
- package/resources/regulatory-documents.js +84 -0
- package/resources/regulatory-documents.js.map +1 -0
- package/resources/regulatory-documents.mjs +80 -0
- package/resources/regulatory-documents.mjs.map +1 -0
- package/resources/senders/agent/agent.d.mts +230 -0
- package/resources/senders/agent/agent.d.mts.map +1 -0
- package/resources/senders/agent/agent.d.ts +230 -0
- package/resources/senders/agent/agent.d.ts.map +1 -0
- package/resources/senders/agent/agent.js +105 -0
- package/resources/senders/agent/agent.js.map +1 -0
- package/resources/senders/agent/agent.mjs +100 -0
- package/resources/senders/agent/agent.mjs.map +1 -0
- package/resources/senders/agent/executions.d.mts +32 -0
- package/resources/senders/agent/executions.d.mts.map +1 -0
- package/resources/senders/agent/executions.d.ts +32 -0
- package/resources/senders/agent/executions.d.ts.map +1 -0
- package/resources/senders/agent/executions.js +27 -0
- package/resources/senders/agent/executions.js.map +1 -0
- package/resources/senders/agent/executions.mjs +23 -0
- package/resources/senders/agent/executions.mjs.map +1 -0
- package/resources/senders/agent/flows.d.mts +301 -0
- package/resources/senders/agent/flows.d.mts.map +1 -0
- package/resources/senders/agent/flows.d.ts +301 -0
- package/resources/senders/agent/flows.d.ts.map +1 -0
- package/resources/senders/agent/flows.js +135 -0
- package/resources/senders/agent/flows.js.map +1 -0
- package/resources/senders/agent/flows.mjs +131 -0
- package/resources/senders/agent/flows.mjs.map +1 -0
- package/resources/senders/agent/index.d.mts +6 -0
- package/resources/senders/agent/index.d.mts.map +1 -0
- package/resources/senders/agent/index.d.ts +6 -0
- package/resources/senders/agent/index.d.ts.map +1 -0
- package/resources/senders/agent/index.js +15 -0
- package/resources/senders/agent/index.js.map +1 -0
- package/resources/senders/agent/index.mjs +7 -0
- package/resources/senders/agent/index.mjs.map +1 -0
- package/resources/senders/agent/knowledge-bases/documents.d.mts +86 -0
- package/resources/senders/agent/knowledge-bases/documents.d.mts.map +1 -0
- package/resources/senders/agent/knowledge-bases/documents.d.ts +86 -0
- package/resources/senders/agent/knowledge-bases/documents.d.ts.map +1 -0
- package/resources/senders/agent/knowledge-bases/documents.js +70 -0
- package/resources/senders/agent/knowledge-bases/documents.js.map +1 -0
- package/resources/senders/agent/knowledge-bases/documents.mjs +66 -0
- package/resources/senders/agent/knowledge-bases/documents.mjs.map +1 -0
- package/resources/senders/agent/knowledge-bases/index.d.mts +3 -0
- package/resources/senders/agent/knowledge-bases/index.d.mts.map +1 -0
- package/resources/senders/agent/knowledge-bases/index.d.ts +3 -0
- package/resources/senders/agent/knowledge-bases/index.d.ts.map +1 -0
- package/resources/senders/agent/knowledge-bases/index.js +9 -0
- package/resources/senders/agent/knowledge-bases/index.js.map +1 -0
- package/resources/senders/agent/knowledge-bases/index.mjs +4 -0
- package/resources/senders/agent/knowledge-bases/index.mjs.map +1 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts +147 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts.map +1 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts +147 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts.map +1 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.js +106 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.js.map +1 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs +101 -0
- package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs.map +1 -0
- package/resources/senders/agent/knowledge-bases.d.mts +2 -0
- package/resources/senders/agent/knowledge-bases.d.mts.map +1 -0
- package/resources/senders/agent/knowledge-bases.d.ts +2 -0
- package/resources/senders/agent/knowledge-bases.d.ts.map +1 -0
- package/resources/senders/agent/knowledge-bases.js +6 -0
- package/resources/senders/agent/knowledge-bases.js.map +1 -0
- package/resources/senders/agent/knowledge-bases.mjs +3 -0
- package/resources/senders/agent/knowledge-bases.mjs.map +1 -0
- package/resources/senders/agent/tools.d.mts +242 -0
- package/resources/senders/agent/tools.d.mts.map +1 -0
- package/resources/senders/agent/tools.d.ts +242 -0
- package/resources/senders/agent/tools.d.ts.map +1 -0
- package/resources/senders/agent/tools.js +126 -0
- package/resources/senders/agent/tools.js.map +1 -0
- package/resources/senders/agent/tools.mjs +122 -0
- package/resources/senders/agent/tools.mjs.map +1 -0
- package/resources/senders/agent.d.mts +2 -0
- package/resources/senders/agent.d.mts.map +1 -0
- package/resources/senders/agent.d.ts +2 -0
- package/resources/senders/agent.d.ts.map +1 -0
- package/resources/senders/agent.js +6 -0
- package/resources/senders/agent.js.map +1 -0
- package/resources/senders/agent.mjs +3 -0
- package/resources/senders/agent.mjs.map +1 -0
- package/resources/senders/index.d.mts +3 -0
- package/resources/senders/index.d.mts.map +1 -0
- package/resources/senders/index.d.ts +3 -0
- package/resources/senders/index.d.ts.map +1 -0
- package/resources/senders/index.js +9 -0
- package/resources/senders/index.js.map +1 -0
- package/resources/senders/index.mjs +4 -0
- package/resources/senders/index.mjs.map +1 -0
- package/resources/senders/senders.d.mts +342 -0
- package/resources/senders/senders.d.mts.map +1 -0
- package/resources/senders/senders.d.ts +342 -0
- package/resources/senders/senders.d.ts.map +1 -0
- package/resources/senders/senders.js +150 -0
- package/resources/senders/senders.js.map +1 -0
- package/resources/senders/senders.mjs +145 -0
- package/resources/senders/senders.mjs.map +1 -0
- package/resources/senders.d.mts +1 -337
- package/resources/senders.d.mts.map +1 -1
- package/resources/senders.d.ts +1 -337
- package/resources/senders.d.ts.map +1 -1
- package/resources/senders.js +2 -138
- package/resources/senders.js.map +1 -1
- package/resources/senders.mjs +1 -136
- package/resources/senders.mjs.map +1 -1
- package/src/client.ts +79 -17
- package/src/resources/addresses.ts +160 -0
- package/src/resources/broadcasts/broadcasts.ts +37 -4
- package/src/resources/broadcasts/index.ts +2 -0
- package/src/resources/index.ts +29 -1
- package/src/resources/phone-numbers.ts +97 -0
- package/src/resources/regulatory-documents.ts +184 -0
- package/src/resources/senders/agent/agent.ts +417 -0
- package/src/resources/senders/agent/executions.ts +48 -0
- package/src/resources/senders/agent/flows.ts +409 -0
- package/src/resources/senders/agent/index.ts +60 -0
- package/src/resources/senders/agent/knowledge-bases/documents.ts +133 -0
- package/src/resources/senders/agent/knowledge-bases/index.ts +24 -0
- package/src/resources/senders/agent/knowledge-bases/knowledge-bases.ts +251 -0
- package/src/resources/senders/agent/knowledge-bases.ts +3 -0
- package/src/resources/senders/agent/tools.ts +334 -0
- package/src/resources/senders/agent.ts +3 -0
- package/src/resources/senders/index.ts +32 -0
- package/src/resources/senders/senders.ts +506 -0
- package/src/resources/senders.ts +1 -476
- 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,184 @@
|
|
|
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 { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
6
|
+
import { buildHeaders } from '../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class RegulatoryDocuments extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Create a regulatory document record after uploading the file. Use the upload-url
|
|
13
|
+
* endpoint first to get an upload URL.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const regulatoryDocument =
|
|
18
|
+
* await client.regulatoryDocuments.create({
|
|
19
|
+
* documentType: 'passport',
|
|
20
|
+
* fileSize: 102400,
|
|
21
|
+
* mimeType: 'image/jpeg',
|
|
22
|
+
* name: 'Passport Scan',
|
|
23
|
+
* storageId: 'kg2abc123...',
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
create(
|
|
28
|
+
body: RegulatoryDocumentCreateParams,
|
|
29
|
+
options?: RequestOptions,
|
|
30
|
+
): APIPromise<RegulatoryDocumentCreateResponse> {
|
|
31
|
+
return this._client.post('/v1/documents', { body, ...options });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get a specific regulatory document.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const regulatoryDocument =
|
|
40
|
+
* await client.regulatoryDocuments.retrieve('documentId');
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
retrieve(documentID: string, options?: RequestOptions): APIPromise<RegulatoryDocumentRetrieveResponse> {
|
|
44
|
+
return this._client.get(path`/v1/documents/${documentID}`, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* List regulatory documents for this project.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* // Automatically fetches more pages as needed.
|
|
53
|
+
* for await (const regulatoryDocument of client.regulatoryDocuments.list()) {
|
|
54
|
+
* // ...
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
list(
|
|
59
|
+
query: RegulatoryDocumentListParams | null | undefined = {},
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): PagePromise<RegulatoryDocumentsCursor, RegulatoryDocument> {
|
|
62
|
+
return this._client.getAPIList('/v1/documents', Cursor<RegulatoryDocument>, { query, ...options });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Delete a regulatory document. Cannot delete verified documents.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* await client.regulatoryDocuments.delete('documentId');
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
delete(documentID: string, options?: RequestOptions): APIPromise<void> {
|
|
74
|
+
return this._client.delete(path`/v1/documents/${documentID}`, {
|
|
75
|
+
...options,
|
|
76
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get a presigned URL to upload a document file. After uploading, use the
|
|
82
|
+
* storageId to create the document record.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const response =
|
|
87
|
+
* await client.regulatoryDocuments.uploadURL();
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
uploadURL(options?: RequestOptions): APIPromise<RegulatoryDocumentUploadURLResponse> {
|
|
91
|
+
return this._client.post('/v1/documents/upload-url', options);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type RegulatoryDocumentsCursor = Cursor<RegulatoryDocument>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A regulatory document for phone number requirements.
|
|
99
|
+
*/
|
|
100
|
+
export interface RegulatoryDocument {
|
|
101
|
+
id: string;
|
|
102
|
+
|
|
103
|
+
createdAt: string;
|
|
104
|
+
|
|
105
|
+
documentType:
|
|
106
|
+
| 'passport'
|
|
107
|
+
| 'national_id'
|
|
108
|
+
| 'drivers_license'
|
|
109
|
+
| 'utility_bill'
|
|
110
|
+
| 'tax_id'
|
|
111
|
+
| 'business_registration'
|
|
112
|
+
| 'proof_of_address'
|
|
113
|
+
| 'other';
|
|
114
|
+
|
|
115
|
+
name: string;
|
|
116
|
+
|
|
117
|
+
status: 'pending' | 'uploaded' | 'verified' | 'rejected';
|
|
118
|
+
|
|
119
|
+
fileSize?: number;
|
|
120
|
+
|
|
121
|
+
mimeType?: string;
|
|
122
|
+
|
|
123
|
+
rejectionReason?: string | null;
|
|
124
|
+
|
|
125
|
+
updatedAt?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface RegulatoryDocumentCreateResponse {
|
|
129
|
+
/**
|
|
130
|
+
* A regulatory document for phone number requirements.
|
|
131
|
+
*/
|
|
132
|
+
document: RegulatoryDocument;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface RegulatoryDocumentRetrieveResponse {
|
|
136
|
+
/**
|
|
137
|
+
* A regulatory document for phone number requirements.
|
|
138
|
+
*/
|
|
139
|
+
document: RegulatoryDocument;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface RegulatoryDocumentUploadURLResponse {
|
|
143
|
+
/**
|
|
144
|
+
* Pre-signed URL for uploading the file.
|
|
145
|
+
*/
|
|
146
|
+
uploadUrl: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface RegulatoryDocumentCreateParams {
|
|
150
|
+
documentType:
|
|
151
|
+
| 'passport'
|
|
152
|
+
| 'national_id'
|
|
153
|
+
| 'drivers_license'
|
|
154
|
+
| 'utility_bill'
|
|
155
|
+
| 'tax_id'
|
|
156
|
+
| 'business_registration'
|
|
157
|
+
| 'proof_of_address'
|
|
158
|
+
| 'other';
|
|
159
|
+
|
|
160
|
+
fileSize: number;
|
|
161
|
+
|
|
162
|
+
mimeType: string;
|
|
163
|
+
|
|
164
|
+
name: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Storage ID from the upload-url endpoint.
|
|
168
|
+
*/
|
|
169
|
+
storageId: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface RegulatoryDocumentListParams extends CursorParams {}
|
|
173
|
+
|
|
174
|
+
export declare namespace RegulatoryDocuments {
|
|
175
|
+
export {
|
|
176
|
+
type RegulatoryDocument as RegulatoryDocument,
|
|
177
|
+
type RegulatoryDocumentCreateResponse as RegulatoryDocumentCreateResponse,
|
|
178
|
+
type RegulatoryDocumentRetrieveResponse as RegulatoryDocumentRetrieveResponse,
|
|
179
|
+
type RegulatoryDocumentUploadURLResponse as RegulatoryDocumentUploadURLResponse,
|
|
180
|
+
type RegulatoryDocumentsCursor as RegulatoryDocumentsCursor,
|
|
181
|
+
type RegulatoryDocumentCreateParams as RegulatoryDocumentCreateParams,
|
|
182
|
+
type RegulatoryDocumentListParams as RegulatoryDocumentListParams,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as ExecutionsAPI from './executions';
|
|
5
|
+
import { ExecutionListParams, Executions } from './executions';
|
|
6
|
+
import * as FlowsAPI from './flows';
|
|
7
|
+
import {
|
|
8
|
+
AgentFlow,
|
|
9
|
+
AgentFlowsCursor,
|
|
10
|
+
FlowCreateParams,
|
|
11
|
+
FlowCreateResponse,
|
|
12
|
+
FlowDeleteParams,
|
|
13
|
+
FlowDuplicateParams,
|
|
14
|
+
FlowDuplicateResponse,
|
|
15
|
+
FlowListParams,
|
|
16
|
+
FlowRetrieveParams,
|
|
17
|
+
FlowRetrieveResponse,
|
|
18
|
+
FlowUpdateParams,
|
|
19
|
+
FlowUpdateResponse,
|
|
20
|
+
Flows,
|
|
21
|
+
} from './flows';
|
|
22
|
+
import * as ToolsAPI from './tools';
|
|
23
|
+
import {
|
|
24
|
+
AgentTool,
|
|
25
|
+
AgentToolsCursor,
|
|
26
|
+
ToolCreateParams,
|
|
27
|
+
ToolCreateResponse,
|
|
28
|
+
ToolDeleteParams,
|
|
29
|
+
ToolListParams,
|
|
30
|
+
ToolRetrieveParams,
|
|
31
|
+
ToolRetrieveResponse,
|
|
32
|
+
ToolTestParams,
|
|
33
|
+
ToolTestResponse,
|
|
34
|
+
ToolUpdateParams,
|
|
35
|
+
ToolUpdateResponse,
|
|
36
|
+
Tools,
|
|
37
|
+
} from './tools';
|
|
38
|
+
import * as KnowledgeBasesAPI from './knowledge-bases/knowledge-bases';
|
|
39
|
+
import {
|
|
40
|
+
AgentDocument,
|
|
41
|
+
AgentKnowledgeBase,
|
|
42
|
+
AgentKnowledgeBasesCursor,
|
|
43
|
+
KnowledgeBaseCreateParams,
|
|
44
|
+
KnowledgeBaseCreateResponse,
|
|
45
|
+
KnowledgeBaseDeleteParams,
|
|
46
|
+
KnowledgeBaseListParams,
|
|
47
|
+
KnowledgeBaseRetrieveParams,
|
|
48
|
+
KnowledgeBaseRetrieveResponse,
|
|
49
|
+
KnowledgeBaseUpdateParams,
|
|
50
|
+
KnowledgeBaseUpdateResponse,
|
|
51
|
+
KnowledgeBases,
|
|
52
|
+
} from './knowledge-bases/knowledge-bases';
|
|
53
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
54
|
+
import { Cursor } from '../../../core/pagination';
|
|
55
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
56
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
57
|
+
import { path } from '../../../internal/utils/path';
|
|
58
|
+
|
|
59
|
+
export class AgentResource extends APIResource {
|
|
60
|
+
executions: ExecutionsAPI.Executions = new ExecutionsAPI.Executions(this._client);
|
|
61
|
+
flows: FlowsAPI.Flows = new FlowsAPI.Flows(this._client);
|
|
62
|
+
tools: ToolsAPI.Tools = new ToolsAPI.Tools(this._client);
|
|
63
|
+
knowledgeBases: KnowledgeBasesAPI.KnowledgeBases = new KnowledgeBasesAPI.KnowledgeBases(this._client);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Create an AI agent for a sender. Each sender can have at most one agent.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const agentResponse = await client.senders.agent.create(
|
|
71
|
+
* 'senderId',
|
|
72
|
+
* {
|
|
73
|
+
* model: 'gpt-4o-mini',
|
|
74
|
+
* name: 'Customer Support',
|
|
75
|
+
* provider: 'openai',
|
|
76
|
+
* systemPrompt:
|
|
77
|
+
* 'You are a helpful customer support agent. Be friendly and concise.',
|
|
78
|
+
* apiKey: 'sk-...',
|
|
79
|
+
* },
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
create(senderID: string, body: AgentCreateParams, options?: RequestOptions): APIPromise<AgentResponse> {
|
|
84
|
+
return this._client.post(path`/v1/senders/${senderID}/agent`, { body, ...options });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get the AI agent configuration for a sender.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const agentResponse = await client.senders.agent.retrieve(
|
|
93
|
+
* 'senderId',
|
|
94
|
+
* );
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
retrieve(senderID: string, options?: RequestOptions): APIPromise<AgentResponse> {
|
|
98
|
+
return this._client.get(path`/v1/senders/${senderID}/agent`, options);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Update an AI agent's configuration.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const agentResponse = await client.senders.agent.update(
|
|
107
|
+
* 'senderId',
|
|
108
|
+
* );
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
update(senderID: string, body: AgentUpdateParams, options?: RequestOptions): APIPromise<AgentResponse> {
|
|
112
|
+
return this._client.patch(path`/v1/senders/${senderID}/agent`, { body, ...options });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Delete an AI agent.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* await client.senders.agent.delete('senderId');
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
delete(senderID: string, options?: RequestOptions): APIPromise<void> {
|
|
124
|
+
return this._client.delete(path`/v1/senders/${senderID}/agent`, {
|
|
125
|
+
...options,
|
|
126
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get statistics for an AI agent including invocations, tokens, and costs.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const agentStats = await client.senders.agent.stats(
|
|
136
|
+
* 'senderId',
|
|
137
|
+
* );
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
stats(senderID: string, options?: RequestOptions): APIPromise<AgentStats> {
|
|
141
|
+
return this._client.get(path`/v1/senders/${senderID}/agent/stats`, options);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type AgentExecutionsCursor = Cursor<AgentExecution>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* AI Agent configuration for a sender.
|
|
149
|
+
*/
|
|
150
|
+
export interface Agent {
|
|
151
|
+
id: string;
|
|
152
|
+
|
|
153
|
+
createdAt: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Whether the agent is active.
|
|
157
|
+
*/
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Model ID (e.g., gpt-4o-mini, claude-3-5-sonnet).
|
|
162
|
+
*/
|
|
163
|
+
model: string;
|
|
164
|
+
|
|
165
|
+
name: string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* LLM provider for the AI agent.
|
|
169
|
+
*/
|
|
170
|
+
provider: AgentProvider;
|
|
171
|
+
|
|
172
|
+
senderId: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* System prompt for the agent.
|
|
176
|
+
*/
|
|
177
|
+
systemPrompt: string;
|
|
178
|
+
|
|
179
|
+
updatedAt: string;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Number of previous messages to include as context.
|
|
183
|
+
*/
|
|
184
|
+
contextWindowMessages?: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Whether to include contact metadata in context.
|
|
188
|
+
*/
|
|
189
|
+
includeContactMetadata?: boolean;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Maximum tokens for LLM response.
|
|
193
|
+
*/
|
|
194
|
+
maxTokens?: number | null;
|
|
195
|
+
|
|
196
|
+
stats?: Agent.Stats;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* LLM temperature (0-2).
|
|
200
|
+
*/
|
|
201
|
+
temperature?: number | null;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Channels that trigger the agent.
|
|
205
|
+
*/
|
|
206
|
+
triggerOnChannels?: Array<string>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Message types that trigger the agent.
|
|
210
|
+
*/
|
|
211
|
+
triggerOnMessageTypes?: Array<string>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export namespace Agent {
|
|
215
|
+
export interface Stats {
|
|
216
|
+
/**
|
|
217
|
+
* Total cost in USD.
|
|
218
|
+
*/
|
|
219
|
+
totalCost?: number;
|
|
220
|
+
|
|
221
|
+
totalInvocations?: number;
|
|
222
|
+
|
|
223
|
+
totalTokensUsed?: number;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface AgentExecution {
|
|
228
|
+
id: string;
|
|
229
|
+
|
|
230
|
+
agentId: string;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Cost in USD.
|
|
234
|
+
*/
|
|
235
|
+
cost: number;
|
|
236
|
+
|
|
237
|
+
createdAt: string;
|
|
238
|
+
|
|
239
|
+
inputTokens: number;
|
|
240
|
+
|
|
241
|
+
latencyMs: number;
|
|
242
|
+
|
|
243
|
+
outputTokens: number;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Status of an agent execution.
|
|
247
|
+
*/
|
|
248
|
+
status: AgentExecutionStatus;
|
|
249
|
+
|
|
250
|
+
errorMessage?: string | null;
|
|
251
|
+
|
|
252
|
+
inboundMessageId?: string;
|
|
253
|
+
|
|
254
|
+
responseMessageId?: string | null;
|
|
255
|
+
|
|
256
|
+
responseText?: string | null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Status of an agent execution.
|
|
261
|
+
*/
|
|
262
|
+
export type AgentExecutionStatus = 'success' | 'error' | 'filtered' | 'rate_limited' | 'balance_insufficient';
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* LLM provider for the AI agent.
|
|
266
|
+
*/
|
|
267
|
+
export type AgentProvider = 'openai' | 'anthropic' | 'google' | 'mistral' | 'zavu';
|
|
268
|
+
|
|
269
|
+
export interface AgentResponse {
|
|
270
|
+
/**
|
|
271
|
+
* AI Agent configuration for a sender.
|
|
272
|
+
*/
|
|
273
|
+
agent: Agent;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface AgentStats {
|
|
277
|
+
errorCount: number;
|
|
278
|
+
|
|
279
|
+
successCount: number;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Total cost in USD.
|
|
283
|
+
*/
|
|
284
|
+
totalCost: number;
|
|
285
|
+
|
|
286
|
+
totalInvocations: number;
|
|
287
|
+
|
|
288
|
+
totalTokensUsed: number;
|
|
289
|
+
|
|
290
|
+
avgLatencyMs?: number | null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface AgentCreateParams {
|
|
294
|
+
model: string;
|
|
295
|
+
|
|
296
|
+
name: string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* LLM provider for the AI agent.
|
|
300
|
+
*/
|
|
301
|
+
provider: AgentProvider;
|
|
302
|
+
|
|
303
|
+
systemPrompt: string;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* API key for the LLM provider. Required unless provider is 'zavu'.
|
|
307
|
+
*/
|
|
308
|
+
apiKey?: string;
|
|
309
|
+
|
|
310
|
+
contextWindowMessages?: number;
|
|
311
|
+
|
|
312
|
+
includeContactMetadata?: boolean;
|
|
313
|
+
|
|
314
|
+
maxTokens?: number;
|
|
315
|
+
|
|
316
|
+
temperature?: number;
|
|
317
|
+
|
|
318
|
+
triggerOnChannels?: Array<string>;
|
|
319
|
+
|
|
320
|
+
triggerOnMessageTypes?: Array<string>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface AgentUpdateParams {
|
|
324
|
+
apiKey?: string;
|
|
325
|
+
|
|
326
|
+
contextWindowMessages?: number;
|
|
327
|
+
|
|
328
|
+
enabled?: boolean;
|
|
329
|
+
|
|
330
|
+
includeContactMetadata?: boolean;
|
|
331
|
+
|
|
332
|
+
maxTokens?: number | null;
|
|
333
|
+
|
|
334
|
+
model?: string;
|
|
335
|
+
|
|
336
|
+
name?: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* LLM provider for the AI agent.
|
|
340
|
+
*/
|
|
341
|
+
provider?: AgentProvider;
|
|
342
|
+
|
|
343
|
+
systemPrompt?: string;
|
|
344
|
+
|
|
345
|
+
temperature?: number | null;
|
|
346
|
+
|
|
347
|
+
triggerOnChannels?: Array<string>;
|
|
348
|
+
|
|
349
|
+
triggerOnMessageTypes?: Array<string>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
AgentResource.Executions = Executions;
|
|
353
|
+
AgentResource.Flows = Flows;
|
|
354
|
+
AgentResource.Tools = Tools;
|
|
355
|
+
AgentResource.KnowledgeBases = KnowledgeBases;
|
|
356
|
+
|
|
357
|
+
export declare namespace AgentResource {
|
|
358
|
+
export {
|
|
359
|
+
type Agent as Agent,
|
|
360
|
+
type AgentExecution as AgentExecution,
|
|
361
|
+
type AgentExecutionStatus as AgentExecutionStatus,
|
|
362
|
+
type AgentProvider as AgentProvider,
|
|
363
|
+
type AgentResponse as AgentResponse,
|
|
364
|
+
type AgentStats as AgentStats,
|
|
365
|
+
type AgentCreateParams as AgentCreateParams,
|
|
366
|
+
type AgentUpdateParams as AgentUpdateParams,
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export { Executions as Executions, type ExecutionListParams as ExecutionListParams };
|
|
370
|
+
|
|
371
|
+
export {
|
|
372
|
+
Flows as Flows,
|
|
373
|
+
type AgentFlow as AgentFlow,
|
|
374
|
+
type FlowCreateResponse as FlowCreateResponse,
|
|
375
|
+
type FlowRetrieveResponse as FlowRetrieveResponse,
|
|
376
|
+
type FlowUpdateResponse as FlowUpdateResponse,
|
|
377
|
+
type FlowDuplicateResponse as FlowDuplicateResponse,
|
|
378
|
+
type AgentFlowsCursor as AgentFlowsCursor,
|
|
379
|
+
type FlowCreateParams as FlowCreateParams,
|
|
380
|
+
type FlowRetrieveParams as FlowRetrieveParams,
|
|
381
|
+
type FlowUpdateParams as FlowUpdateParams,
|
|
382
|
+
type FlowListParams as FlowListParams,
|
|
383
|
+
type FlowDeleteParams as FlowDeleteParams,
|
|
384
|
+
type FlowDuplicateParams as FlowDuplicateParams,
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export {
|
|
388
|
+
Tools as Tools,
|
|
389
|
+
type AgentTool as AgentTool,
|
|
390
|
+
type ToolCreateResponse as ToolCreateResponse,
|
|
391
|
+
type ToolRetrieveResponse as ToolRetrieveResponse,
|
|
392
|
+
type ToolUpdateResponse as ToolUpdateResponse,
|
|
393
|
+
type ToolTestResponse as ToolTestResponse,
|
|
394
|
+
type AgentToolsCursor as AgentToolsCursor,
|
|
395
|
+
type ToolCreateParams as ToolCreateParams,
|
|
396
|
+
type ToolRetrieveParams as ToolRetrieveParams,
|
|
397
|
+
type ToolUpdateParams as ToolUpdateParams,
|
|
398
|
+
type ToolListParams as ToolListParams,
|
|
399
|
+
type ToolDeleteParams as ToolDeleteParams,
|
|
400
|
+
type ToolTestParams as ToolTestParams,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export {
|
|
404
|
+
KnowledgeBases as KnowledgeBases,
|
|
405
|
+
type AgentDocument as AgentDocument,
|
|
406
|
+
type AgentKnowledgeBase as AgentKnowledgeBase,
|
|
407
|
+
type KnowledgeBaseCreateResponse as KnowledgeBaseCreateResponse,
|
|
408
|
+
type KnowledgeBaseRetrieveResponse as KnowledgeBaseRetrieveResponse,
|
|
409
|
+
type KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse,
|
|
410
|
+
type AgentKnowledgeBasesCursor as AgentKnowledgeBasesCursor,
|
|
411
|
+
type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams,
|
|
412
|
+
type KnowledgeBaseRetrieveParams as KnowledgeBaseRetrieveParams,
|
|
413
|
+
type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams,
|
|
414
|
+
type KnowledgeBaseListParams as KnowledgeBaseListParams,
|
|
415
|
+
type KnowledgeBaseDeleteParams as KnowledgeBaseDeleteParams,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as AgentAPI from './agent';
|
|
5
|
+
import { AgentExecutionsCursor } from './agent';
|
|
6
|
+
import { Cursor, type CursorParams, PagePromise } from '../../../core/pagination';
|
|
7
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
8
|
+
import { path } from '../../../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Executions extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* List recent agent executions with pagination.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Automatically fetches more pages as needed.
|
|
17
|
+
* for await (const agentExecution of client.senders.agent.executions.list(
|
|
18
|
+
* 'senderId',
|
|
19
|
+
* )) {
|
|
20
|
+
* // ...
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
list(
|
|
25
|
+
senderID: string,
|
|
26
|
+
query: ExecutionListParams | null | undefined = {},
|
|
27
|
+
options?: RequestOptions,
|
|
28
|
+
): PagePromise<AgentExecutionsCursor, AgentAPI.AgentExecution> {
|
|
29
|
+
return this._client.getAPIList(
|
|
30
|
+
path`/v1/senders/${senderID}/agent/executions`,
|
|
31
|
+
Cursor<AgentAPI.AgentExecution>,
|
|
32
|
+
{ query, ...options },
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ExecutionListParams extends CursorParams {
|
|
38
|
+
/**
|
|
39
|
+
* Status of an agent execution.
|
|
40
|
+
*/
|
|
41
|
+
status?: AgentAPI.AgentExecutionStatus;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare namespace Executions {
|
|
45
|
+
export { type ExecutionListParams as ExecutionListParams };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { type AgentExecutionsCursor };
|