@botonic/plugin-ai-agents 2.28.0 → 2.30.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 +26 -0
- package/package.json +7 -5
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/lib/agents/base-agent.d.ts +25 -0
- package/src/lib/agents/base-agent.js +39 -0
- package/src/lib/agents/base-agent.js.map +1 -0
- package/src/lib/agents/index.d.ts +2 -0
- package/src/lib/agents/index.js +3 -0
- package/src/lib/agents/index.js.map +1 -0
- package/src/lib/agents/router-agent.d.ts +23 -0
- package/src/lib/agents/router-agent.js +32 -0
- package/src/lib/agents/router-agent.js.map +1 -0
- package/src/lib/agents/specialist-agent.d.ts +33 -0
- package/src/lib/agents/specialist-agent.js +103 -0
- package/src/lib/agents/specialist-agent.js.map +1 -0
- package/src/lib/bot-config-tools.d.ts +7 -0
- package/src/lib/bot-config-tools.js +11 -0
- package/src/lib/bot-config-tools.js.map +1 -0
- package/src/lib/constants.d.ts +16 -6
- package/src/lib/constants.js +16 -8
- package/src/lib/constants.js.map +1 -1
- package/src/lib/debug-logger.d.ts +4 -2
- package/src/lib/debug-logger.js +20 -22
- package/src/lib/debug-logger.js.map +1 -1
- package/src/lib/guardrails/input.d.ts +9 -3
- package/src/lib/guardrails/input.js +100 -24
- package/src/lib/guardrails/input.js.map +1 -1
- package/src/lib/index.d.ts +9 -3
- package/src/lib/index.js +128 -36
- package/src/lib/index.js.map +1 -1
- package/src/lib/llm-config.d.ts +31 -0
- package/src/lib/llm-config.js +111 -0
- package/src/lib/llm-config.js.map +1 -0
- package/src/lib/runners/base-runner.d.ts +32 -0
- package/src/lib/runners/base-runner.js +182 -0
- package/src/lib/runners/base-runner.js.map +1 -0
- package/src/lib/runners/index.d.ts +2 -0
- package/src/lib/runners/index.js +3 -0
- package/src/lib/runners/index.js.map +1 -0
- package/src/lib/runners/router-runner.d.ts +8 -0
- package/src/lib/runners/router-runner.js +40 -0
- package/src/lib/runners/router-runner.js.map +1 -0
- package/src/lib/runners/specialist-runner.d.ts +4 -0
- package/src/lib/runners/specialist-runner.js +4 -0
- package/src/lib/runners/specialist-runner.js.map +1 -0
- package/src/lib/services/hubtype-api-client.d.ts +13 -0
- package/src/lib/{hubtype-api-client.js → services/hubtype-api-client.js} +32 -51
- package/src/lib/services/hubtype-api-client.js.map +1 -0
- package/src/lib/services/types.d.ts +71 -0
- package/src/lib/services/types.js +10 -0
- package/src/lib/services/types.js.map +1 -0
- package/src/lib/structured-output/bot-executor.d.ts +15 -0
- package/src/lib/structured-output/bot-executor.js +15 -0
- package/src/lib/structured-output/bot-executor.js.map +1 -0
- package/src/lib/structured-output/carousel.d.ts +8 -78
- package/src/lib/structured-output/carousel.js +2 -1
- package/src/lib/structured-output/carousel.js.map +1 -1
- package/src/lib/structured-output/exit.d.ts +5 -7
- package/src/lib/structured-output/exit.js +2 -1
- package/src/lib/structured-output/exit.js.map +1 -1
- package/src/lib/structured-output/flow-builder-content.d.ts +9 -0
- package/src/lib/structured-output/flow-builder-content.js +9 -0
- package/src/lib/structured-output/flow-builder-content.js.map +1 -0
- package/src/lib/structured-output/index.d.ts +103 -203
- package/src/lib/structured-output/index.js +30 -3
- package/src/lib/structured-output/index.js.map +1 -1
- package/src/lib/structured-output/text-with-buttons.d.ts +11 -41
- package/src/lib/structured-output/text-with-buttons.js +8 -1
- package/src/lib/structured-output/text-with-buttons.js.map +1 -1
- package/src/lib/structured-output/text.d.ts +6 -18
- package/src/lib/structured-output/text.js +2 -1
- package/src/lib/structured-output/text.js.map +1 -1
- package/src/lib/test-llm-config.d.ts +10 -0
- package/src/lib/test-llm-config.js +18 -0
- package/src/lib/test-llm-config.js.map +1 -0
- package/src/lib/tools/index.d.ts +1 -1
- package/src/lib/tools/index.js +1 -1
- package/src/lib/tools/index.js.map +1 -1
- package/src/lib/tools/retrieve-knowledge.d.ts +3 -6
- package/src/lib/tools/retrieve-knowledge.js +4 -4
- package/src/lib/tools/retrieve-knowledge.js.map +1 -1
- package/src/lib/types.d.ts +15 -9
- package/src/lib/agent-builder.d.ts +0 -30
- package/src/lib/agent-builder.js +0 -111
- package/src/lib/agent-builder.js.map +0 -1
- package/src/lib/hubtype-api-client.d.ts +0 -22
- package/src/lib/hubtype-api-client.js.map +0 -1
- package/src/lib/openai.d.ts +0 -1
- package/src/lib/openai.js +0 -21
- package/src/lib/openai.js.map +0 -1
- package/src/lib/runner.d.ts +0 -13
- package/src/lib/runner.js +0 -96
- package/src/lib/runner.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/carousel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/carousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;aACtC,CAAC;SACH,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAC,CAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ExitMessage } from '@botonic/shared';
|
|
1
|
+
import { ExitMessage, OutputAiAgentMessageType } from '@botonic/shared';
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
export type { ExitMessage };
|
|
4
4
|
export declare const ExitSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
type: "exit";
|
|
10
|
-
}>;
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
exit: OutputAiAgentMessageType.Exit;
|
|
7
|
+
}>;
|
|
8
|
+
}, z.core.$strip>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { OutputAiAgentMessageType } from '@botonic/shared';
|
|
1
2
|
import z from 'zod';
|
|
2
3
|
export const ExitSchema = z
|
|
3
4
|
.object({
|
|
4
|
-
type: z.enum([
|
|
5
|
+
type: z.enum([OutputAiAgentMessageType.Exit]),
|
|
5
6
|
})
|
|
6
7
|
.describe('An exit message. This message should only be used to exit the agent due to out of context or the user asking to exit the conversation');
|
|
7
8
|
//# sourceMappingURL=exit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/exit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/exit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FlowBuilderContentMessage, OutputAiAgentMessageType } from '@botonic/shared';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
export type { FlowBuilderContentMessage };
|
|
4
|
+
export declare const FlowBuilderContentSchema: z.ZodObject<{
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
flowBuilderContent: OutputAiAgentMessageType.FlowBuilderContent;
|
|
7
|
+
}>;
|
|
8
|
+
contentId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OutputAiAgentMessageType, } from '@botonic/shared';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
export const FlowBuilderContentSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
type: z.enum([OutputAiAgentMessageType.FlowBuilderContent]),
|
|
6
|
+
contentId: z.string(),
|
|
7
|
+
})
|
|
8
|
+
.describe('A Flow Builder content ID. Use it only when asked explicitly in the prompt');
|
|
9
|
+
//# sourceMappingURL=flow-builder-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-builder-content.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/flow-builder-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,QAAQ,CACP,4EAA4E,CAC7E,CAAA"}
|
|
@@ -4,72 +4,32 @@ export interface Output {
|
|
|
4
4
|
messages: OutputMessage[];
|
|
5
5
|
}
|
|
6
6
|
export declare const OutputSchema: z.ZodObject<{
|
|
7
|
-
messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
8
|
-
type: z.ZodEnum<
|
|
7
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
+
type: z.ZodEnum<{
|
|
9
|
+
text: import("@botonic/shared").OutputAiAgentMessageType.Text;
|
|
10
|
+
}>;
|
|
9
11
|
content: z.ZodObject<{
|
|
10
12
|
text: z.ZodString;
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
textWithButtons: import("@botonic/shared").OutputAiAgentMessageType.TextWithButtons;
|
|
15
17
|
}>;
|
|
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"]>;
|
|
28
18
|
content: z.ZodObject<{
|
|
29
19
|
text: z.ZodString;
|
|
30
20
|
buttons: z.ZodArray<z.ZodObject<{
|
|
31
21
|
text: z.ZodString;
|
|
32
22
|
url: z.ZodOptional<z.ZodString>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
buttons: {
|
|
43
|
-
text: string;
|
|
44
|
-
url?: string | undefined;
|
|
45
|
-
}[];
|
|
46
|
-
}, {
|
|
47
|
-
text: string;
|
|
48
|
-
buttons: {
|
|
49
|
-
text: string;
|
|
50
|
-
url?: string | undefined;
|
|
51
|
-
}[];
|
|
23
|
+
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
_blank: "_blank";
|
|
25
|
+
_self: "_self";
|
|
26
|
+
}>>>>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
type: z.ZodEnum<{
|
|
31
|
+
carousel: import("@botonic/shared").OutputAiAgentMessageType.Carousel;
|
|
52
32
|
}>;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
type: "textWithButtons";
|
|
55
|
-
content: {
|
|
56
|
-
text: string;
|
|
57
|
-
buttons: {
|
|
58
|
-
text: string;
|
|
59
|
-
url?: string | undefined;
|
|
60
|
-
}[];
|
|
61
|
-
};
|
|
62
|
-
}, {
|
|
63
|
-
type: "textWithButtons";
|
|
64
|
-
content: {
|
|
65
|
-
text: string;
|
|
66
|
-
buttons: {
|
|
67
|
-
text: string;
|
|
68
|
-
url?: string | undefined;
|
|
69
|
-
}[];
|
|
70
|
-
};
|
|
71
|
-
}>, z.ZodObject<{
|
|
72
|
-
type: z.ZodEnum<["carousel"]>;
|
|
73
33
|
content: z.ZodObject<{
|
|
74
34
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
35
|
elements: z.ZodArray<z.ZodObject<{
|
|
@@ -79,150 +39,90 @@ export declare const OutputSchema: z.ZodObject<{
|
|
|
79
39
|
button: z.ZodObject<{
|
|
80
40
|
text: z.ZodString;
|
|
81
41
|
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodEnum<{
|
|
47
|
+
exit: import("@botonic/shared").OutputAiAgentMessageType.Exit;
|
|
48
|
+
}>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
type: z.ZodEnum<{
|
|
51
|
+
botExecutor: import("@botonic/shared").OutputAiAgentMessageType.BotExecutor;
|
|
52
|
+
}>;
|
|
53
|
+
content: z.ZodObject<{
|
|
54
|
+
text: z.ZodString;
|
|
55
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
56
|
+
text: z.ZodString;
|
|
57
|
+
payload: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodEnum<{
|
|
62
|
+
flowBuilderContent: import("@botonic/shared").OutputAiAgentMessageType.FlowBuilderContent;
|
|
63
|
+
}>;
|
|
64
|
+
contentId: z.ZodString;
|
|
65
|
+
}, z.core.$strip>]>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export declare function getOutputSchema(): z.ZodObject<{
|
|
68
|
+
messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
69
|
+
type: z.ZodEnum<{
|
|
70
|
+
text: import("@botonic/shared").OutputAiAgentMessageType.Text;
|
|
71
|
+
}>;
|
|
72
|
+
content: z.ZodObject<{
|
|
73
|
+
text: z.ZodString;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
type: z.ZodEnum<{
|
|
77
|
+
textWithButtons: import("@botonic/shared").OutputAiAgentMessageType.TextWithButtons;
|
|
78
|
+
}>;
|
|
79
|
+
content: z.ZodObject<{
|
|
80
|
+
text: z.ZodString;
|
|
81
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
82
|
+
text: z.ZodString;
|
|
83
|
+
url: z.ZodOptional<z.ZodString>;
|
|
84
|
+
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
85
|
+
_blank: "_blank";
|
|
86
|
+
_self: "_self";
|
|
87
|
+
}>>>>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
type: z.ZodEnum<{
|
|
92
|
+
carousel: import("@botonic/shared").OutputAiAgentMessageType.Carousel;
|
|
93
|
+
}>;
|
|
94
|
+
content: z.ZodObject<{
|
|
95
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
elements: z.ZodArray<z.ZodObject<{
|
|
97
|
+
title: z.ZodString;
|
|
98
|
+
subtitle: z.ZodString;
|
|
99
|
+
image: z.ZodString;
|
|
100
|
+
button: z.ZodObject<{
|
|
101
|
+
text: z.ZodString;
|
|
102
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
type: z.ZodEnum<{
|
|
108
|
+
exit: import("@botonic/shared").OutputAiAgentMessageType.Exit;
|
|
109
|
+
}>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
type: z.ZodEnum<{
|
|
112
|
+
botExecutor: import("@botonic/shared").OutputAiAgentMessageType.BotExecutor;
|
|
113
|
+
}>;
|
|
114
|
+
content: z.ZodObject<{
|
|
115
|
+
text: z.ZodString;
|
|
116
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
117
|
+
text: z.ZodString;
|
|
118
|
+
payload: z.ZodString;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
type: z.ZodEnum<{
|
|
123
|
+
flowBuilderContent: import("@botonic/shared").OutputAiAgentMessageType.FlowBuilderContent;
|
|
128
124
|
}>;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
title: string;
|
|
134
|
-
subtitle: string;
|
|
135
|
-
image: string;
|
|
136
|
-
button: {
|
|
137
|
-
text: string;
|
|
138
|
-
url?: string | null | undefined;
|
|
139
|
-
};
|
|
140
|
-
}[];
|
|
141
|
-
text?: string | null | undefined;
|
|
142
|
-
};
|
|
143
|
-
}, {
|
|
144
|
-
type: "carousel";
|
|
145
|
-
content: {
|
|
146
|
-
elements: {
|
|
147
|
-
title: string;
|
|
148
|
-
subtitle: string;
|
|
149
|
-
image: string;
|
|
150
|
-
button: {
|
|
151
|
-
text: string;
|
|
152
|
-
url?: string | null | undefined;
|
|
153
|
-
};
|
|
154
|
-
}[];
|
|
155
|
-
text?: string | null | undefined;
|
|
156
|
-
};
|
|
157
|
-
}>, z.ZodObject<{
|
|
158
|
-
type: z.ZodEnum<["exit"]>;
|
|
159
|
-
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
type: "exit";
|
|
161
|
-
}, {
|
|
162
|
-
type: "exit";
|
|
163
|
-
}>]>, "many">;
|
|
164
|
-
}, "strip", z.ZodTypeAny, {
|
|
165
|
-
messages: ({
|
|
166
|
-
type: "carousel";
|
|
167
|
-
content: {
|
|
168
|
-
elements: {
|
|
169
|
-
title: string;
|
|
170
|
-
subtitle: string;
|
|
171
|
-
image: string;
|
|
172
|
-
button: {
|
|
173
|
-
text: string;
|
|
174
|
-
url?: string | null | undefined;
|
|
175
|
-
};
|
|
176
|
-
}[];
|
|
177
|
-
text?: string | null | undefined;
|
|
178
|
-
};
|
|
179
|
-
} | {
|
|
180
|
-
type: "exit";
|
|
181
|
-
} | {
|
|
182
|
-
type: "text";
|
|
183
|
-
content: {
|
|
184
|
-
text: string;
|
|
185
|
-
};
|
|
186
|
-
} | {
|
|
187
|
-
type: "textWithButtons";
|
|
188
|
-
content: {
|
|
189
|
-
text: string;
|
|
190
|
-
buttons: {
|
|
191
|
-
text: string;
|
|
192
|
-
url?: string | undefined;
|
|
193
|
-
}[];
|
|
194
|
-
};
|
|
195
|
-
})[];
|
|
196
|
-
}, {
|
|
197
|
-
messages: ({
|
|
198
|
-
type: "carousel";
|
|
199
|
-
content: {
|
|
200
|
-
elements: {
|
|
201
|
-
title: string;
|
|
202
|
-
subtitle: string;
|
|
203
|
-
image: string;
|
|
204
|
-
button: {
|
|
205
|
-
text: string;
|
|
206
|
-
url?: string | null | undefined;
|
|
207
|
-
};
|
|
208
|
-
}[];
|
|
209
|
-
text?: string | null | undefined;
|
|
210
|
-
};
|
|
211
|
-
} | {
|
|
212
|
-
type: "exit";
|
|
213
|
-
} | {
|
|
214
|
-
type: "text";
|
|
215
|
-
content: {
|
|
216
|
-
text: string;
|
|
217
|
-
};
|
|
218
|
-
} | {
|
|
219
|
-
type: "textWithButtons";
|
|
220
|
-
content: {
|
|
221
|
-
text: string;
|
|
222
|
-
buttons: {
|
|
223
|
-
text: string;
|
|
224
|
-
url?: string | undefined;
|
|
225
|
-
}[];
|
|
226
|
-
};
|
|
227
|
-
})[];
|
|
228
|
-
}>;
|
|
125
|
+
contentId: z.ZodString;
|
|
126
|
+
}, z.core.$strip>]>>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export declare function getOutputInstructions(): string;
|
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { BotExecutorSchema } from './bot-executor';
|
|
2
3
|
import { CarouselSchema } from './carousel';
|
|
3
4
|
import { ExitSchema } from './exit';
|
|
5
|
+
import { FlowBuilderContentSchema } from './flow-builder-content';
|
|
4
6
|
import { TextSchema } from './text';
|
|
5
7
|
import { TextWithButtonsSchema } from './text-with-buttons';
|
|
8
|
+
const baseMessageSchemas = [
|
|
9
|
+
TextSchema,
|
|
10
|
+
TextWithButtonsSchema,
|
|
11
|
+
CarouselSchema,
|
|
12
|
+
ExitSchema,
|
|
13
|
+
BotExecutorSchema,
|
|
14
|
+
FlowBuilderContentSchema,
|
|
15
|
+
];
|
|
6
16
|
export const OutputSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
messages: z.array(z.union([TextSchema, TextWithButtonsSchema, CarouselSchema, ExitSchema])),
|
|
9
|
-
})
|
|
17
|
+
.object({ messages: z.array(z.union(baseMessageSchemas)) })
|
|
10
18
|
.describe('The messages to be sent to the user');
|
|
19
|
+
export function getOutputSchema() {
|
|
20
|
+
return z.object({
|
|
21
|
+
messages: z.array(z.union([...baseMessageSchemas])),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function getOutputInstructions() {
|
|
25
|
+
const example = {
|
|
26
|
+
messages: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
content: {
|
|
30
|
+
text: 'Hello, how can I help you today?',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
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>`;
|
|
36
|
+
return `<output>\n${output}\n</output>`;
|
|
37
|
+
}
|
|
11
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAM3D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAM3D,MAAM,kBAAkB,GAAG;IACzB,UAAU;IACV,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,iBAAiB;IACjB,wBAAwB;CAChB,CAAA;AAEV,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC;KAC1D,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAElD,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC;KACpD,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,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"}
|
|
@@ -1,49 +1,19 @@
|
|
|
1
|
-
import { TextWithButtonsMessage } from '@botonic/shared';
|
|
1
|
+
import { OutputAiAgentMessageType, TextWithButtonsMessage } from '@botonic/shared';
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
export type { TextWithButtonsMessage };
|
|
4
4
|
export declare const TextWithButtonsSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
textWithButtons: OutputAiAgentMessageType.TextWithButtons;
|
|
7
|
+
}>;
|
|
6
8
|
content: z.ZodObject<{
|
|
7
9
|
text: z.ZodString;
|
|
8
10
|
buttons: z.ZodArray<z.ZodObject<{
|
|
9
11
|
text: z.ZodString;
|
|
10
12
|
url: z.ZodOptional<z.ZodString>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
text: string;
|
|
20
|
-
buttons: {
|
|
21
|
-
text: string;
|
|
22
|
-
url?: string | undefined;
|
|
23
|
-
}[];
|
|
24
|
-
}, {
|
|
25
|
-
text: string;
|
|
26
|
-
buttons: {
|
|
27
|
-
text: string;
|
|
28
|
-
url?: string | undefined;
|
|
29
|
-
}[];
|
|
30
|
-
}>;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
type: "textWithButtons";
|
|
33
|
-
content: {
|
|
34
|
-
text: string;
|
|
35
|
-
buttons: {
|
|
36
|
-
text: string;
|
|
37
|
-
url?: string | undefined;
|
|
38
|
-
}[];
|
|
39
|
-
};
|
|
40
|
-
}, {
|
|
41
|
-
type: "textWithButtons";
|
|
42
|
-
content: {
|
|
43
|
-
text: string;
|
|
44
|
-
buttons: {
|
|
45
|
-
text: string;
|
|
46
|
-
url?: string | undefined;
|
|
47
|
-
}[];
|
|
48
|
-
};
|
|
49
|
-
}>;
|
|
13
|
+
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<{
|
|
14
|
+
_blank: "_blank";
|
|
15
|
+
_self: "_self";
|
|
16
|
+
}>>>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
}, z.core.$strip>;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { OutputAiAgentMessageType, } from '@botonic/shared';
|
|
1
2
|
import z from 'zod';
|
|
2
3
|
export const TextWithButtonsSchema = z
|
|
3
4
|
.object({
|
|
4
|
-
type: z.enum([
|
|
5
|
+
type: z.enum([OutputAiAgentMessageType.TextWithButtons]),
|
|
5
6
|
content: z.object({
|
|
6
7
|
text: z.string(),
|
|
7
8
|
buttons: z.array(z.object({
|
|
8
9
|
text: z.string(),
|
|
9
10
|
url: z.string().optional(),
|
|
11
|
+
target: z
|
|
12
|
+
.enum(['_blank', '_self'])
|
|
13
|
+
.default('_blank')
|
|
14
|
+
.nullable()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('The target of the button when it has an url. If not provided, it will default to _blank.'),
|
|
10
17
|
})),
|
|
11
18
|
}),
|
|
12
19
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/text-with-buttons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/text-with-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAEzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC1B,MAAM,EAAE,CAAC;iBACN,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;iBACzB,OAAO,CAAC,QAAQ,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CACP,0FAA0F,CAC3F;SACJ,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import { TextMessage } from '@botonic/shared';
|
|
1
|
+
import { OutputAiAgentMessageType, TextMessage } from '@botonic/shared';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export type { TextMessage };
|
|
4
4
|
export declare const TextSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
text: OutputAiAgentMessageType.Text;
|
|
7
|
+
}>;
|
|
6
8
|
content: z.ZodObject<{
|
|
7
9
|
text: z.ZodString;
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
}, {
|
|
11
|
-
text: string;
|
|
12
|
-
}>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
type: "text";
|
|
15
|
-
content: {
|
|
16
|
-
text: string;
|
|
17
|
-
};
|
|
18
|
-
}, {
|
|
19
|
-
type: "text";
|
|
20
|
-
content: {
|
|
21
|
-
text: string;
|
|
22
|
-
};
|
|
23
|
-
}>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/structured-output/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAe,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Model, ModelProvider, ModelSettings } from '@openai/agents';
|
|
2
|
+
import type { LLMConfig } from './llm-config';
|
|
3
|
+
export declare function createMockLlmConfig(overrides?: {
|
|
4
|
+
modelName?: string;
|
|
5
|
+
model?: Model;
|
|
6
|
+
modelSettings?: ModelSettings;
|
|
7
|
+
modelProvider?: ModelProvider;
|
|
8
|
+
apiVersion?: string;
|
|
9
|
+
providerName?: 'openai' | 'azure' | 'litellm';
|
|
10
|
+
}): LLMConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
export function createMockLlmConfig(overrides = {}) {
|
|
3
|
+
var _a, _b, _c, _d;
|
|
4
|
+
const modelName = (_a = overrides.modelName) !== null && _a !== void 0 ? _a : 'gpt-4.1-mini';
|
|
5
|
+
const resolvedModel = (_b = overrides.model) !== null && _b !== void 0 ? _b : modelName;
|
|
6
|
+
return {
|
|
7
|
+
modelName,
|
|
8
|
+
modelSettings: (_c = overrides.modelSettings) !== null && _c !== void 0 ? _c : {
|
|
9
|
+
temperature: 0,
|
|
10
|
+
text: { verbosity: 'medium' },
|
|
11
|
+
},
|
|
12
|
+
modelProvider: (_d = overrides.modelProvider) !== null && _d !== void 0 ? _d : {},
|
|
13
|
+
getApiVersion: () => { var _a; return (_a = overrides.apiVersion) !== null && _a !== void 0 ? _a : 'NOT_API_VERSION_FOR_OPENAI_PROVIDER'; },
|
|
14
|
+
getProviderName: () => { var _a; return (_a = overrides.providerName) !== null && _a !== void 0 ? _a : 'azure'; },
|
|
15
|
+
getModel: () => __awaiter(this, void 0, void 0, function* () { return resolvedModel; }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=test-llm-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-llm-config.js","sourceRoot":"","sources":["../../../../../../libs/botonic/plugin-ai-agents/src/lib/test-llm-config.ts"],"names":[],"mappings":";AAIA,MAAM,UAAU,mBAAmB,CACjC,YAOI,EAAE;;IAEN,MAAM,SAAS,GAAG,MAAA,SAAS,CAAC,SAAS,mCAAI,cAAc,CAAA;IACvD,MAAM,aAAa,GAAG,MAAA,SAAS,CAAC,KAAK,mCAAK,SAA8B,CAAA;IAExE,OAAO;QACL,SAAS;QACT,aAAa,EAAE,MAAA,SAAS,CAAC,aAAa,mCAAI;YACxC,WAAW,EAAE,CAAC;YACd,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC9B;QACD,aAAa,EAAE,MAAA,SAAS,CAAC,aAAa,mCAAK,EAAoB;QAC/D,aAAa,EAAE,GAAG,EAAE,WAClB,OAAA,MAAA,SAAS,CAAC,UAAU,mCAAI,qCAAqC,CAAA,EAAA;QAC/D,eAAe,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,SAAS,CAAC,YAAY,mCAAI,OAAO,CAAA,EAAA;QACxD,QAAQ,EAAE,GAAS,EAAE,gDAAC,OAAA,aAAa,CAAA,GAAA;KACvB,CAAA;AAChB,CAAC"}
|
package/src/lib/tools/index.d.ts
CHANGED
package/src/lib/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAE7B,MAAM,CAAC,MAAM,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { AiAgentContext } from '../types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const RETRIEVE_KNOWLEDGE_TOOL_NAME = "retrieve_knowledge";
|
|
4
|
+
export declare const createRetrieveKnowledge: (sourceIds: string[]) => import("@openai/agents").FunctionTool<AiAgentContext<import("dist/libs/botonic/core/src").ResolvedPlugins, import("dist/libs/botonic/shared/src").UserExtraData>, z.ZodObject<{
|
|
4
5
|
query: z.ZodString;
|
|
5
|
-
},
|
|
6
|
-
query: string;
|
|
7
|
-
}, {
|
|
8
|
-
query: string;
|
|
9
|
-
}>, string>;
|
|
6
|
+
}, z.core.$strip>, string>;
|