@zavudev/sdk 0.17.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 +8 -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 +23 -1
- package/resources/broadcasts/broadcasts.d.mts.map +1 -1
- package/resources/broadcasts/broadcasts.d.ts +23 -1
- 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 +33 -0
- 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,409 @@
|
|
|
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 Flows extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Create a new flow for an agent.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const flow = await client.senders.agent.flows.create(
|
|
17
|
+
* 'senderId',
|
|
18
|
+
* {
|
|
19
|
+
* name: 'Lead Capture',
|
|
20
|
+
* steps: [
|
|
21
|
+
* {
|
|
22
|
+
* id: 'welcome',
|
|
23
|
+
* type: 'message',
|
|
24
|
+
* config: {
|
|
25
|
+
* text: 'Thanks for your interest! Let me get some info.',
|
|
26
|
+
* },
|
|
27
|
+
* nextStepId: 'ask_name',
|
|
28
|
+
* },
|
|
29
|
+
* {
|
|
30
|
+
* id: 'ask_name',
|
|
31
|
+
* type: 'collect',
|
|
32
|
+
* config: {
|
|
33
|
+
* variable: 'name',
|
|
34
|
+
* prompt: "What's your name?",
|
|
35
|
+
* },
|
|
36
|
+
* },
|
|
37
|
+
* ],
|
|
38
|
+
* trigger: {
|
|
39
|
+
* type: 'keyword',
|
|
40
|
+
* keywords: ['info', 'pricing', 'demo'],
|
|
41
|
+
* },
|
|
42
|
+
* description: 'Capture lead information',
|
|
43
|
+
* },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
create(senderID: string, body: FlowCreateParams, options?: RequestOptions): APIPromise<FlowCreateResponse> {
|
|
48
|
+
return this._client.post(path`/v1/senders/${senderID}/agent/flows`, { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get a specific flow.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const flow = await client.senders.agent.flows.retrieve(
|
|
57
|
+
* 'flowId',
|
|
58
|
+
* { senderId: 'senderId' },
|
|
59
|
+
* );
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
retrieve(
|
|
63
|
+
flowID: string,
|
|
64
|
+
params: FlowRetrieveParams,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): APIPromise<FlowRetrieveResponse> {
|
|
67
|
+
const { senderId } = params;
|
|
68
|
+
return this._client.get(path`/v1/senders/${senderId}/agent/flows/${flowID}`, options);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update a flow.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const flow = await client.senders.agent.flows.update(
|
|
77
|
+
* 'flowId',
|
|
78
|
+
* { senderId: 'senderId' },
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
update(flowID: string, params: FlowUpdateParams, options?: RequestOptions): APIPromise<FlowUpdateResponse> {
|
|
83
|
+
const { senderId, ...body } = params;
|
|
84
|
+
return this._client.patch(path`/v1/senders/${senderId}/agent/flows/${flowID}`, { body, ...options });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* List flows for an agent.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* // Automatically fetches more pages as needed.
|
|
93
|
+
* for await (const agentFlow of client.senders.agent.flows.list(
|
|
94
|
+
* 'senderId',
|
|
95
|
+
* )) {
|
|
96
|
+
* // ...
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
list(
|
|
101
|
+
senderID: string,
|
|
102
|
+
query: FlowListParams | null | undefined = {},
|
|
103
|
+
options?: RequestOptions,
|
|
104
|
+
): PagePromise<AgentFlowsCursor, AgentFlow> {
|
|
105
|
+
return this._client.getAPIList(path`/v1/senders/${senderID}/agent/flows`, Cursor<AgentFlow>, {
|
|
106
|
+
query,
|
|
107
|
+
...options,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Delete a flow. Cannot delete flows with active sessions.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* await client.senders.agent.flows.delete('flowId', {
|
|
117
|
+
* senderId: 'senderId',
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
delete(flowID: string, params: FlowDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
122
|
+
const { senderId } = params;
|
|
123
|
+
return this._client.delete(path`/v1/senders/${senderId}/agent/flows/${flowID}`, {
|
|
124
|
+
...options,
|
|
125
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Create a copy of an existing flow with a new name.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const response = await client.senders.agent.flows.duplicate(
|
|
135
|
+
* 'flowId',
|
|
136
|
+
* { senderId: 'senderId', newName: 'Lead Capture (Copy)' },
|
|
137
|
+
* );
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
duplicate(
|
|
141
|
+
flowID: string,
|
|
142
|
+
params: FlowDuplicateParams,
|
|
143
|
+
options?: RequestOptions,
|
|
144
|
+
): APIPromise<FlowDuplicateResponse> {
|
|
145
|
+
const { senderId, ...body } = params;
|
|
146
|
+
return this._client.post(path`/v1/senders/${senderId}/agent/flows/${flowID}/duplicate`, {
|
|
147
|
+
body,
|
|
148
|
+
...options,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type AgentFlowsCursor = Cursor<AgentFlow>;
|
|
154
|
+
|
|
155
|
+
export interface AgentFlow {
|
|
156
|
+
id: string;
|
|
157
|
+
|
|
158
|
+
agentId: string;
|
|
159
|
+
|
|
160
|
+
createdAt: string;
|
|
161
|
+
|
|
162
|
+
enabled: boolean;
|
|
163
|
+
|
|
164
|
+
name: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Priority when multiple flows match (higher = more priority).
|
|
168
|
+
*/
|
|
169
|
+
priority: number;
|
|
170
|
+
|
|
171
|
+
steps: Array<AgentFlow.Step>;
|
|
172
|
+
|
|
173
|
+
trigger: AgentFlow.Trigger;
|
|
174
|
+
|
|
175
|
+
updatedAt: string;
|
|
176
|
+
|
|
177
|
+
description?: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export namespace AgentFlow {
|
|
181
|
+
export interface Step {
|
|
182
|
+
/**
|
|
183
|
+
* Unique step identifier.
|
|
184
|
+
*/
|
|
185
|
+
id: string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Step configuration (varies by type).
|
|
189
|
+
*/
|
|
190
|
+
config: { [key: string]: unknown };
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Type of flow step.
|
|
194
|
+
*/
|
|
195
|
+
type: 'message' | 'collect' | 'condition' | 'tool' | 'llm' | 'transfer';
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* ID of the next step to execute.
|
|
199
|
+
*/
|
|
200
|
+
nextStepId?: string | null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface Trigger {
|
|
204
|
+
/**
|
|
205
|
+
* Type of trigger for a flow.
|
|
206
|
+
*/
|
|
207
|
+
type: 'keyword' | 'intent' | 'always' | 'manual';
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Intent that triggers the flow (for intent type).
|
|
211
|
+
*/
|
|
212
|
+
intent?: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Keywords that trigger the flow (for keyword type).
|
|
216
|
+
*/
|
|
217
|
+
keywords?: Array<string>;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface FlowCreateResponse {
|
|
222
|
+
flow: AgentFlow;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface FlowRetrieveResponse {
|
|
226
|
+
flow: AgentFlow;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface FlowUpdateResponse {
|
|
230
|
+
flow: AgentFlow;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface FlowDuplicateResponse {
|
|
234
|
+
flow: AgentFlow;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface FlowCreateParams {
|
|
238
|
+
name: string;
|
|
239
|
+
|
|
240
|
+
steps: Array<FlowCreateParams.Step>;
|
|
241
|
+
|
|
242
|
+
trigger: FlowCreateParams.Trigger;
|
|
243
|
+
|
|
244
|
+
description?: string;
|
|
245
|
+
|
|
246
|
+
enabled?: boolean;
|
|
247
|
+
|
|
248
|
+
priority?: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export namespace FlowCreateParams {
|
|
252
|
+
export interface Step {
|
|
253
|
+
/**
|
|
254
|
+
* Unique step identifier.
|
|
255
|
+
*/
|
|
256
|
+
id: string;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Step configuration (varies by type).
|
|
260
|
+
*/
|
|
261
|
+
config: { [key: string]: unknown };
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Type of flow step.
|
|
265
|
+
*/
|
|
266
|
+
type: 'message' | 'collect' | 'condition' | 'tool' | 'llm' | 'transfer';
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* ID of the next step to execute.
|
|
270
|
+
*/
|
|
271
|
+
nextStepId?: string | null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface Trigger {
|
|
275
|
+
/**
|
|
276
|
+
* Type of trigger for a flow.
|
|
277
|
+
*/
|
|
278
|
+
type: 'keyword' | 'intent' | 'always' | 'manual';
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Intent that triggers the flow (for intent type).
|
|
282
|
+
*/
|
|
283
|
+
intent?: string;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Keywords that trigger the flow (for keyword type).
|
|
287
|
+
*/
|
|
288
|
+
keywords?: Array<string>;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface FlowRetrieveParams {
|
|
293
|
+
senderId: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface FlowUpdateParams {
|
|
297
|
+
/**
|
|
298
|
+
* Path param:
|
|
299
|
+
*/
|
|
300
|
+
senderId: string;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Body param:
|
|
304
|
+
*/
|
|
305
|
+
description?: string;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Body param:
|
|
309
|
+
*/
|
|
310
|
+
enabled?: boolean;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Body param:
|
|
314
|
+
*/
|
|
315
|
+
name?: string;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Body param:
|
|
319
|
+
*/
|
|
320
|
+
priority?: number;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Body param:
|
|
324
|
+
*/
|
|
325
|
+
steps?: Array<FlowUpdateParams.Step>;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Body param:
|
|
329
|
+
*/
|
|
330
|
+
trigger?: FlowUpdateParams.Trigger;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export namespace FlowUpdateParams {
|
|
334
|
+
export interface Step {
|
|
335
|
+
/**
|
|
336
|
+
* Unique step identifier.
|
|
337
|
+
*/
|
|
338
|
+
id: string;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Step configuration (varies by type).
|
|
342
|
+
*/
|
|
343
|
+
config: { [key: string]: unknown };
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Type of flow step.
|
|
347
|
+
*/
|
|
348
|
+
type: 'message' | 'collect' | 'condition' | 'tool' | 'llm' | 'transfer';
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* ID of the next step to execute.
|
|
352
|
+
*/
|
|
353
|
+
nextStepId?: string | null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface Trigger {
|
|
357
|
+
/**
|
|
358
|
+
* Type of trigger for a flow.
|
|
359
|
+
*/
|
|
360
|
+
type: 'keyword' | 'intent' | 'always' | 'manual';
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Intent that triggers the flow (for intent type).
|
|
364
|
+
*/
|
|
365
|
+
intent?: string;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Keywords that trigger the flow (for keyword type).
|
|
369
|
+
*/
|
|
370
|
+
keywords?: Array<string>;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface FlowListParams extends CursorParams {
|
|
375
|
+
enabled?: boolean;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface FlowDeleteParams {
|
|
379
|
+
senderId: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface FlowDuplicateParams {
|
|
383
|
+
/**
|
|
384
|
+
* Path param:
|
|
385
|
+
*/
|
|
386
|
+
senderId: string;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Body param:
|
|
390
|
+
*/
|
|
391
|
+
newName: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export declare namespace Flows {
|
|
395
|
+
export {
|
|
396
|
+
type AgentFlow as AgentFlow,
|
|
397
|
+
type FlowCreateResponse as FlowCreateResponse,
|
|
398
|
+
type FlowRetrieveResponse as FlowRetrieveResponse,
|
|
399
|
+
type FlowUpdateResponse as FlowUpdateResponse,
|
|
400
|
+
type FlowDuplicateResponse as FlowDuplicateResponse,
|
|
401
|
+
type AgentFlowsCursor as AgentFlowsCursor,
|
|
402
|
+
type FlowCreateParams as FlowCreateParams,
|
|
403
|
+
type FlowRetrieveParams as FlowRetrieveParams,
|
|
404
|
+
type FlowUpdateParams as FlowUpdateParams,
|
|
405
|
+
type FlowListParams as FlowListParams,
|
|
406
|
+
type FlowDeleteParams as FlowDeleteParams,
|
|
407
|
+
type FlowDuplicateParams as FlowDuplicateParams,
|
|
408
|
+
};
|
|
409
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
AgentResource,
|
|
5
|
+
type Agent,
|
|
6
|
+
type AgentExecution,
|
|
7
|
+
type AgentExecutionStatus,
|
|
8
|
+
type AgentProvider,
|
|
9
|
+
type AgentResponse,
|
|
10
|
+
type AgentStats,
|
|
11
|
+
type AgentCreateParams,
|
|
12
|
+
type AgentUpdateParams,
|
|
13
|
+
type AgentExecutionsCursor,
|
|
14
|
+
} from './agent';
|
|
15
|
+
export { Executions, type ExecutionListParams } from './executions';
|
|
16
|
+
export {
|
|
17
|
+
Flows,
|
|
18
|
+
type AgentFlow,
|
|
19
|
+
type FlowCreateResponse,
|
|
20
|
+
type FlowRetrieveResponse,
|
|
21
|
+
type FlowUpdateResponse,
|
|
22
|
+
type FlowDuplicateResponse,
|
|
23
|
+
type FlowCreateParams,
|
|
24
|
+
type FlowRetrieveParams,
|
|
25
|
+
type FlowUpdateParams,
|
|
26
|
+
type FlowListParams,
|
|
27
|
+
type FlowDeleteParams,
|
|
28
|
+
type FlowDuplicateParams,
|
|
29
|
+
type AgentFlowsCursor,
|
|
30
|
+
} from './flows';
|
|
31
|
+
export {
|
|
32
|
+
KnowledgeBases,
|
|
33
|
+
type AgentDocument,
|
|
34
|
+
type AgentKnowledgeBase,
|
|
35
|
+
type KnowledgeBaseCreateResponse,
|
|
36
|
+
type KnowledgeBaseRetrieveResponse,
|
|
37
|
+
type KnowledgeBaseUpdateResponse,
|
|
38
|
+
type KnowledgeBaseCreateParams,
|
|
39
|
+
type KnowledgeBaseRetrieveParams,
|
|
40
|
+
type KnowledgeBaseUpdateParams,
|
|
41
|
+
type KnowledgeBaseListParams,
|
|
42
|
+
type KnowledgeBaseDeleteParams,
|
|
43
|
+
type AgentDocumentsCursor,
|
|
44
|
+
type AgentKnowledgeBasesCursor,
|
|
45
|
+
} from './knowledge-bases/index';
|
|
46
|
+
export {
|
|
47
|
+
Tools,
|
|
48
|
+
type AgentTool,
|
|
49
|
+
type ToolCreateResponse,
|
|
50
|
+
type ToolRetrieveResponse,
|
|
51
|
+
type ToolUpdateResponse,
|
|
52
|
+
type ToolTestResponse,
|
|
53
|
+
type ToolCreateParams,
|
|
54
|
+
type ToolRetrieveParams,
|
|
55
|
+
type ToolUpdateParams,
|
|
56
|
+
type ToolListParams,
|
|
57
|
+
type ToolDeleteParams,
|
|
58
|
+
type ToolTestParams,
|
|
59
|
+
type AgentToolsCursor,
|
|
60
|
+
} from './tools';
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../../core/resource';
|
|
4
|
+
import * as KnowledgeBasesAPI from './knowledge-bases';
|
|
5
|
+
import { AgentDocumentsCursor } from './knowledge-bases';
|
|
6
|
+
import { APIPromise } from '../../../../core/api-promise';
|
|
7
|
+
import { Cursor, type CursorParams, PagePromise } from '../../../../core/pagination';
|
|
8
|
+
import { buildHeaders } from '../../../../internal/headers';
|
|
9
|
+
import { RequestOptions } from '../../../../internal/request-options';
|
|
10
|
+
import { path } from '../../../../internal/utils/path';
|
|
11
|
+
|
|
12
|
+
export class Documents extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Add a document to a knowledge base. The document will be automatically processed
|
|
15
|
+
* for RAG.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const document =
|
|
20
|
+
* await client.senders.agent.knowledgeBases.documents.create(
|
|
21
|
+
* 'kbId',
|
|
22
|
+
* {
|
|
23
|
+
* senderId: 'senderId',
|
|
24
|
+
* content:
|
|
25
|
+
* 'Our return policy allows returns within 30 days of purchase...',
|
|
26
|
+
* title: 'Return Policy',
|
|
27
|
+
* },
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
create(
|
|
32
|
+
kbID: string,
|
|
33
|
+
params: DocumentCreateParams,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<DocumentCreateResponse> {
|
|
36
|
+
const { senderId, ...body } = params;
|
|
37
|
+
return this._client.post(path`/v1/senders/${senderId}/agent/knowledge-bases/${kbID}/documents`, {
|
|
38
|
+
body,
|
|
39
|
+
...options,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* List documents in a knowledge base.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* // Automatically fetches more pages as needed.
|
|
49
|
+
* for await (const agentDocument of client.senders.agent.knowledgeBases.documents.list(
|
|
50
|
+
* 'kbId',
|
|
51
|
+
* { senderId: 'senderId' },
|
|
52
|
+
* )) {
|
|
53
|
+
* // ...
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
list(
|
|
58
|
+
kbID: string,
|
|
59
|
+
params: DocumentListParams,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): PagePromise<AgentDocumentsCursor, KnowledgeBasesAPI.AgentDocument> {
|
|
62
|
+
const { senderId, ...query } = params;
|
|
63
|
+
return this._client.getAPIList(
|
|
64
|
+
path`/v1/senders/${senderId}/agent/knowledge-bases/${kbID}/documents`,
|
|
65
|
+
Cursor<KnowledgeBasesAPI.AgentDocument>,
|
|
66
|
+
{ query, ...options },
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Delete a document from a knowledge base.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* await client.senders.agent.knowledgeBases.documents.delete(
|
|
76
|
+
* 'docId',
|
|
77
|
+
* { senderId: 'senderId', kbId: 'kbId' },
|
|
78
|
+
* );
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
delete(docID: string, params: DocumentDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
82
|
+
const { senderId, kbId } = params;
|
|
83
|
+
return this._client.delete(
|
|
84
|
+
path`/v1/senders/${senderId}/agent/knowledge-bases/${kbId}/documents/${docID}`,
|
|
85
|
+
{ ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface DocumentCreateResponse {
|
|
91
|
+
document: KnowledgeBasesAPI.AgentDocument;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface DocumentCreateParams {
|
|
95
|
+
/**
|
|
96
|
+
* Path param:
|
|
97
|
+
*/
|
|
98
|
+
senderId: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Body param:
|
|
102
|
+
*/
|
|
103
|
+
content: string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Body param:
|
|
107
|
+
*/
|
|
108
|
+
title: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface DocumentListParams extends CursorParams {
|
|
112
|
+
/**
|
|
113
|
+
* Path param:
|
|
114
|
+
*/
|
|
115
|
+
senderId: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface DocumentDeleteParams {
|
|
119
|
+
senderId: string;
|
|
120
|
+
|
|
121
|
+
kbId: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare namespace Documents {
|
|
125
|
+
export {
|
|
126
|
+
type DocumentCreateResponse as DocumentCreateResponse,
|
|
127
|
+
type DocumentCreateParams as DocumentCreateParams,
|
|
128
|
+
type DocumentListParams as DocumentListParams,
|
|
129
|
+
type DocumentDeleteParams as DocumentDeleteParams,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { type AgentDocumentsCursor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Documents,
|
|
5
|
+
type DocumentCreateResponse,
|
|
6
|
+
type DocumentCreateParams,
|
|
7
|
+
type DocumentListParams,
|
|
8
|
+
type DocumentDeleteParams,
|
|
9
|
+
} from './documents';
|
|
10
|
+
export {
|
|
11
|
+
KnowledgeBases,
|
|
12
|
+
type AgentDocument,
|
|
13
|
+
type AgentKnowledgeBase,
|
|
14
|
+
type KnowledgeBaseCreateResponse,
|
|
15
|
+
type KnowledgeBaseRetrieveResponse,
|
|
16
|
+
type KnowledgeBaseUpdateResponse,
|
|
17
|
+
type KnowledgeBaseCreateParams,
|
|
18
|
+
type KnowledgeBaseRetrieveParams,
|
|
19
|
+
type KnowledgeBaseUpdateParams,
|
|
20
|
+
type KnowledgeBaseListParams,
|
|
21
|
+
type KnowledgeBaseDeleteParams,
|
|
22
|
+
type AgentDocumentsCursor,
|
|
23
|
+
type AgentKnowledgeBasesCursor,
|
|
24
|
+
} from './knowledge-bases';
|