@botonic/plugin-ai-agents 0.46.0 → 2.23.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 +209 -0
- package/package.json +23 -41
- package/src/index.d.ts +2 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -0
- package/{lib/cjs → src/lib}/agent-builder.d.ts +5 -10
- package/{lib/cjs → src/lib}/agent-builder.js +31 -25
- package/src/lib/agent-builder.js.map +1 -0
- package/{lib/cjs → src/lib}/constants.d.ts +1 -3
- package/src/lib/constants.js +13 -0
- package/src/lib/constants.js.map +1 -0
- package/{lib/esm → src/lib}/debug-logger.d.ts +3 -5
- package/{lib/esm → src/lib}/debug-logger.js +44 -29
- package/src/lib/debug-logger.js.map +1 -0
- package/src/lib/guardrails/index.js +2 -0
- package/src/lib/guardrails/index.js.map +1 -0
- package/src/lib/guardrails/input.d.ts +3 -0
- package/src/lib/guardrails/input.js +29 -0
- package/src/lib/guardrails/input.js.map +1 -0
- package/{lib/cjs/services → src/lib}/hubtype-api-client.d.ts +13 -5
- package/src/lib/hubtype-api-client.js +206 -0
- package/src/lib/hubtype-api-client.js.map +1 -0
- package/{lib/cjs → src/lib}/index.d.ts +2 -7
- package/src/lib/index.js +111 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/openai.d.ts +1 -0
- package/src/lib/openai.js +21 -0
- package/src/lib/openai.js.map +1 -0
- package/src/lib/runner.d.ts +12 -0
- package/src/lib/runner.js +96 -0
- package/src/lib/runner.js.map +1 -0
- package/{lib/esm → src/lib}/structured-output/carousel.d.ts +1 -1
- package/src/lib/structured-output/carousel.js +19 -0
- package/src/lib/structured-output/carousel.js.map +1 -0
- package/{lib/cjs → src/lib}/structured-output/exit.d.ts +1 -1
- package/src/lib/structured-output/exit.js +7 -0
- package/src/lib/structured-output/exit.js.map +1 -0
- package/{lib/cjs → src/lib}/structured-output/index.d.ts +10 -73
- package/src/lib/structured-output/index.js +11 -0
- package/src/lib/structured-output/index.js.map +1 -0
- package/{lib/esm → src/lib}/structured-output/text-with-buttons.d.ts +8 -8
- package/src/lib/structured-output/text-with-buttons.js +14 -0
- package/src/lib/structured-output/text-with-buttons.js.map +1 -0
- package/{lib/esm → src/lib}/structured-output/text.d.ts +1 -1
- package/src/lib/structured-output/text.js +10 -0
- package/src/lib/structured-output/text.js.map +1 -0
- package/{lib/esm → src/lib}/tools/index.d.ts +1 -1
- package/src/lib/tools/index.js +3 -0
- package/src/lib/tools/index.js.map +1 -0
- package/{lib/cjs → src/lib}/tools/retrieve-knowledge.d.ts +2 -2
- package/src/lib/tools/retrieve-knowledge.js +30 -0
- package/src/lib/tools/retrieve-knowledge.js.map +1 -0
- package/{lib/esm → src/lib}/types.d.ts +11 -21
- package/src/lib/types.js +2 -0
- package/src/lib/types.js.map +1 -0
- package/README.md +0 -156
- package/lib/cjs/agent-builder.js.map +0 -1
- package/lib/cjs/bot-config-tools.d.ts +0 -7
- package/lib/cjs/bot-config-tools.js +0 -19
- package/lib/cjs/bot-config-tools.js.map +0 -1
- package/lib/cjs/constants.js +0 -17
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/debug-logger.d.ts +0 -33
- package/lib/cjs/debug-logger.js +0 -97
- package/lib/cjs/debug-logger.js.map +0 -1
- package/lib/cjs/guardrails/index.js +0 -5
- package/lib/cjs/guardrails/index.js.map +0 -1
- package/lib/cjs/guardrails/input.d.ts +0 -10
- package/lib/cjs/guardrails/input.js +0 -77
- package/lib/cjs/guardrails/input.js.map +0 -1
- package/lib/cjs/index.js +0 -133
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/llm-config.d.ts +0 -15
- package/lib/cjs/llm-config.js +0 -66
- package/lib/cjs/llm-config.js.map +0 -1
- package/lib/cjs/runner.d.ts +0 -18
- package/lib/cjs/runner.js +0 -181
- package/lib/cjs/runner.js.map +0 -1
- package/lib/cjs/services/hubtype-api-client.js +0 -206
- package/lib/cjs/services/hubtype-api-client.js.map +0 -1
- package/lib/cjs/services/types.d.ts +0 -85
- package/lib/cjs/services/types.js +0 -13
- package/lib/cjs/services/types.js.map +0 -1
- package/lib/cjs/structured-output/bot-executor.d.ts +0 -49
- package/lib/cjs/structured-output/bot-executor.js +0 -18
- package/lib/cjs/structured-output/bot-executor.js.map +0 -1
- package/lib/cjs/structured-output/carousel.d.ts +0 -90
- package/lib/cjs/structured-output/carousel.js +0 -22
- package/lib/cjs/structured-output/carousel.js.map +0 -1
- package/lib/cjs/structured-output/exit.js +0 -11
- package/lib/cjs/structured-output/exit.js.map +0 -1
- package/lib/cjs/structured-output/index.js +0 -21
- package/lib/cjs/structured-output/index.js.map +0 -1
- package/lib/cjs/structured-output/text-with-buttons.d.ts +0 -49
- package/lib/cjs/structured-output/text-with-buttons.js +0 -18
- package/lib/cjs/structured-output/text-with-buttons.js.map +0 -1
- package/lib/cjs/structured-output/text.d.ts +0 -23
- package/lib/cjs/structured-output/text.js +0 -13
- package/lib/cjs/structured-output/text.js.map +0 -1
- package/lib/cjs/tools/index.d.ts +0 -3
- package/lib/cjs/tools/index.js +0 -7
- package/lib/cjs/tools/index.js.map +0 -1
- package/lib/cjs/tools/retrieve-knowledge.js +0 -32
- package/lib/cjs/tools/retrieve-knowledge.js.map +0 -1
- package/lib/cjs/types.d.ts +0 -56
- package/lib/cjs/types.js +0 -3
- package/lib/cjs/types.js.map +0 -1
- package/lib/esm/agent-builder.d.ts +0 -34
- package/lib/esm/agent-builder.js +0 -105
- package/lib/esm/agent-builder.js.map +0 -1
- package/lib/esm/bot-config-tools.d.ts +0 -7
- package/lib/esm/bot-config-tools.js +0 -19
- package/lib/esm/bot-config-tools.js.map +0 -1
- package/lib/esm/constants.d.ts +0 -11
- package/lib/esm/constants.js +0 -17
- package/lib/esm/constants.js.map +0 -1
- package/lib/esm/debug-logger.js.map +0 -1
- package/lib/esm/guardrails/index.d.ts +0 -1
- package/lib/esm/guardrails/index.js +0 -5
- package/lib/esm/guardrails/index.js.map +0 -1
- package/lib/esm/guardrails/input.d.ts +0 -10
- package/lib/esm/guardrails/input.js +0 -77
- package/lib/esm/guardrails/input.js.map +0 -1
- package/lib/esm/index.d.ts +0 -18
- package/lib/esm/index.js +0 -133
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/llm-config.d.ts +0 -15
- package/lib/esm/llm-config.js +0 -66
- package/lib/esm/llm-config.js.map +0 -1
- package/lib/esm/runner.d.ts +0 -18
- package/lib/esm/runner.js +0 -181
- package/lib/esm/runner.js.map +0 -1
- package/lib/esm/services/hubtype-api-client.d.ts +0 -14
- package/lib/esm/services/hubtype-api-client.js +0 -206
- package/lib/esm/services/hubtype-api-client.js.map +0 -1
- package/lib/esm/services/types.d.ts +0 -85
- package/lib/esm/services/types.js +0 -13
- package/lib/esm/services/types.js.map +0 -1
- package/lib/esm/structured-output/bot-executor.d.ts +0 -49
- package/lib/esm/structured-output/bot-executor.js +0 -18
- package/lib/esm/structured-output/bot-executor.js.map +0 -1
- package/lib/esm/structured-output/carousel.js +0 -22
- package/lib/esm/structured-output/carousel.js.map +0 -1
- package/lib/esm/structured-output/exit.d.ts +0 -10
- package/lib/esm/structured-output/exit.js +0 -11
- package/lib/esm/structured-output/exit.js.map +0 -1
- package/lib/esm/structured-output/index.d.ts +0 -291
- package/lib/esm/structured-output/index.js +0 -21
- package/lib/esm/structured-output/index.js.map +0 -1
- package/lib/esm/structured-output/text-with-buttons.js +0 -18
- package/lib/esm/structured-output/text-with-buttons.js.map +0 -1
- package/lib/esm/structured-output/text.js +0 -13
- package/lib/esm/structured-output/text.js.map +0 -1
- package/lib/esm/tools/index.js +0 -7
- package/lib/esm/tools/index.js.map +0 -1
- package/lib/esm/tools/retrieve-knowledge.d.ts +0 -9
- package/lib/esm/tools/retrieve-knowledge.js +0 -32
- package/lib/esm/tools/retrieve-knowledge.js.map +0 -1
- package/lib/esm/types.js +0 -3
- package/lib/esm/types.js.map +0 -1
- package/src/agent-builder.ts +0 -179
- package/src/bot-config-tools.ts +0 -21
- package/src/constants.ts +0 -21
- package/src/debug-logger.ts +0 -166
- package/src/guardrails/index.ts +0 -1
- package/src/guardrails/input.ts +0 -122
- package/src/index.ts +0 -209
- package/src/llm-config.ts +0 -96
- package/src/runner.ts +0 -287
- package/src/services/hubtype-api-client.ts +0 -240
- package/src/services/types.ts +0 -106
- package/src/structured-output/bot-executor.ts +0 -21
- package/src/structured-output/carousel.ts +0 -24
- package/src/structured-output/exit.ts +0 -12
- package/src/structured-output/index.ts +0 -25
- package/src/structured-output/text-with-buttons.ts +0 -21
- package/src/structured-output/text.ts +0 -13
- package/src/tools/index.ts +0 -5
- package/src/tools/retrieve-knowledge.ts +0 -37
- package/src/types.ts +0 -110
- /package/{lib/cjs → src/lib}/guardrails/index.d.ts +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { BotExecutorMessage } from '@botonic/core';
|
|
2
|
-
import z from 'zod';
|
|
3
|
-
export type { BotExecutorMessage };
|
|
4
|
-
export declare const BotExecutorSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<["botExecutor"]>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
-
text: z.ZodString;
|
|
10
|
-
payload: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
text: string;
|
|
13
|
-
payload: string;
|
|
14
|
-
}, {
|
|
15
|
-
text: string;
|
|
16
|
-
payload: string;
|
|
17
|
-
}>, "many">;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
text: string;
|
|
20
|
-
buttons: {
|
|
21
|
-
text: string;
|
|
22
|
-
payload: string;
|
|
23
|
-
}[];
|
|
24
|
-
}, {
|
|
25
|
-
text: string;
|
|
26
|
-
buttons: {
|
|
27
|
-
text: string;
|
|
28
|
-
payload: string;
|
|
29
|
-
}[];
|
|
30
|
-
}>;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
type: "botExecutor";
|
|
33
|
-
content: {
|
|
34
|
-
text: string;
|
|
35
|
-
buttons: {
|
|
36
|
-
text: string;
|
|
37
|
-
payload: string;
|
|
38
|
-
}[];
|
|
39
|
-
};
|
|
40
|
-
}, {
|
|
41
|
-
type: "botExecutor";
|
|
42
|
-
content: {
|
|
43
|
-
text: string;
|
|
44
|
-
buttons: {
|
|
45
|
-
text: string;
|
|
46
|
-
payload: string;
|
|
47
|
-
}[];
|
|
48
|
-
};
|
|
49
|
-
}>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BotExecutorSchema = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
-
exports.BotExecutorSchema = zod_1.default
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.default.enum(['botExecutor']),
|
|
9
|
-
content: zod_1.default.object({
|
|
10
|
-
text: zod_1.default.string(),
|
|
11
|
-
buttons: zod_1.default.array(zod_1.default.object({
|
|
12
|
-
text: zod_1.default.string(),
|
|
13
|
-
payload: zod_1.default.string(),
|
|
14
|
-
})),
|
|
15
|
-
}),
|
|
16
|
-
})
|
|
17
|
-
.describe('A text message with buttons to allow the bot to execute a specific action. Use it only when asked explicitly in the prompt');
|
|
18
|
-
//# sourceMappingURL=bot-executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bot-executor.js","sourceRoot":"","sources":["../../../src/structured-output/bot-executor.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,iBAAiB,GAAG,aAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,KAAK,CACd,aAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,aAAC,CAAC,MAAM,EAAE;SACpB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,4HAA4H,CAC7H,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CarouselSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.CarouselSchema = zod_1.z
|
|
6
|
-
.object({
|
|
7
|
-
type: zod_1.z.enum(['carousel']),
|
|
8
|
-
content: zod_1.z.object({
|
|
9
|
-
text: zod_1.z.string().nullable().optional(),
|
|
10
|
-
elements: zod_1.z.array(zod_1.z.object({
|
|
11
|
-
title: zod_1.z.string(),
|
|
12
|
-
subtitle: zod_1.z.string(),
|
|
13
|
-
image: zod_1.z.string(),
|
|
14
|
-
button: zod_1.z.object({
|
|
15
|
-
text: zod_1.z.string(),
|
|
16
|
-
url: zod_1.z.string().nullable().optional(),
|
|
17
|
-
}),
|
|
18
|
-
})),
|
|
19
|
-
}),
|
|
20
|
-
})
|
|
21
|
-
.describe('A carousel message containing a list of elements');
|
|
22
|
-
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/structured-output/carousel.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AAIV,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;YACP,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;YACpB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,OAAC,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,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExitSchema = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
-
exports.ExitSchema = zod_1.default
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.default.enum(['exit']),
|
|
9
|
-
})
|
|
10
|
-
.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');
|
|
11
|
-
//# sourceMappingURL=exit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../../../src/structured-output/exit.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,UAAU,GAAG,aAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;KACD,QAAQ,CACP,uIAAuI,CACxI,CAAA"}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import type { OutputMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export interface Output {
|
|
4
|
-
messages: OutputMessage[];
|
|
5
|
-
}
|
|
6
|
-
export declare const OutputSchema: z.ZodObject<{
|
|
7
|
-
messages: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
8
|
-
type: z.ZodEnum<["text"]>;
|
|
9
|
-
content: z.ZodObject<{
|
|
10
|
-
text: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
text: string;
|
|
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"]>;
|
|
28
|
-
content: z.ZodObject<{
|
|
29
|
-
text: z.ZodString;
|
|
30
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
31
|
-
text: z.ZodString;
|
|
32
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
text: string;
|
|
35
|
-
url?: string | null | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
text: string;
|
|
38
|
-
url?: string | null | undefined;
|
|
39
|
-
}>, "many">;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
text: string;
|
|
42
|
-
buttons: {
|
|
43
|
-
text: string;
|
|
44
|
-
url?: string | null | undefined;
|
|
45
|
-
}[];
|
|
46
|
-
}, {
|
|
47
|
-
text: string;
|
|
48
|
-
buttons: {
|
|
49
|
-
text: string;
|
|
50
|
-
url?: string | null | undefined;
|
|
51
|
-
}[];
|
|
52
|
-
}>;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
type: "textWithButtons";
|
|
55
|
-
content: {
|
|
56
|
-
text: string;
|
|
57
|
-
buttons: {
|
|
58
|
-
text: string;
|
|
59
|
-
url?: string | null | undefined;
|
|
60
|
-
}[];
|
|
61
|
-
};
|
|
62
|
-
}, {
|
|
63
|
-
type: "textWithButtons";
|
|
64
|
-
content: {
|
|
65
|
-
text: string;
|
|
66
|
-
buttons: {
|
|
67
|
-
text: string;
|
|
68
|
-
url?: string | null | undefined;
|
|
69
|
-
}[];
|
|
70
|
-
};
|
|
71
|
-
}>, z.ZodObject<{
|
|
72
|
-
type: z.ZodEnum<["carousel"]>;
|
|
73
|
-
content: z.ZodObject<{
|
|
74
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
76
|
-
title: z.ZodString;
|
|
77
|
-
subtitle: z.ZodString;
|
|
78
|
-
image: z.ZodString;
|
|
79
|
-
button: z.ZodObject<{
|
|
80
|
-
text: z.ZodString;
|
|
81
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
-
}, "strip", z.ZodTypeAny, {
|
|
83
|
-
text: string;
|
|
84
|
-
url?: string | null | undefined;
|
|
85
|
-
}, {
|
|
86
|
-
text: string;
|
|
87
|
-
url?: string | null | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
}, "strip", z.ZodTypeAny, {
|
|
90
|
-
title: string;
|
|
91
|
-
subtitle: string;
|
|
92
|
-
image: string;
|
|
93
|
-
button: {
|
|
94
|
-
text: string;
|
|
95
|
-
url?: string | null | undefined;
|
|
96
|
-
};
|
|
97
|
-
}, {
|
|
98
|
-
title: string;
|
|
99
|
-
subtitle: string;
|
|
100
|
-
image: string;
|
|
101
|
-
button: {
|
|
102
|
-
text: string;
|
|
103
|
-
url?: string | null | undefined;
|
|
104
|
-
};
|
|
105
|
-
}>, "many">;
|
|
106
|
-
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
elements: {
|
|
108
|
-
title: string;
|
|
109
|
-
subtitle: string;
|
|
110
|
-
image: string;
|
|
111
|
-
button: {
|
|
112
|
-
text: string;
|
|
113
|
-
url?: string | null | undefined;
|
|
114
|
-
};
|
|
115
|
-
}[];
|
|
116
|
-
text?: string | null | undefined;
|
|
117
|
-
}, {
|
|
118
|
-
elements: {
|
|
119
|
-
title: string;
|
|
120
|
-
subtitle: string;
|
|
121
|
-
image: string;
|
|
122
|
-
button: {
|
|
123
|
-
text: string;
|
|
124
|
-
url?: string | null | undefined;
|
|
125
|
-
};
|
|
126
|
-
}[];
|
|
127
|
-
text?: string | null | undefined;
|
|
128
|
-
}>;
|
|
129
|
-
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
type: "carousel";
|
|
131
|
-
content: {
|
|
132
|
-
elements: {
|
|
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
|
-
}>, z.ZodObject<{
|
|
164
|
-
type: z.ZodEnum<["botExecutor"]>;
|
|
165
|
-
content: z.ZodObject<{
|
|
166
|
-
text: z.ZodString;
|
|
167
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
168
|
-
text: z.ZodString;
|
|
169
|
-
payload: z.ZodString;
|
|
170
|
-
}, "strip", z.ZodTypeAny, {
|
|
171
|
-
text: string;
|
|
172
|
-
payload: string;
|
|
173
|
-
}, {
|
|
174
|
-
text: string;
|
|
175
|
-
payload: string;
|
|
176
|
-
}>, "many">;
|
|
177
|
-
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
text: string;
|
|
179
|
-
buttons: {
|
|
180
|
-
text: string;
|
|
181
|
-
payload: string;
|
|
182
|
-
}[];
|
|
183
|
-
}, {
|
|
184
|
-
text: string;
|
|
185
|
-
buttons: {
|
|
186
|
-
text: string;
|
|
187
|
-
payload: string;
|
|
188
|
-
}[];
|
|
189
|
-
}>;
|
|
190
|
-
}, "strip", z.ZodTypeAny, {
|
|
191
|
-
type: "botExecutor";
|
|
192
|
-
content: {
|
|
193
|
-
text: string;
|
|
194
|
-
buttons: {
|
|
195
|
-
text: string;
|
|
196
|
-
payload: string;
|
|
197
|
-
}[];
|
|
198
|
-
};
|
|
199
|
-
}, {
|
|
200
|
-
type: "botExecutor";
|
|
201
|
-
content: {
|
|
202
|
-
text: string;
|
|
203
|
-
buttons: {
|
|
204
|
-
text: string;
|
|
205
|
-
payload: string;
|
|
206
|
-
}[];
|
|
207
|
-
};
|
|
208
|
-
}>]>, "many">;
|
|
209
|
-
}, "strip", z.ZodTypeAny, {
|
|
210
|
-
messages: ({
|
|
211
|
-
type: "botExecutor";
|
|
212
|
-
content: {
|
|
213
|
-
text: string;
|
|
214
|
-
buttons: {
|
|
215
|
-
text: string;
|
|
216
|
-
payload: string;
|
|
217
|
-
}[];
|
|
218
|
-
};
|
|
219
|
-
} | {
|
|
220
|
-
type: "carousel";
|
|
221
|
-
content: {
|
|
222
|
-
elements: {
|
|
223
|
-
title: string;
|
|
224
|
-
subtitle: string;
|
|
225
|
-
image: string;
|
|
226
|
-
button: {
|
|
227
|
-
text: string;
|
|
228
|
-
url?: string | null | undefined;
|
|
229
|
-
};
|
|
230
|
-
}[];
|
|
231
|
-
text?: string | null | undefined;
|
|
232
|
-
};
|
|
233
|
-
} | {
|
|
234
|
-
type: "exit";
|
|
235
|
-
} | {
|
|
236
|
-
type: "text";
|
|
237
|
-
content: {
|
|
238
|
-
text: string;
|
|
239
|
-
};
|
|
240
|
-
} | {
|
|
241
|
-
type: "textWithButtons";
|
|
242
|
-
content: {
|
|
243
|
-
text: string;
|
|
244
|
-
buttons: {
|
|
245
|
-
text: string;
|
|
246
|
-
url?: string | null | undefined;
|
|
247
|
-
}[];
|
|
248
|
-
};
|
|
249
|
-
})[];
|
|
250
|
-
}, {
|
|
251
|
-
messages: ({
|
|
252
|
-
type: "botExecutor";
|
|
253
|
-
content: {
|
|
254
|
-
text: string;
|
|
255
|
-
buttons: {
|
|
256
|
-
text: string;
|
|
257
|
-
payload: string;
|
|
258
|
-
}[];
|
|
259
|
-
};
|
|
260
|
-
} | {
|
|
261
|
-
type: "carousel";
|
|
262
|
-
content: {
|
|
263
|
-
elements: {
|
|
264
|
-
title: string;
|
|
265
|
-
subtitle: string;
|
|
266
|
-
image: string;
|
|
267
|
-
button: {
|
|
268
|
-
text: string;
|
|
269
|
-
url?: string | null | undefined;
|
|
270
|
-
};
|
|
271
|
-
}[];
|
|
272
|
-
text?: string | null | undefined;
|
|
273
|
-
};
|
|
274
|
-
} | {
|
|
275
|
-
type: "exit";
|
|
276
|
-
} | {
|
|
277
|
-
type: "text";
|
|
278
|
-
content: {
|
|
279
|
-
text: string;
|
|
280
|
-
};
|
|
281
|
-
} | {
|
|
282
|
-
type: "textWithButtons";
|
|
283
|
-
content: {
|
|
284
|
-
text: string;
|
|
285
|
-
buttons: {
|
|
286
|
-
text: string;
|
|
287
|
-
url?: string | null | undefined;
|
|
288
|
-
}[];
|
|
289
|
-
};
|
|
290
|
-
})[];
|
|
291
|
-
}>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OutputSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const bot_executor_1 = require("./bot-executor");
|
|
6
|
-
const carousel_1 = require("./carousel");
|
|
7
|
-
const exit_1 = require("./exit");
|
|
8
|
-
const text_1 = require("./text");
|
|
9
|
-
const text_with_buttons_1 = require("./text-with-buttons");
|
|
10
|
-
exports.OutputSchema = zod_1.z
|
|
11
|
-
.object({
|
|
12
|
-
messages: zod_1.z.array(zod_1.z.union([
|
|
13
|
-
text_1.TextSchema,
|
|
14
|
-
text_with_buttons_1.TextWithButtonsSchema,
|
|
15
|
-
carousel_1.CarouselSchema,
|
|
16
|
-
exit_1.ExitSchema,
|
|
17
|
-
bot_executor_1.BotExecutorSchema,
|
|
18
|
-
])),
|
|
19
|
-
})
|
|
20
|
-
.describe('The messages to be sent to the user');
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structured-output/index.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AACvB,iDAAkD;AAClD,yCAA2C;AAC3C,iCAAmC;AACnC,iCAAmC;AACnC,2DAA2D;AAM9C,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,KAAK,CAAC;QACN,iBAAU;QACV,yCAAqB;QACrB,yBAAc;QACd,iBAAU;QACV,gCAAiB;KAClB,CAAC,CACH;CACF,CAAC;KACD,QAAQ,CAAC,qCAAqC,CAAC,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextWithButtonsSchema = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
6
|
-
exports.TextWithButtonsSchema = zod_1.default
|
|
7
|
-
.object({
|
|
8
|
-
type: zod_1.default.enum(['textWithButtons']),
|
|
9
|
-
content: zod_1.default.object({
|
|
10
|
-
text: zod_1.default.string(),
|
|
11
|
-
buttons: zod_1.default.array(zod_1.default.object({
|
|
12
|
-
text: zod_1.default.string(),
|
|
13
|
-
url: zod_1.default.string().nullable().optional(),
|
|
14
|
-
})),
|
|
15
|
-
}),
|
|
16
|
-
})
|
|
17
|
-
.describe('A text message with buttons to allow the user to use quick replies');
|
|
18
|
-
//# sourceMappingURL=text-with-buttons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-with-buttons.js","sourceRoot":"","sources":["../../../src/structured-output/text-with-buttons.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAIN,QAAA,qBAAqB,GAAG,aAAC;KACnC,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACjC,OAAO,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,aAAC,CAAC,KAAK,CACd,aAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,aAAC,CAAC,MAAM,EAAE;YAChB,GAAG,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;SACtC,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.TextSchema = zod_1.z
|
|
6
|
-
.object({
|
|
7
|
-
type: zod_1.z.enum(['text']),
|
|
8
|
-
content: zod_1.z.object({
|
|
9
|
-
text: zod_1.z.string(),
|
|
10
|
-
}),
|
|
11
|
-
})
|
|
12
|
-
.describe('A text message');
|
|
13
|
-
//# sourceMappingURL=text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/structured-output/text.ts"],"names":[],"mappings":";;;AACA,6BAAuB;AAIV,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,gBAAgB,CAAC,CAAA"}
|
package/lib/esm/tools/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mandatoryTools = exports.retrieveKnowledge = void 0;
|
|
4
|
-
var retrieve_knowledge_1 = require("./retrieve-knowledge");
|
|
5
|
-
Object.defineProperty(exports, "retrieveKnowledge", { enumerable: true, get: function () { return retrieve_knowledge_1.retrieveKnowledge; } });
|
|
6
|
-
exports.mandatoryTools = [];
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA;AAEb,QAAA,cAAc,GAAW,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Context } from '../types';
|
|
3
|
-
export declare const retrieveKnowledge: import("@openai/agents").FunctionTool<Context<import("@botonic/core").ResolvedPlugins, any>, z.ZodObject<{
|
|
4
|
-
query: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
query: string;
|
|
7
|
-
}, {
|
|
8
|
-
query: string;
|
|
9
|
-
}>, string>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.retrieveKnowledge = void 0;
|
|
4
|
-
const agents_1 = require("@openai/agents");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const hubtype_api_client_1 = require("../services/hubtype-api-client");
|
|
7
|
-
exports.retrieveKnowledge = (0, agents_1.tool)({
|
|
8
|
-
name: 'retrieve_knowledge',
|
|
9
|
-
description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
|
|
10
|
-
parameters: zod_1.z.object({
|
|
11
|
-
query: zod_1.z.string().describe('The query to search the knowledge base for'),
|
|
12
|
-
}),
|
|
13
|
-
execute: async (input, runContext) => {
|
|
14
|
-
const context = runContext?.context;
|
|
15
|
-
const query = input.query;
|
|
16
|
-
if (!context) {
|
|
17
|
-
throw new Error('Context is required');
|
|
18
|
-
}
|
|
19
|
-
const sourceIds = context.sourceIds;
|
|
20
|
-
const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
|
|
21
|
-
const chunks = await client.retrieveSimilarChunks(query, sourceIds);
|
|
22
|
-
const chunkTexts = chunks.map(chunk => chunk.text);
|
|
23
|
-
context.knowledgeUsed = {
|
|
24
|
-
query,
|
|
25
|
-
sourceIds,
|
|
26
|
-
chunksIds: chunks.map(chunk => chunk.id),
|
|
27
|
-
chunkTexts,
|
|
28
|
-
};
|
|
29
|
-
return chunkTexts;
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=retrieve-knowledge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,6BAAuB;AAEvB,uEAAiE;AAGpD,QAAA,iBAAiB,GAAG,IAAA,aAAI,EAAC;IACpC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,kIAAkI;IACpI,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KACzE,CAAC;IACF,OAAO,EAAE,KAAK,EACZ,KAAwB,EACxB,UAAgC,EACb,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,OAAO,CAAA;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACxC,CAAC;QACD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QACnC,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QACnE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAElD,OAAO,CAAC,aAAa,GAAG;YACtB,KAAK;YACL,SAAS;YACT,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,UAAU;SACX,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF,CAAC,CAAA"}
|
package/lib/esm/types.js
DELETED
package/lib/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|