@alquimia-ai/tools 2.4.0 → 2.7.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/README.md +529 -19
- package/dist/actions/index.d.mts +2 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.js +1 -1
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/actions/index.mjs.map +1 -1
- package/dist/{actions-CZU_GRy5.d.mts → actions-BjDPJdyA.d.mts} +1 -1
- package/dist/{actions-B0hfoYRd.d.ts → actions-CP1d4Ye1.d.ts} +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/genui/index.d.mts +3 -3
- package/dist/genui/index.d.ts +3 -3
- package/dist/genui/index.js +9 -1
- package/dist/genui/index.js.map +1 -1
- package/dist/genui/index.mjs +9 -1
- package/dist/genui/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +10 -10
- package/dist/hooks/index.d.ts +10 -10
- package/dist/hooks/index.js +88 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +88 -12
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/next/index.js +23 -6
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +23 -6
- package/dist/next/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +4 -4
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.js +111 -110
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +111 -110
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{providers-BJTXCtI3.d.ts → providers-B4IOiGfr.d.mts} +8 -8
- package/dist/{providers-0Gi78uNQ.d.mts → providers-mx21gNgZ.d.ts} +8 -8
- package/dist/proxy.d.mts +4 -4
- package/dist/proxy.d.ts +4 -4
- package/dist/proxy.js +23 -6
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs +23 -6
- package/dist/proxy.mjs.map +1 -1
- package/dist/sdk/index.d.mts +39 -5
- package/dist/sdk/index.d.ts +39 -5
- package/dist/sdk/index.js +49 -6
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +49 -6
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/services/index.d.mts +3 -3
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/type-61gaZga-.d.mts +356 -0
- package/dist/type-D-JaSMkV.d.ts +356 -0
- package/dist/types/index.d.mts +80 -304
- package/dist/types/index.d.ts +80 -304
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/{types-DnfWUE9V.d.mts → types-CMVbyEv8.d.mts} +3 -2
- package/dist/{types-DnfWUE9V.d.ts → types-CMVbyEv8.d.ts} +3 -2
- package/dist/types-lOliroPw.d.mts +111 -0
- package/dist/types-lOliroPw.d.ts +111 -0
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/worklog/index.d.mts +5 -2
- package/dist/worklog/index.d.ts +5 -2
- package/dist/worklog/index.js +22 -1
- package/dist/worklog/index.js.map +1 -1
- package/dist/worklog/index.mjs +22 -1
- package/dist/worklog/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/types-Dvu9y4WM.d.mts +0 -53
- package/dist/types-Dvu9y4WM.d.ts +0 -53
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Span } from '@elastic/apm-rum';
|
|
2
|
+
import { Message } from 'ai';
|
|
3
|
+
import { A as A2uiSurface } from './types-CMVbyEv8.mjs';
|
|
4
|
+
|
|
5
|
+
interface ITooler {
|
|
6
|
+
tooler: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
parameters: Record<string, any>;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface IToolSpec {
|
|
12
|
+
name: string;
|
|
13
|
+
parameters: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
declare abstract class ToolFactory {
|
|
16
|
+
protected toolSpec: IToolSpec | null;
|
|
17
|
+
constructor(toolSpec: IToolSpec);
|
|
18
|
+
static createTool(toolSpec: IToolSpec): IToolSpec;
|
|
19
|
+
abstract execute(): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
interface AIMessageChunk {
|
|
22
|
+
type: string;
|
|
23
|
+
data?: AIMessageChunkData;
|
|
24
|
+
answer?: string;
|
|
25
|
+
tooler?: ToolEvent[];
|
|
26
|
+
error_code?: string;
|
|
27
|
+
error_detail?: string;
|
|
28
|
+
taskid?: string;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
31
|
+
}
|
|
32
|
+
interface AIMessageChunkData {
|
|
33
|
+
content: string;
|
|
34
|
+
additional_kwargs?: Record<string, unknown>;
|
|
35
|
+
response_metadata?: Record<string, unknown>;
|
|
36
|
+
type: string;
|
|
37
|
+
name?: string | null;
|
|
38
|
+
id?: string | null;
|
|
39
|
+
example?: boolean;
|
|
40
|
+
tool_calls?: ToolCall[];
|
|
41
|
+
invalid_tool_calls?: InvalidToolCall[];
|
|
42
|
+
usage_metadata?: any;
|
|
43
|
+
tool_call_chunks?: unknown[];
|
|
44
|
+
error_code?: string;
|
|
45
|
+
error_detail?: string;
|
|
46
|
+
}
|
|
47
|
+
type ToolCall = {
|
|
48
|
+
name: string;
|
|
49
|
+
args: Record<string, any>;
|
|
50
|
+
id?: string | null;
|
|
51
|
+
};
|
|
52
|
+
type InvalidToolCall = {
|
|
53
|
+
name: string | null;
|
|
54
|
+
args: string | null;
|
|
55
|
+
id: string | null;
|
|
56
|
+
error: string | null;
|
|
57
|
+
};
|
|
58
|
+
interface BaseAPIConfig {
|
|
59
|
+
baseUrl: string;
|
|
60
|
+
route: string;
|
|
61
|
+
token?: string;
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface RatingData {
|
|
65
|
+
assistantId: string;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
topicId: number;
|
|
68
|
+
score?: number;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
interface AttachmentPayload {
|
|
72
|
+
filename: string;
|
|
73
|
+
content_type: string;
|
|
74
|
+
content_size: number;
|
|
75
|
+
}
|
|
76
|
+
type AlquimiaMessage = Message & {
|
|
77
|
+
error_code?: string;
|
|
78
|
+
error_detail?: string;
|
|
79
|
+
taskid?: string;
|
|
80
|
+
loading?: boolean;
|
|
81
|
+
created_at?: string;
|
|
82
|
+
additionalInfo?: string;
|
|
83
|
+
tooler?: Tooler[];
|
|
84
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
85
|
+
attachments?: AttachmentPayload[];
|
|
86
|
+
};
|
|
87
|
+
interface ActionResponse<T = void> {
|
|
88
|
+
success: boolean;
|
|
89
|
+
data?: T;
|
|
90
|
+
error?: {
|
|
91
|
+
message: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
details?: any;
|
|
94
|
+
name?: string;
|
|
95
|
+
cause?: string;
|
|
96
|
+
status?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
type ApmSpan = Span & {
|
|
100
|
+
id?: string;
|
|
101
|
+
traceId?: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
type ApiError = Error & {
|
|
104
|
+
message: string;
|
|
105
|
+
name: string;
|
|
106
|
+
cause: string;
|
|
107
|
+
code?: string | number;
|
|
108
|
+
status?: string | number;
|
|
109
|
+
};
|
|
110
|
+
type Tooler = {
|
|
111
|
+
control_id: string;
|
|
112
|
+
tool_summary?: ToolSummary;
|
|
113
|
+
tool_output?: ToolOutput;
|
|
114
|
+
};
|
|
115
|
+
type ToolSummary = {
|
|
116
|
+
name: string;
|
|
117
|
+
parameters: Record<string, any>;
|
|
118
|
+
};
|
|
119
|
+
type ToolOutput = {
|
|
120
|
+
result: any;
|
|
121
|
+
status: string;
|
|
122
|
+
};
|
|
123
|
+
type ToolEvent = {
|
|
124
|
+
event_class: string;
|
|
125
|
+
control_id: string;
|
|
126
|
+
data: any;
|
|
127
|
+
status: string;
|
|
128
|
+
};
|
|
129
|
+
interface ConversationsMap {
|
|
130
|
+
[topicId: string]: string;
|
|
131
|
+
}
|
|
132
|
+
interface DocumentSearchResult {
|
|
133
|
+
pageContent: string;
|
|
134
|
+
metadata: {
|
|
135
|
+
source: string;
|
|
136
|
+
_id: string;
|
|
137
|
+
_collection_name: string;
|
|
138
|
+
};
|
|
139
|
+
score: number;
|
|
140
|
+
}
|
|
141
|
+
type ElevenLabsVoiceSettings = {
|
|
142
|
+
stability: number;
|
|
143
|
+
similarity_boost: number;
|
|
144
|
+
style: number;
|
|
145
|
+
};
|
|
146
|
+
type ElevenLabsRequestSpecs = {
|
|
147
|
+
optimize_streaming_latency: string;
|
|
148
|
+
output_format: string;
|
|
149
|
+
model_id: string;
|
|
150
|
+
language: string;
|
|
151
|
+
voice_settings: ElevenLabsVoiceSettings;
|
|
152
|
+
};
|
|
153
|
+
type TTSResult = {
|
|
154
|
+
type: 'blob';
|
|
155
|
+
data: Blob;
|
|
156
|
+
} | {
|
|
157
|
+
type: 'url';
|
|
158
|
+
data: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: 'error';
|
|
161
|
+
message: string;
|
|
162
|
+
};
|
|
163
|
+
/** One SSE `data:` JSON frame (`event_class` at top level). */
|
|
164
|
+
interface AlquimiaEventData {
|
|
165
|
+
taskid?: string;
|
|
166
|
+
event_class?: string;
|
|
167
|
+
control_id?: string;
|
|
168
|
+
date_submitted?: string;
|
|
169
|
+
status?: string | null;
|
|
170
|
+
data?: unknown;
|
|
171
|
+
experts?: ExpertInferenceResponse[];
|
|
172
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
173
|
+
tools_output?: ToolEvent[];
|
|
174
|
+
agents_output?: any[];
|
|
175
|
+
tools_pending_approval?: any[];
|
|
176
|
+
tools_pending_execution?: any[];
|
|
177
|
+
errors?: any[];
|
|
178
|
+
}
|
|
179
|
+
interface AssistantInferenceResponse {
|
|
180
|
+
event_class: string;
|
|
181
|
+
control_id: string;
|
|
182
|
+
data: string;
|
|
183
|
+
status: string;
|
|
184
|
+
date_submitted: string;
|
|
185
|
+
message?: string | null;
|
|
186
|
+
extras?: Record<string, unknown> | null;
|
|
187
|
+
extra_data?: ExtraDataContext | null;
|
|
188
|
+
channel?: unknown | null;
|
|
189
|
+
depth?: number;
|
|
190
|
+
taskid?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Channel-scoped context returned alongside an inference response (was
|
|
194
|
+
* `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
|
|
195
|
+
* the inference was triggered from.
|
|
196
|
+
*/
|
|
197
|
+
interface ExtraDataContext {
|
|
198
|
+
whatsapp_message_id?: string;
|
|
199
|
+
whatsapp_message_from?: string;
|
|
200
|
+
email_message_recipient?: string;
|
|
201
|
+
email_message_subject?: string;
|
|
202
|
+
email_message_id?: string;
|
|
203
|
+
email_message_body?: string;
|
|
204
|
+
slack_team_id?: string;
|
|
205
|
+
slack_user_id?: string;
|
|
206
|
+
slack_channel_id?: string;
|
|
207
|
+
slack_response_url?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* JSON body returned by `POST /event/infer/{assistantId}` (and channel
|
|
211
|
+
* variants). Keys match the runtime wire format (lowercase, no underscores).
|
|
212
|
+
* `taskid` is the id used for the SSE stream.
|
|
213
|
+
*/
|
|
214
|
+
interface CommonAttributes {
|
|
215
|
+
taskid?: string | null;
|
|
216
|
+
parenttaskid?: string | null;
|
|
217
|
+
sessionid?: string | null;
|
|
218
|
+
userid?: string | null;
|
|
219
|
+
assistantid?: string | null;
|
|
220
|
+
agentspaceid?: string | null;
|
|
221
|
+
channelid?: string | null;
|
|
222
|
+
depth?: string;
|
|
223
|
+
attachments?: string[];
|
|
224
|
+
/** Registry version the runtime resolved for this task (runtime v0.5.1). */
|
|
225
|
+
versiontag?: string | null;
|
|
226
|
+
}
|
|
227
|
+
type InferInitResponse = CommonAttributes;
|
|
228
|
+
/** A text block in a multimodal `query` (runtime `TextContentPart`). */
|
|
229
|
+
interface TextContentPart {
|
|
230
|
+
type: 'text';
|
|
231
|
+
text: string;
|
|
232
|
+
}
|
|
233
|
+
/** An image block in a multimodal `query` (runtime `ImageContentPart`). */
|
|
234
|
+
interface ImageContentPart {
|
|
235
|
+
type: 'image_url';
|
|
236
|
+
image_url: {
|
|
237
|
+
url: string;
|
|
238
|
+
detail?: 'auto' | 'low' | 'high';
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Catch-all for content blocks the runtime does not model explicitly. It
|
|
243
|
+
* round-trips unknown provider blocks rather than failing validation.
|
|
244
|
+
*/
|
|
245
|
+
interface NonStandardContentPart {
|
|
246
|
+
type: 'non_standard';
|
|
247
|
+
value?: Record<string, unknown>;
|
|
248
|
+
}
|
|
249
|
+
type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;
|
|
250
|
+
/**
|
|
251
|
+
* An inference `query`: either plain text, or an OpenAI-style list of content
|
|
252
|
+
* parts for multimodal input.
|
|
253
|
+
*/
|
|
254
|
+
type Content = string | ContentPart[];
|
|
255
|
+
/**
|
|
256
|
+
* A blob held in the session context. Returned by `POST /context/blob/upload`
|
|
257
|
+
* and accepted as `input_audio` on infer (runtime v0.5.1).
|
|
258
|
+
*/
|
|
259
|
+
interface RuntimeBlob {
|
|
260
|
+
blob_id: string;
|
|
261
|
+
filename: string;
|
|
262
|
+
content_size: number;
|
|
263
|
+
content_type?: string | null;
|
|
264
|
+
checksum?: string | null;
|
|
265
|
+
created_at?: number | null;
|
|
266
|
+
expires_at?: number | null;
|
|
267
|
+
/** Base64-encoded content. Populated by channel ingest, not by blob upload. */
|
|
268
|
+
data_base64?: string | null;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Native-tools evaluation strategy. Wraps the client-side tool schemas
|
|
272
|
+
* the SDK previously sent at the top level of the infer payload.
|
|
273
|
+
*/
|
|
274
|
+
interface NativeToolsEvaluationStrategy {
|
|
275
|
+
evaluation_strategy_id: 'native';
|
|
276
|
+
tool_schemas?: unknown[];
|
|
277
|
+
max_steps?: number;
|
|
278
|
+
current_step?: number;
|
|
279
|
+
max_concurrent_tools?: number;
|
|
280
|
+
decorators?: unknown[];
|
|
281
|
+
tool_choice?: unknown;
|
|
282
|
+
structured_output?: unknown;
|
|
283
|
+
}
|
|
284
|
+
interface RawToolsEvaluationStrategy {
|
|
285
|
+
evaluation_strategy_id: 'raw';
|
|
286
|
+
tool_schemas?: unknown[];
|
|
287
|
+
}
|
|
288
|
+
interface OneShootEvaluationStrategy {
|
|
289
|
+
evaluation_strategy_id: 'one-shoot';
|
|
290
|
+
}
|
|
291
|
+
type EvaluationStrategy = NativeToolsEvaluationStrategy | RawToolsEvaluationStrategy | OneShootEvaluationStrategy;
|
|
292
|
+
interface AssistantResponseData {
|
|
293
|
+
content: string;
|
|
294
|
+
additional_kwargs: Record<string, any>;
|
|
295
|
+
response_metadata: ResponseMetadata;
|
|
296
|
+
type: string;
|
|
297
|
+
id: string;
|
|
298
|
+
example: boolean;
|
|
299
|
+
tool_calls: any[];
|
|
300
|
+
invalid_tool_calls: any[];
|
|
301
|
+
usage_metadata: UsageMetadata;
|
|
302
|
+
}
|
|
303
|
+
interface ResponseMetadata {
|
|
304
|
+
token_usage: TokenUsage;
|
|
305
|
+
model_name: string;
|
|
306
|
+
system_fingerprint: string;
|
|
307
|
+
finish_reason: string;
|
|
308
|
+
logprobs: any | null;
|
|
309
|
+
}
|
|
310
|
+
interface TokenUsage {
|
|
311
|
+
completion_tokens: number;
|
|
312
|
+
prompt_tokens: number;
|
|
313
|
+
total_tokens: number;
|
|
314
|
+
completion_time: number;
|
|
315
|
+
prompt_time: number;
|
|
316
|
+
queue_time: number;
|
|
317
|
+
total_time: number;
|
|
318
|
+
}
|
|
319
|
+
interface UsageMetadata {
|
|
320
|
+
input_tokens: number;
|
|
321
|
+
output_tokens: number;
|
|
322
|
+
total_tokens: number;
|
|
323
|
+
}
|
|
324
|
+
interface ExpertInferenceResponse {
|
|
325
|
+
event_class: string;
|
|
326
|
+
control_id: string;
|
|
327
|
+
data: {
|
|
328
|
+
label: string;
|
|
329
|
+
score: number;
|
|
330
|
+
};
|
|
331
|
+
status: string;
|
|
332
|
+
date_submitted: string;
|
|
333
|
+
}
|
|
334
|
+
interface ThinkingsInferenceResponse {
|
|
335
|
+
event_class: string;
|
|
336
|
+
control_id: string;
|
|
337
|
+
status: string;
|
|
338
|
+
date_submitted: string;
|
|
339
|
+
data: {
|
|
340
|
+
content: AssistantResponseData;
|
|
341
|
+
is_complete: boolean;
|
|
342
|
+
is_partial: boolean;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
interface GenuiSurfaceItem {
|
|
346
|
+
controlId: string;
|
|
347
|
+
surface: A2uiSurface;
|
|
348
|
+
/** Message-count anchor: the surface renders after this many messages (chronological ordering). */
|
|
349
|
+
afterCount: number;
|
|
350
|
+
/** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
|
|
351
|
+
submitted?: boolean;
|
|
352
|
+
/** Set when the user declined the surface and typed a reply */
|
|
353
|
+
dismissedWith?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export { type ApmSpan as A, type BaseAPIConfig as B, type CommonAttributes as C, type DocumentSearchResult as D, type ElevenLabsRequestSpecs as E, type ToolEvent as F, type GenuiSurfaceItem as G, ToolFactory as H, type IToolSpec as I, type ToolOutput as J, type ToolSummary as K, type Tooler as L, type NativeToolsEvaluationStrategy as N, type OneShootEvaluationStrategy as O, type RatingData as R, type TTSResult as T, type UsageMetadata as U, type AIMessageChunk as a, type AIMessageChunkData as b, type ActionResponse as c, type AlquimiaEventData as d, type AlquimiaMessage as e, type ApiError as f, type AssistantInferenceResponse as g, type AssistantResponseData as h, type AttachmentPayload as i, type Content as j, type ContentPart as k, type ConversationsMap as l, type ElevenLabsVoiceSettings as m, type EvaluationStrategy as n, type ExpertInferenceResponse as o, type ExtraDataContext as p, type ITooler as q, type ImageContentPart as r, type InferInitResponse as s, type NonStandardContentPart as t, type RawToolsEvaluationStrategy as u, type ResponseMetadata as v, type RuntimeBlob as w, type TextContentPart as x, type ThinkingsInferenceResponse as y, type TokenUsage as z };
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Span } from '@elastic/apm-rum';
|
|
2
|
+
import { Message } from 'ai';
|
|
3
|
+
import { A as A2uiSurface } from './types-CMVbyEv8.js';
|
|
4
|
+
|
|
5
|
+
interface ITooler {
|
|
6
|
+
tooler: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
parameters: Record<string, any>;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface IToolSpec {
|
|
12
|
+
name: string;
|
|
13
|
+
parameters: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
declare abstract class ToolFactory {
|
|
16
|
+
protected toolSpec: IToolSpec | null;
|
|
17
|
+
constructor(toolSpec: IToolSpec);
|
|
18
|
+
static createTool(toolSpec: IToolSpec): IToolSpec;
|
|
19
|
+
abstract execute(): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
interface AIMessageChunk {
|
|
22
|
+
type: string;
|
|
23
|
+
data?: AIMessageChunkData;
|
|
24
|
+
answer?: string;
|
|
25
|
+
tooler?: ToolEvent[];
|
|
26
|
+
error_code?: string;
|
|
27
|
+
error_detail?: string;
|
|
28
|
+
taskid?: string;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
31
|
+
}
|
|
32
|
+
interface AIMessageChunkData {
|
|
33
|
+
content: string;
|
|
34
|
+
additional_kwargs?: Record<string, unknown>;
|
|
35
|
+
response_metadata?: Record<string, unknown>;
|
|
36
|
+
type: string;
|
|
37
|
+
name?: string | null;
|
|
38
|
+
id?: string | null;
|
|
39
|
+
example?: boolean;
|
|
40
|
+
tool_calls?: ToolCall[];
|
|
41
|
+
invalid_tool_calls?: InvalidToolCall[];
|
|
42
|
+
usage_metadata?: any;
|
|
43
|
+
tool_call_chunks?: unknown[];
|
|
44
|
+
error_code?: string;
|
|
45
|
+
error_detail?: string;
|
|
46
|
+
}
|
|
47
|
+
type ToolCall = {
|
|
48
|
+
name: string;
|
|
49
|
+
args: Record<string, any>;
|
|
50
|
+
id?: string | null;
|
|
51
|
+
};
|
|
52
|
+
type InvalidToolCall = {
|
|
53
|
+
name: string | null;
|
|
54
|
+
args: string | null;
|
|
55
|
+
id: string | null;
|
|
56
|
+
error: string | null;
|
|
57
|
+
};
|
|
58
|
+
interface BaseAPIConfig {
|
|
59
|
+
baseUrl: string;
|
|
60
|
+
route: string;
|
|
61
|
+
token?: string;
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface RatingData {
|
|
65
|
+
assistantId: string;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
topicId: number;
|
|
68
|
+
score?: number;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
interface AttachmentPayload {
|
|
72
|
+
filename: string;
|
|
73
|
+
content_type: string;
|
|
74
|
+
content_size: number;
|
|
75
|
+
}
|
|
76
|
+
type AlquimiaMessage = Message & {
|
|
77
|
+
error_code?: string;
|
|
78
|
+
error_detail?: string;
|
|
79
|
+
taskid?: string;
|
|
80
|
+
loading?: boolean;
|
|
81
|
+
created_at?: string;
|
|
82
|
+
additionalInfo?: string;
|
|
83
|
+
tooler?: Tooler[];
|
|
84
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
85
|
+
attachments?: AttachmentPayload[];
|
|
86
|
+
};
|
|
87
|
+
interface ActionResponse<T = void> {
|
|
88
|
+
success: boolean;
|
|
89
|
+
data?: T;
|
|
90
|
+
error?: {
|
|
91
|
+
message: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
details?: any;
|
|
94
|
+
name?: string;
|
|
95
|
+
cause?: string;
|
|
96
|
+
status?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
type ApmSpan = Span & {
|
|
100
|
+
id?: string;
|
|
101
|
+
traceId?: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
type ApiError = Error & {
|
|
104
|
+
message: string;
|
|
105
|
+
name: string;
|
|
106
|
+
cause: string;
|
|
107
|
+
code?: string | number;
|
|
108
|
+
status?: string | number;
|
|
109
|
+
};
|
|
110
|
+
type Tooler = {
|
|
111
|
+
control_id: string;
|
|
112
|
+
tool_summary?: ToolSummary;
|
|
113
|
+
tool_output?: ToolOutput;
|
|
114
|
+
};
|
|
115
|
+
type ToolSummary = {
|
|
116
|
+
name: string;
|
|
117
|
+
parameters: Record<string, any>;
|
|
118
|
+
};
|
|
119
|
+
type ToolOutput = {
|
|
120
|
+
result: any;
|
|
121
|
+
status: string;
|
|
122
|
+
};
|
|
123
|
+
type ToolEvent = {
|
|
124
|
+
event_class: string;
|
|
125
|
+
control_id: string;
|
|
126
|
+
data: any;
|
|
127
|
+
status: string;
|
|
128
|
+
};
|
|
129
|
+
interface ConversationsMap {
|
|
130
|
+
[topicId: string]: string;
|
|
131
|
+
}
|
|
132
|
+
interface DocumentSearchResult {
|
|
133
|
+
pageContent: string;
|
|
134
|
+
metadata: {
|
|
135
|
+
source: string;
|
|
136
|
+
_id: string;
|
|
137
|
+
_collection_name: string;
|
|
138
|
+
};
|
|
139
|
+
score: number;
|
|
140
|
+
}
|
|
141
|
+
type ElevenLabsVoiceSettings = {
|
|
142
|
+
stability: number;
|
|
143
|
+
similarity_boost: number;
|
|
144
|
+
style: number;
|
|
145
|
+
};
|
|
146
|
+
type ElevenLabsRequestSpecs = {
|
|
147
|
+
optimize_streaming_latency: string;
|
|
148
|
+
output_format: string;
|
|
149
|
+
model_id: string;
|
|
150
|
+
language: string;
|
|
151
|
+
voice_settings: ElevenLabsVoiceSettings;
|
|
152
|
+
};
|
|
153
|
+
type TTSResult = {
|
|
154
|
+
type: 'blob';
|
|
155
|
+
data: Blob;
|
|
156
|
+
} | {
|
|
157
|
+
type: 'url';
|
|
158
|
+
data: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: 'error';
|
|
161
|
+
message: string;
|
|
162
|
+
};
|
|
163
|
+
/** One SSE `data:` JSON frame (`event_class` at top level). */
|
|
164
|
+
interface AlquimiaEventData {
|
|
165
|
+
taskid?: string;
|
|
166
|
+
event_class?: string;
|
|
167
|
+
control_id?: string;
|
|
168
|
+
date_submitted?: string;
|
|
169
|
+
status?: string | null;
|
|
170
|
+
data?: unknown;
|
|
171
|
+
experts?: ExpertInferenceResponse[];
|
|
172
|
+
thinkings?: ThinkingsInferenceResponse[];
|
|
173
|
+
tools_output?: ToolEvent[];
|
|
174
|
+
agents_output?: any[];
|
|
175
|
+
tools_pending_approval?: any[];
|
|
176
|
+
tools_pending_execution?: any[];
|
|
177
|
+
errors?: any[];
|
|
178
|
+
}
|
|
179
|
+
interface AssistantInferenceResponse {
|
|
180
|
+
event_class: string;
|
|
181
|
+
control_id: string;
|
|
182
|
+
data: string;
|
|
183
|
+
status: string;
|
|
184
|
+
date_submitted: string;
|
|
185
|
+
message?: string | null;
|
|
186
|
+
extras?: Record<string, unknown> | null;
|
|
187
|
+
extra_data?: ExtraDataContext | null;
|
|
188
|
+
channel?: unknown | null;
|
|
189
|
+
depth?: number;
|
|
190
|
+
taskid?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Channel-scoped context returned alongside an inference response (was
|
|
194
|
+
* `ExtraDataConfig` in v0.2.0). Carries message metadata from the channel
|
|
195
|
+
* the inference was triggered from.
|
|
196
|
+
*/
|
|
197
|
+
interface ExtraDataContext {
|
|
198
|
+
whatsapp_message_id?: string;
|
|
199
|
+
whatsapp_message_from?: string;
|
|
200
|
+
email_message_recipient?: string;
|
|
201
|
+
email_message_subject?: string;
|
|
202
|
+
email_message_id?: string;
|
|
203
|
+
email_message_body?: string;
|
|
204
|
+
slack_team_id?: string;
|
|
205
|
+
slack_user_id?: string;
|
|
206
|
+
slack_channel_id?: string;
|
|
207
|
+
slack_response_url?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* JSON body returned by `POST /event/infer/{assistantId}` (and channel
|
|
211
|
+
* variants). Keys match the runtime wire format (lowercase, no underscores).
|
|
212
|
+
* `taskid` is the id used for the SSE stream.
|
|
213
|
+
*/
|
|
214
|
+
interface CommonAttributes {
|
|
215
|
+
taskid?: string | null;
|
|
216
|
+
parenttaskid?: string | null;
|
|
217
|
+
sessionid?: string | null;
|
|
218
|
+
userid?: string | null;
|
|
219
|
+
assistantid?: string | null;
|
|
220
|
+
agentspaceid?: string | null;
|
|
221
|
+
channelid?: string | null;
|
|
222
|
+
depth?: string;
|
|
223
|
+
attachments?: string[];
|
|
224
|
+
/** Registry version the runtime resolved for this task (runtime v0.5.1). */
|
|
225
|
+
versiontag?: string | null;
|
|
226
|
+
}
|
|
227
|
+
type InferInitResponse = CommonAttributes;
|
|
228
|
+
/** A text block in a multimodal `query` (runtime `TextContentPart`). */
|
|
229
|
+
interface TextContentPart {
|
|
230
|
+
type: 'text';
|
|
231
|
+
text: string;
|
|
232
|
+
}
|
|
233
|
+
/** An image block in a multimodal `query` (runtime `ImageContentPart`). */
|
|
234
|
+
interface ImageContentPart {
|
|
235
|
+
type: 'image_url';
|
|
236
|
+
image_url: {
|
|
237
|
+
url: string;
|
|
238
|
+
detail?: 'auto' | 'low' | 'high';
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Catch-all for content blocks the runtime does not model explicitly. It
|
|
243
|
+
* round-trips unknown provider blocks rather than failing validation.
|
|
244
|
+
*/
|
|
245
|
+
interface NonStandardContentPart {
|
|
246
|
+
type: 'non_standard';
|
|
247
|
+
value?: Record<string, unknown>;
|
|
248
|
+
}
|
|
249
|
+
type ContentPart = TextContentPart | ImageContentPart | NonStandardContentPart;
|
|
250
|
+
/**
|
|
251
|
+
* An inference `query`: either plain text, or an OpenAI-style list of content
|
|
252
|
+
* parts for multimodal input.
|
|
253
|
+
*/
|
|
254
|
+
type Content = string | ContentPart[];
|
|
255
|
+
/**
|
|
256
|
+
* A blob held in the session context. Returned by `POST /context/blob/upload`
|
|
257
|
+
* and accepted as `input_audio` on infer (runtime v0.5.1).
|
|
258
|
+
*/
|
|
259
|
+
interface RuntimeBlob {
|
|
260
|
+
blob_id: string;
|
|
261
|
+
filename: string;
|
|
262
|
+
content_size: number;
|
|
263
|
+
content_type?: string | null;
|
|
264
|
+
checksum?: string | null;
|
|
265
|
+
created_at?: number | null;
|
|
266
|
+
expires_at?: number | null;
|
|
267
|
+
/** Base64-encoded content. Populated by channel ingest, not by blob upload. */
|
|
268
|
+
data_base64?: string | null;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Native-tools evaluation strategy. Wraps the client-side tool schemas
|
|
272
|
+
* the SDK previously sent at the top level of the infer payload.
|
|
273
|
+
*/
|
|
274
|
+
interface NativeToolsEvaluationStrategy {
|
|
275
|
+
evaluation_strategy_id: 'native';
|
|
276
|
+
tool_schemas?: unknown[];
|
|
277
|
+
max_steps?: number;
|
|
278
|
+
current_step?: number;
|
|
279
|
+
max_concurrent_tools?: number;
|
|
280
|
+
decorators?: unknown[];
|
|
281
|
+
tool_choice?: unknown;
|
|
282
|
+
structured_output?: unknown;
|
|
283
|
+
}
|
|
284
|
+
interface RawToolsEvaluationStrategy {
|
|
285
|
+
evaluation_strategy_id: 'raw';
|
|
286
|
+
tool_schemas?: unknown[];
|
|
287
|
+
}
|
|
288
|
+
interface OneShootEvaluationStrategy {
|
|
289
|
+
evaluation_strategy_id: 'one-shoot';
|
|
290
|
+
}
|
|
291
|
+
type EvaluationStrategy = NativeToolsEvaluationStrategy | RawToolsEvaluationStrategy | OneShootEvaluationStrategy;
|
|
292
|
+
interface AssistantResponseData {
|
|
293
|
+
content: string;
|
|
294
|
+
additional_kwargs: Record<string, any>;
|
|
295
|
+
response_metadata: ResponseMetadata;
|
|
296
|
+
type: string;
|
|
297
|
+
id: string;
|
|
298
|
+
example: boolean;
|
|
299
|
+
tool_calls: any[];
|
|
300
|
+
invalid_tool_calls: any[];
|
|
301
|
+
usage_metadata: UsageMetadata;
|
|
302
|
+
}
|
|
303
|
+
interface ResponseMetadata {
|
|
304
|
+
token_usage: TokenUsage;
|
|
305
|
+
model_name: string;
|
|
306
|
+
system_fingerprint: string;
|
|
307
|
+
finish_reason: string;
|
|
308
|
+
logprobs: any | null;
|
|
309
|
+
}
|
|
310
|
+
interface TokenUsage {
|
|
311
|
+
completion_tokens: number;
|
|
312
|
+
prompt_tokens: number;
|
|
313
|
+
total_tokens: number;
|
|
314
|
+
completion_time: number;
|
|
315
|
+
prompt_time: number;
|
|
316
|
+
queue_time: number;
|
|
317
|
+
total_time: number;
|
|
318
|
+
}
|
|
319
|
+
interface UsageMetadata {
|
|
320
|
+
input_tokens: number;
|
|
321
|
+
output_tokens: number;
|
|
322
|
+
total_tokens: number;
|
|
323
|
+
}
|
|
324
|
+
interface ExpertInferenceResponse {
|
|
325
|
+
event_class: string;
|
|
326
|
+
control_id: string;
|
|
327
|
+
data: {
|
|
328
|
+
label: string;
|
|
329
|
+
score: number;
|
|
330
|
+
};
|
|
331
|
+
status: string;
|
|
332
|
+
date_submitted: string;
|
|
333
|
+
}
|
|
334
|
+
interface ThinkingsInferenceResponse {
|
|
335
|
+
event_class: string;
|
|
336
|
+
control_id: string;
|
|
337
|
+
status: string;
|
|
338
|
+
date_submitted: string;
|
|
339
|
+
data: {
|
|
340
|
+
content: AssistantResponseData;
|
|
341
|
+
is_complete: boolean;
|
|
342
|
+
is_partial: boolean;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
interface GenuiSurfaceItem {
|
|
346
|
+
controlId: string;
|
|
347
|
+
surface: A2uiSurface;
|
|
348
|
+
/** Message-count anchor: the surface renders after this many messages (chronological ordering). */
|
|
349
|
+
afterCount: number;
|
|
350
|
+
/** True once the user has submitted an interactive surface (disables it + shows a submitted state). */
|
|
351
|
+
submitted?: boolean;
|
|
352
|
+
/** Set when the user declined the surface and typed a reply */
|
|
353
|
+
dismissedWith?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export { type ApmSpan as A, type BaseAPIConfig as B, type CommonAttributes as C, type DocumentSearchResult as D, type ElevenLabsRequestSpecs as E, type ToolEvent as F, type GenuiSurfaceItem as G, ToolFactory as H, type IToolSpec as I, type ToolOutput as J, type ToolSummary as K, type Tooler as L, type NativeToolsEvaluationStrategy as N, type OneShootEvaluationStrategy as O, type RatingData as R, type TTSResult as T, type UsageMetadata as U, type AIMessageChunk as a, type AIMessageChunkData as b, type ActionResponse as c, type AlquimiaEventData as d, type AlquimiaMessage as e, type ApiError as f, type AssistantInferenceResponse as g, type AssistantResponseData as h, type AttachmentPayload as i, type Content as j, type ContentPart as k, type ConversationsMap as l, type ElevenLabsVoiceSettings as m, type EvaluationStrategy as n, type ExpertInferenceResponse as o, type ExtraDataContext as p, type ITooler as q, type ImageContentPart as r, type InferInitResponse as s, type NonStandardContentPart as t, type RawToolsEvaluationStrategy as u, type ResponseMetadata as v, type RuntimeBlob as w, type TextContentPart as x, type ThinkingsInferenceResponse as y, type TokenUsage as z };
|