@botonic/plugin-ai-agents 0.48.0 → 0.49.0-alpha.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/lib/cjs/agents/base-agent.d.ts +28 -0
- package/lib/cjs/agents/base-agent.js +39 -0
- package/lib/cjs/agents/base-agent.js.map +1 -0
- package/lib/cjs/agents/index.d.ts +2 -0
- package/lib/cjs/agents/index.js +8 -0
- package/lib/cjs/agents/index.js.map +1 -0
- package/lib/cjs/agents/router-agent.d.ts +25 -0
- package/lib/cjs/agents/router-agent.js +33 -0
- package/lib/cjs/agents/router-agent.js.map +1 -0
- package/lib/cjs/agents/worker-agent.d.ts +35 -0
- package/lib/cjs/{agent-builder.js → agents/worker-agent.js} +48 -49
- package/lib/cjs/agents/worker-agent.js.map +1 -0
- package/lib/cjs/bot-config-tools.js +3 -4
- package/lib/cjs/bot-config-tools.js.map +1 -1
- package/lib/cjs/debug-logger.d.ts +1 -1
- package/lib/cjs/debug-logger.js +4 -1
- package/lib/cjs/debug-logger.js.map +1 -1
- package/lib/cjs/guardrails/input.d.ts +1 -1
- package/lib/cjs/guardrails/input.js +25 -9
- package/lib/cjs/guardrails/input.js.map +1 -1
- package/lib/cjs/index.d.ts +4 -1
- package/lib/cjs/index.js +112 -51
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/llm-config.d.ts +2 -1
- package/lib/cjs/llm-config.js +3 -0
- package/lib/cjs/llm-config.js.map +1 -1
- package/lib/cjs/runners/base-runner.d.ts +26 -0
- package/lib/cjs/runners/base-runner.js +114 -0
- package/lib/cjs/runners/base-runner.js.map +1 -0
- package/lib/cjs/runners/index.d.ts +2 -0
- package/lib/cjs/runners/index.js +8 -0
- package/lib/cjs/runners/index.js.map +1 -0
- package/lib/cjs/runners/router-runner.d.ts +6 -0
- package/lib/cjs/runners/router-runner.js +29 -0
- package/lib/cjs/runners/router-runner.js.map +1 -0
- package/lib/cjs/runners/worker-runner.d.ts +10 -0
- package/lib/cjs/runners/worker-runner.js +78 -0
- package/lib/cjs/runners/worker-runner.js.map +1 -0
- package/lib/cjs/structured-output/bot-executor.d.ts +6 -42
- package/lib/cjs/structured-output/bot-executor.js +9 -9
- package/lib/cjs/structured-output/bot-executor.js.map +1 -1
- package/lib/cjs/structured-output/carousel.d.ts +6 -78
- package/lib/cjs/structured-output/carousel.js +2 -1
- package/lib/cjs/structured-output/carousel.js.map +1 -1
- package/lib/cjs/structured-output/exit.d.ts +4 -8
- package/lib/cjs/structured-output/exit.js +4 -4
- package/lib/cjs/structured-output/exit.js.map +1 -1
- package/lib/cjs/structured-output/index.d.ts +48 -553
- package/lib/cjs/structured-output/index.js +15 -0
- package/lib/cjs/structured-output/index.js.map +1 -1
- package/lib/cjs/structured-output/text-with-buttons.d.ts +10 -49
- package/lib/cjs/structured-output/text-with-buttons.js +10 -10
- package/lib/cjs/structured-output/text-with-buttons.js.map +1 -1
- package/lib/cjs/structured-output/text.d.ts +4 -18
- package/lib/cjs/structured-output/text.js +2 -1
- package/lib/cjs/structured-output/text.js.map +1 -1
- package/lib/cjs/tools/index.d.ts +1 -1
- package/lib/cjs/tools/index.js +3 -2
- package/lib/cjs/tools/index.js.map +1 -1
- package/lib/cjs/tools/retrieve-knowledge.d.ts +3 -6
- package/lib/cjs/tools/retrieve-knowledge.js +7 -5
- package/lib/cjs/tools/retrieve-knowledge.js.map +1 -1
- package/lib/cjs/types.d.ts +2 -3
- package/lib/esm/agents/base-agent.d.ts +28 -0
- package/lib/esm/agents/base-agent.js +39 -0
- package/lib/esm/agents/base-agent.js.map +1 -0
- package/lib/esm/agents/index.d.ts +2 -0
- package/lib/esm/agents/index.js +8 -0
- package/lib/esm/agents/index.js.map +1 -0
- package/lib/esm/agents/router-agent.d.ts +25 -0
- package/lib/esm/agents/router-agent.js +33 -0
- package/lib/esm/agents/router-agent.js.map +1 -0
- package/lib/esm/agents/worker-agent.d.ts +35 -0
- package/lib/esm/{agent-builder.js → agents/worker-agent.js} +48 -49
- package/lib/esm/agents/worker-agent.js.map +1 -0
- package/lib/esm/bot-config-tools.js +3 -4
- package/lib/esm/bot-config-tools.js.map +1 -1
- package/lib/esm/debug-logger.d.ts +1 -1
- package/lib/esm/debug-logger.js +4 -1
- package/lib/esm/debug-logger.js.map +1 -1
- package/lib/esm/guardrails/input.d.ts +1 -1
- package/lib/esm/guardrails/input.js +25 -9
- package/lib/esm/guardrails/input.js.map +1 -1
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +112 -51
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/llm-config.d.ts +2 -1
- package/lib/esm/llm-config.js +3 -0
- package/lib/esm/llm-config.js.map +1 -1
- package/lib/esm/runners/base-runner.d.ts +26 -0
- package/lib/esm/runners/base-runner.js +114 -0
- package/lib/esm/runners/base-runner.js.map +1 -0
- package/lib/esm/runners/index.d.ts +2 -0
- package/lib/esm/runners/index.js +8 -0
- package/lib/esm/runners/index.js.map +1 -0
- package/lib/esm/runners/router-runner.d.ts +6 -0
- package/lib/esm/runners/router-runner.js +29 -0
- package/lib/esm/runners/router-runner.js.map +1 -0
- package/lib/esm/runners/worker-runner.d.ts +10 -0
- package/lib/esm/runners/worker-runner.js +78 -0
- package/lib/esm/runners/worker-runner.js.map +1 -0
- package/lib/esm/structured-output/bot-executor.d.ts +6 -42
- package/lib/esm/structured-output/bot-executor.js +9 -9
- package/lib/esm/structured-output/bot-executor.js.map +1 -1
- package/lib/esm/structured-output/carousel.d.ts +6 -78
- package/lib/esm/structured-output/carousel.js +2 -1
- package/lib/esm/structured-output/carousel.js.map +1 -1
- package/lib/esm/structured-output/exit.d.ts +4 -8
- package/lib/esm/structured-output/exit.js +4 -4
- package/lib/esm/structured-output/exit.js.map +1 -1
- package/lib/esm/structured-output/index.d.ts +48 -553
- package/lib/esm/structured-output/index.js +15 -0
- package/lib/esm/structured-output/index.js.map +1 -1
- package/lib/esm/structured-output/text-with-buttons.d.ts +10 -49
- package/lib/esm/structured-output/text-with-buttons.js +10 -10
- package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
- package/lib/esm/structured-output/text.d.ts +4 -18
- package/lib/esm/structured-output/text.js +2 -1
- package/lib/esm/structured-output/text.js.map +1 -1
- package/lib/esm/tools/index.d.ts +1 -1
- package/lib/esm/tools/index.js +3 -2
- package/lib/esm/tools/index.js.map +1 -1
- package/lib/esm/tools/retrieve-knowledge.d.ts +3 -6
- package/lib/esm/tools/retrieve-knowledge.js +7 -5
- package/lib/esm/tools/retrieve-knowledge.js.map +1 -1
- package/lib/esm/types.d.ts +2 -3
- package/package.json +6 -7
- package/src/agents/base-agent.ts +75 -0
- package/src/agents/index.ts +2 -0
- package/src/agents/router-agent.ts +71 -0
- package/src/{agent-builder.ts → agents/worker-agent.ts} +75 -77
- package/src/bot-config-tools.ts +3 -4
- package/src/debug-logger.ts +10 -4
- package/src/guardrails/input.ts +35 -9
- package/src/index.ts +216 -82
- package/src/llm-config.ts +5 -0
- package/src/runners/base-runner.ts +190 -0
- package/src/runners/index.ts +2 -0
- package/src/runners/router-runner.ts +41 -0
- package/src/runners/worker-runner.ts +112 -0
- package/src/structured-output/bot-executor.ts +3 -3
- package/src/structured-output/carousel.ts +2 -2
- package/src/structured-output/exit.ts +3 -3
- package/src/structured-output/index.ts +15 -0
- package/src/structured-output/text-with-buttons.ts +3 -3
- package/src/structured-output/text.ts +2 -2
- package/src/tools/index.ts +4 -1
- package/src/tools/retrieve-knowledge.ts +32 -29
- package/src/types.ts +2 -3
- package/lib/cjs/agent-builder.d.ts +0 -37
- package/lib/cjs/agent-builder.js.map +0 -1
- package/lib/cjs/runner.d.ts +0 -18
- package/lib/cjs/runner.js +0 -180
- package/lib/cjs/runner.js.map +0 -1
- package/lib/esm/agent-builder.d.ts +0 -37
- package/lib/esm/agent-builder.js.map +0 -1
- package/lib/esm/runner.d.ts +0 -18
- package/lib/esm/runner.js +0 -180
- package/lib/esm/runner.js.map +0 -1
- package/src/runner.ts +0 -283
|
@@ -5,78 +5,25 @@ export interface Output {
|
|
|
5
5
|
}
|
|
6
6
|
export declare const OutputSchema: z.ZodObject<{
|
|
7
7
|
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
-
type: z.
|
|
8
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
|
|
9
9
|
content: z.ZodObject<{
|
|
10
10
|
text: z.ZodString;
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
text: string;
|
|
15
|
-
}>;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
type: "text";
|
|
18
|
-
content: {
|
|
19
|
-
text: string;
|
|
20
|
-
};
|
|
21
|
-
}, {
|
|
22
|
-
type: "text";
|
|
23
|
-
content: {
|
|
24
|
-
text: string;
|
|
25
|
-
};
|
|
26
|
-
}>, z.ZodObject<{
|
|
27
|
-
type: z.ZodEnum<["textWithButtons"]>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
|
|
28
14
|
content: z.ZodObject<{
|
|
29
15
|
text: z.ZodString;
|
|
30
16
|
buttons: z.ZodArray<z.ZodObject<{
|
|
31
17
|
text: z.ZodString;
|
|
32
18
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
42
|
-
}>, "many">;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
text: string;
|
|
45
|
-
buttons: {
|
|
46
|
-
text: string;
|
|
47
|
-
url?: string | null | undefined;
|
|
48
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
49
|
-
}[];
|
|
50
|
-
}, {
|
|
51
|
-
text: string;
|
|
52
|
-
buttons: {
|
|
53
|
-
text: string;
|
|
54
|
-
url?: string | null | undefined;
|
|
55
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
56
|
-
}[];
|
|
57
|
-
}>;
|
|
58
|
-
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
type: "textWithButtons";
|
|
60
|
-
content: {
|
|
61
|
-
text: string;
|
|
62
|
-
buttons: {
|
|
63
|
-
text: string;
|
|
64
|
-
url?: string | null | undefined;
|
|
65
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
66
|
-
}[];
|
|
67
|
-
};
|
|
68
|
-
}, {
|
|
69
|
-
type: "textWithButtons";
|
|
70
|
-
content: {
|
|
71
|
-
text: string;
|
|
72
|
-
buttons: {
|
|
73
|
-
text: string;
|
|
74
|
-
url?: string | null | undefined;
|
|
75
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
76
|
-
}[];
|
|
77
|
-
};
|
|
78
|
-
}>, z.ZodObject<{
|
|
79
|
-
type: z.ZodEnum<["carousel"]>;
|
|
19
|
+
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
20
|
+
_blank: "_blank";
|
|
21
|
+
_self: "_self";
|
|
22
|
+
}>>>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
|
|
80
27
|
content: z.ZodObject<{
|
|
81
28
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
29
|
elements: z.ZodArray<z.ZodObject<{
|
|
@@ -86,292 +33,43 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
86
33
|
button: z.ZodObject<{
|
|
87
34
|
text: z.ZodString;
|
|
88
35
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
title: string;
|
|
98
|
-
subtitle: string;
|
|
99
|
-
image: string;
|
|
100
|
-
button: {
|
|
101
|
-
text: string;
|
|
102
|
-
url?: string | null | undefined;
|
|
103
|
-
};
|
|
104
|
-
}, {
|
|
105
|
-
title: string;
|
|
106
|
-
subtitle: string;
|
|
107
|
-
image: string;
|
|
108
|
-
button: {
|
|
109
|
-
text: string;
|
|
110
|
-
url?: string | null | undefined;
|
|
111
|
-
};
|
|
112
|
-
}>, "many">;
|
|
113
|
-
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
elements: {
|
|
115
|
-
title: string;
|
|
116
|
-
subtitle: string;
|
|
117
|
-
image: string;
|
|
118
|
-
button: {
|
|
119
|
-
text: string;
|
|
120
|
-
url?: string | null | undefined;
|
|
121
|
-
};
|
|
122
|
-
}[];
|
|
123
|
-
text?: string | null | undefined;
|
|
124
|
-
}, {
|
|
125
|
-
elements: {
|
|
126
|
-
title: string;
|
|
127
|
-
subtitle: string;
|
|
128
|
-
image: string;
|
|
129
|
-
button: {
|
|
130
|
-
text: string;
|
|
131
|
-
url?: string | null | undefined;
|
|
132
|
-
};
|
|
133
|
-
}[];
|
|
134
|
-
text?: string | null | undefined;
|
|
135
|
-
}>;
|
|
136
|
-
}, "strip", z.ZodTypeAny, {
|
|
137
|
-
type: "carousel";
|
|
138
|
-
content: {
|
|
139
|
-
elements: {
|
|
140
|
-
title: string;
|
|
141
|
-
subtitle: string;
|
|
142
|
-
image: string;
|
|
143
|
-
button: {
|
|
144
|
-
text: string;
|
|
145
|
-
url?: string | null | undefined;
|
|
146
|
-
};
|
|
147
|
-
}[];
|
|
148
|
-
text?: string | null | undefined;
|
|
149
|
-
};
|
|
150
|
-
}, {
|
|
151
|
-
type: "carousel";
|
|
152
|
-
content: {
|
|
153
|
-
elements: {
|
|
154
|
-
title: string;
|
|
155
|
-
subtitle: string;
|
|
156
|
-
image: string;
|
|
157
|
-
button: {
|
|
158
|
-
text: string;
|
|
159
|
-
url?: string | null | undefined;
|
|
160
|
-
};
|
|
161
|
-
}[];
|
|
162
|
-
text?: string | null | undefined;
|
|
163
|
-
};
|
|
164
|
-
}>, z.ZodObject<{
|
|
165
|
-
type: z.ZodEnum<["exit"]>;
|
|
166
|
-
}, "strip", z.ZodTypeAny, {
|
|
167
|
-
type: "exit";
|
|
168
|
-
}, {
|
|
169
|
-
type: "exit";
|
|
170
|
-
}>, z.ZodObject<{
|
|
171
|
-
type: z.ZodEnum<["botExecutor"]>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
|
|
172
43
|
content: z.ZodObject<{
|
|
173
44
|
text: z.ZodString;
|
|
174
45
|
buttons: z.ZodArray<z.ZodObject<{
|
|
175
46
|
text: z.ZodString;
|
|
176
47
|
payload: z.ZodString;
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
text: string;
|
|
182
|
-
payload: string;
|
|
183
|
-
}>, "many">;
|
|
184
|
-
}, "strip", z.ZodTypeAny, {
|
|
185
|
-
text: string;
|
|
186
|
-
buttons: {
|
|
187
|
-
text: string;
|
|
188
|
-
payload: string;
|
|
189
|
-
}[];
|
|
190
|
-
}, {
|
|
191
|
-
text: string;
|
|
192
|
-
buttons: {
|
|
193
|
-
text: string;
|
|
194
|
-
payload: string;
|
|
195
|
-
}[];
|
|
196
|
-
}>;
|
|
197
|
-
}, "strip", z.ZodTypeAny, {
|
|
198
|
-
type: "botExecutor";
|
|
199
|
-
content: {
|
|
200
|
-
text: string;
|
|
201
|
-
buttons: {
|
|
202
|
-
text: string;
|
|
203
|
-
payload: string;
|
|
204
|
-
}[];
|
|
205
|
-
};
|
|
206
|
-
}, {
|
|
207
|
-
type: "botExecutor";
|
|
208
|
-
content: {
|
|
209
|
-
text: string;
|
|
210
|
-
buttons: {
|
|
211
|
-
text: string;
|
|
212
|
-
payload: string;
|
|
213
|
-
}[];
|
|
214
|
-
};
|
|
215
|
-
}>]>, "many">;
|
|
216
|
-
}, "strip", z.ZodTypeAny, {
|
|
217
|
-
messages: ({
|
|
218
|
-
type: "botExecutor";
|
|
219
|
-
content: {
|
|
220
|
-
text: string;
|
|
221
|
-
buttons: {
|
|
222
|
-
text: string;
|
|
223
|
-
payload: string;
|
|
224
|
-
}[];
|
|
225
|
-
};
|
|
226
|
-
} | {
|
|
227
|
-
type: "carousel";
|
|
228
|
-
content: {
|
|
229
|
-
elements: {
|
|
230
|
-
title: string;
|
|
231
|
-
subtitle: string;
|
|
232
|
-
image: string;
|
|
233
|
-
button: {
|
|
234
|
-
text: string;
|
|
235
|
-
url?: string | null | undefined;
|
|
236
|
-
};
|
|
237
|
-
}[];
|
|
238
|
-
text?: string | null | undefined;
|
|
239
|
-
};
|
|
240
|
-
} | {
|
|
241
|
-
type: "exit";
|
|
242
|
-
} | {
|
|
243
|
-
type: "text";
|
|
244
|
-
content: {
|
|
245
|
-
text: string;
|
|
246
|
-
};
|
|
247
|
-
} | {
|
|
248
|
-
type: "textWithButtons";
|
|
249
|
-
content: {
|
|
250
|
-
text: string;
|
|
251
|
-
buttons: {
|
|
252
|
-
text: string;
|
|
253
|
-
url?: string | null | undefined;
|
|
254
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
255
|
-
}[];
|
|
256
|
-
};
|
|
257
|
-
})[];
|
|
258
|
-
}, {
|
|
259
|
-
messages: ({
|
|
260
|
-
type: "botExecutor";
|
|
261
|
-
content: {
|
|
262
|
-
text: string;
|
|
263
|
-
buttons: {
|
|
264
|
-
text: string;
|
|
265
|
-
payload: string;
|
|
266
|
-
}[];
|
|
267
|
-
};
|
|
268
|
-
} | {
|
|
269
|
-
type: "carousel";
|
|
270
|
-
content: {
|
|
271
|
-
elements: {
|
|
272
|
-
title: string;
|
|
273
|
-
subtitle: string;
|
|
274
|
-
image: string;
|
|
275
|
-
button: {
|
|
276
|
-
text: string;
|
|
277
|
-
url?: string | null | undefined;
|
|
278
|
-
};
|
|
279
|
-
}[];
|
|
280
|
-
text?: string | null | undefined;
|
|
281
|
-
};
|
|
282
|
-
} | {
|
|
283
|
-
type: "exit";
|
|
284
|
-
} | {
|
|
285
|
-
type: "text";
|
|
286
|
-
content: {
|
|
287
|
-
text: string;
|
|
288
|
-
};
|
|
289
|
-
} | {
|
|
290
|
-
type: "textWithButtons";
|
|
291
|
-
content: {
|
|
292
|
-
text: string;
|
|
293
|
-
buttons: {
|
|
294
|
-
text: string;
|
|
295
|
-
url?: string | null | undefined;
|
|
296
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
297
|
-
}[];
|
|
298
|
-
};
|
|
299
|
-
})[];
|
|
300
|
-
}>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>]>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
301
52
|
export declare function getOutputSchema(externalOutputMessagesSchemas: z.ZodObject<any>[]): z.ZodObject<{
|
|
302
|
-
messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
303
|
-
type: z.
|
|
53
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Text>;
|
|
304
55
|
content: z.ZodObject<{
|
|
305
56
|
text: z.ZodString;
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
text: string;
|
|
310
|
-
}>;
|
|
311
|
-
}, "strip", z.ZodTypeAny, {
|
|
312
|
-
type: "text";
|
|
313
|
-
content: {
|
|
314
|
-
text: string;
|
|
315
|
-
};
|
|
316
|
-
}, {
|
|
317
|
-
type: "text";
|
|
318
|
-
content: {
|
|
319
|
-
text: string;
|
|
320
|
-
};
|
|
321
|
-
}>, z.ZodObject<{
|
|
322
|
-
type: z.ZodEnum<["textWithButtons"]>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.TextWithButtons>;
|
|
323
60
|
content: z.ZodObject<{
|
|
324
61
|
text: z.ZodString;
|
|
325
62
|
buttons: z.ZodArray<z.ZodObject<{
|
|
326
63
|
text: z.ZodString;
|
|
327
64
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
328
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
337
|
-
}>, "many">;
|
|
338
|
-
}, "strip", z.ZodTypeAny, {
|
|
339
|
-
text: string;
|
|
340
|
-
buttons: {
|
|
341
|
-
text: string;
|
|
342
|
-
url?: string | null | undefined;
|
|
343
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
344
|
-
}[];
|
|
345
|
-
}, {
|
|
346
|
-
text: string;
|
|
347
|
-
buttons: {
|
|
348
|
-
text: string;
|
|
349
|
-
url?: string | null | undefined;
|
|
350
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
351
|
-
}[];
|
|
352
|
-
}>;
|
|
353
|
-
}, "strip", z.ZodTypeAny, {
|
|
354
|
-
type: "textWithButtons";
|
|
355
|
-
content: {
|
|
356
|
-
text: string;
|
|
357
|
-
buttons: {
|
|
358
|
-
text: string;
|
|
359
|
-
url?: string | null | undefined;
|
|
360
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
361
|
-
}[];
|
|
362
|
-
};
|
|
363
|
-
}, {
|
|
364
|
-
type: "textWithButtons";
|
|
365
|
-
content: {
|
|
366
|
-
text: string;
|
|
367
|
-
buttons: {
|
|
368
|
-
text: string;
|
|
369
|
-
url?: string | null | undefined;
|
|
370
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
371
|
-
}[];
|
|
372
|
-
};
|
|
373
|
-
}>, z.ZodObject<{
|
|
374
|
-
type: z.ZodEnum<["carousel"]>;
|
|
65
|
+
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
66
|
+
_blank: "_blank";
|
|
67
|
+
_self: "_self";
|
|
68
|
+
}>>>>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Carousel>;
|
|
375
73
|
content: z.ZodObject<{
|
|
376
74
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
377
75
|
elements: z.ZodArray<z.ZodObject<{
|
|
@@ -381,223 +79,20 @@ export declare function getOutputSchema(externalOutputMessagesSchemas: z.ZodObje
|
|
|
381
79
|
button: z.ZodObject<{
|
|
382
80
|
text: z.ZodString;
|
|
383
81
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
384
|
-
},
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}, "strip", z.ZodTypeAny, {
|
|
392
|
-
title: string;
|
|
393
|
-
subtitle: string;
|
|
394
|
-
image: string;
|
|
395
|
-
button: {
|
|
396
|
-
text: string;
|
|
397
|
-
url?: string | null | undefined;
|
|
398
|
-
};
|
|
399
|
-
}, {
|
|
400
|
-
title: string;
|
|
401
|
-
subtitle: string;
|
|
402
|
-
image: string;
|
|
403
|
-
button: {
|
|
404
|
-
text: string;
|
|
405
|
-
url?: string | null | undefined;
|
|
406
|
-
};
|
|
407
|
-
}>, "many">;
|
|
408
|
-
}, "strip", z.ZodTypeAny, {
|
|
409
|
-
elements: {
|
|
410
|
-
title: string;
|
|
411
|
-
subtitle: string;
|
|
412
|
-
image: string;
|
|
413
|
-
button: {
|
|
414
|
-
text: string;
|
|
415
|
-
url?: string | null | undefined;
|
|
416
|
-
};
|
|
417
|
-
}[];
|
|
418
|
-
text?: string | null | undefined;
|
|
419
|
-
}, {
|
|
420
|
-
elements: {
|
|
421
|
-
title: string;
|
|
422
|
-
subtitle: string;
|
|
423
|
-
image: string;
|
|
424
|
-
button: {
|
|
425
|
-
text: string;
|
|
426
|
-
url?: string | null | undefined;
|
|
427
|
-
};
|
|
428
|
-
}[];
|
|
429
|
-
text?: string | null | undefined;
|
|
430
|
-
}>;
|
|
431
|
-
}, "strip", z.ZodTypeAny, {
|
|
432
|
-
type: "carousel";
|
|
433
|
-
content: {
|
|
434
|
-
elements: {
|
|
435
|
-
title: string;
|
|
436
|
-
subtitle: string;
|
|
437
|
-
image: string;
|
|
438
|
-
button: {
|
|
439
|
-
text: string;
|
|
440
|
-
url?: string | null | undefined;
|
|
441
|
-
};
|
|
442
|
-
}[];
|
|
443
|
-
text?: string | null | undefined;
|
|
444
|
-
};
|
|
445
|
-
}, {
|
|
446
|
-
type: "carousel";
|
|
447
|
-
content: {
|
|
448
|
-
elements: {
|
|
449
|
-
title: string;
|
|
450
|
-
subtitle: string;
|
|
451
|
-
image: string;
|
|
452
|
-
button: {
|
|
453
|
-
text: string;
|
|
454
|
-
url?: string | null | undefined;
|
|
455
|
-
};
|
|
456
|
-
}[];
|
|
457
|
-
text?: string | null | undefined;
|
|
458
|
-
};
|
|
459
|
-
}>, z.ZodObject<{
|
|
460
|
-
type: z.ZodEnum<["exit"]>;
|
|
461
|
-
}, "strip", z.ZodTypeAny, {
|
|
462
|
-
type: "exit";
|
|
463
|
-
}, {
|
|
464
|
-
type: "exit";
|
|
465
|
-
}>, z.ZodObject<{
|
|
466
|
-
type: z.ZodEnum<["botExecutor"]>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.Exit>;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<import("@botonic/core").OutputMessageType.BotExecutor>;
|
|
467
89
|
content: z.ZodObject<{
|
|
468
90
|
text: z.ZodString;
|
|
469
91
|
buttons: z.ZodArray<z.ZodObject<{
|
|
470
92
|
text: z.ZodString;
|
|
471
93
|
payload: z.ZodString;
|
|
472
|
-
},
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
payload: string;
|
|
478
|
-
}>, "many">;
|
|
479
|
-
}, "strip", z.ZodTypeAny, {
|
|
480
|
-
text: string;
|
|
481
|
-
buttons: {
|
|
482
|
-
text: string;
|
|
483
|
-
payload: string;
|
|
484
|
-
}[];
|
|
485
|
-
}, {
|
|
486
|
-
text: string;
|
|
487
|
-
buttons: {
|
|
488
|
-
text: string;
|
|
489
|
-
payload: string;
|
|
490
|
-
}[];
|
|
491
|
-
}>;
|
|
492
|
-
}, "strip", z.ZodTypeAny, {
|
|
493
|
-
type: "botExecutor";
|
|
494
|
-
content: {
|
|
495
|
-
text: string;
|
|
496
|
-
buttons: {
|
|
497
|
-
text: string;
|
|
498
|
-
payload: string;
|
|
499
|
-
}[];
|
|
500
|
-
};
|
|
501
|
-
}, {
|
|
502
|
-
type: "botExecutor";
|
|
503
|
-
content: {
|
|
504
|
-
text: string;
|
|
505
|
-
buttons: {
|
|
506
|
-
text: string;
|
|
507
|
-
payload: string;
|
|
508
|
-
}[];
|
|
509
|
-
};
|
|
510
|
-
}>, ...z.ZodObject<any, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
511
|
-
[x: string]: any;
|
|
512
|
-
}, {
|
|
513
|
-
[x: string]: any;
|
|
514
|
-
}>[]]>, "many">;
|
|
515
|
-
}, "strip", z.ZodTypeAny, {
|
|
516
|
-
messages: ({
|
|
517
|
-
type: "botExecutor";
|
|
518
|
-
content: {
|
|
519
|
-
text: string;
|
|
520
|
-
buttons: {
|
|
521
|
-
text: string;
|
|
522
|
-
payload: string;
|
|
523
|
-
}[];
|
|
524
|
-
};
|
|
525
|
-
} | {
|
|
526
|
-
type: "carousel";
|
|
527
|
-
content: {
|
|
528
|
-
elements: {
|
|
529
|
-
title: string;
|
|
530
|
-
subtitle: string;
|
|
531
|
-
image: string;
|
|
532
|
-
button: {
|
|
533
|
-
text: string;
|
|
534
|
-
url?: string | null | undefined;
|
|
535
|
-
};
|
|
536
|
-
}[];
|
|
537
|
-
text?: string | null | undefined;
|
|
538
|
-
};
|
|
539
|
-
} | {
|
|
540
|
-
type: "exit";
|
|
541
|
-
} | {
|
|
542
|
-
type: "text";
|
|
543
|
-
content: {
|
|
544
|
-
text: string;
|
|
545
|
-
};
|
|
546
|
-
} | {
|
|
547
|
-
type: "textWithButtons";
|
|
548
|
-
content: {
|
|
549
|
-
text: string;
|
|
550
|
-
buttons: {
|
|
551
|
-
text: string;
|
|
552
|
-
url?: string | null | undefined;
|
|
553
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
554
|
-
}[];
|
|
555
|
-
};
|
|
556
|
-
} | {
|
|
557
|
-
[x: string]: any;
|
|
558
|
-
})[];
|
|
559
|
-
}, {
|
|
560
|
-
messages: ({
|
|
561
|
-
type: "botExecutor";
|
|
562
|
-
content: {
|
|
563
|
-
text: string;
|
|
564
|
-
buttons: {
|
|
565
|
-
text: string;
|
|
566
|
-
payload: string;
|
|
567
|
-
}[];
|
|
568
|
-
};
|
|
569
|
-
} | {
|
|
570
|
-
type: "carousel";
|
|
571
|
-
content: {
|
|
572
|
-
elements: {
|
|
573
|
-
title: string;
|
|
574
|
-
subtitle: string;
|
|
575
|
-
image: string;
|
|
576
|
-
button: {
|
|
577
|
-
text: string;
|
|
578
|
-
url?: string | null | undefined;
|
|
579
|
-
};
|
|
580
|
-
}[];
|
|
581
|
-
text?: string | null | undefined;
|
|
582
|
-
};
|
|
583
|
-
} | {
|
|
584
|
-
type: "exit";
|
|
585
|
-
} | {
|
|
586
|
-
type: "text";
|
|
587
|
-
content: {
|
|
588
|
-
text: string;
|
|
589
|
-
};
|
|
590
|
-
} | {
|
|
591
|
-
type: "textWithButtons";
|
|
592
|
-
content: {
|
|
593
|
-
text: string;
|
|
594
|
-
buttons: {
|
|
595
|
-
text: string;
|
|
596
|
-
url?: string | null | undefined;
|
|
597
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
598
|
-
}[];
|
|
599
|
-
};
|
|
600
|
-
} | {
|
|
601
|
-
[x: string]: any;
|
|
602
|
-
})[];
|
|
603
|
-
}>;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
}, z.core.$strip>, ...z.ZodObject<any, z.core.$strip>[]]>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
export declare function getOutputInstructions(): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OutputSchema = void 0;
|
|
4
4
|
exports.getOutputSchema = getOutputSchema;
|
|
5
|
+
exports.getOutputInstructions = getOutputInstructions;
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
const bot_executor_1 = require("./bot-executor");
|
|
7
8
|
const carousel_1 = require("./carousel");
|
|
@@ -25,4 +26,18 @@ function getOutputSchema(externalOutputMessagesSchemas) {
|
|
|
25
26
|
messages: zod_1.z.array(zod_1.z.union([...baseMessageSchemas, ...externalOutputMessagesSchemas])),
|
|
26
27
|
});
|
|
27
28
|
}
|
|
29
|
+
function getOutputInstructions() {
|
|
30
|
+
const example = {
|
|
31
|
+
messages: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
content: {
|
|
35
|
+
text: 'Hello, how can I help you today?',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
const output = `Return a JSON that follows the output schema provided. Never return multiple output schemas concatenated by a line break.\n<example>\n${JSON.stringify(example)}\n</example>`;
|
|
41
|
+
return `<output>\n${output}\n</output>`;
|
|
42
|
+
}
|
|
28
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AAyBA,0CAQC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AAyBA,0CAQC;AAED,sDAaC;AA/CD,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,iCAAmC;AACnC,iCAAmC;AACnC,2DAA2D;AAM3D,MAAM,kBAAkB,GAAG;IACzB,iBAAU;IACV,yCAAqB;IACrB,yBAAc;IACd,iBAAU;IACV,gCAAiB;CACT,CAAA;AACG,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAElD,SAAgB,eAAe,CAC7B,6BAAiD;IAEjD,OAAO,OAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,EAAE,GAAG,6BAA6B,CAAC,CAAC,CACnE;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,kCAAkC;iBACzC;aACF;SACF;KACF,CAAA;IACD,MAAM,MAAM,GAAG,yIAAyI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;IAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;AACzC,CAAC"}
|