@botonic/plugin-ai-agents 0.46.1 → 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 -13
- package/{lib/cjs → src/lib}/agent-builder.js +31 -26
- 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/esm → 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/src/lib/structured-output/index.d.ts +228 -0
- package/src/lib/structured-output/index.js +11 -0
- package/src/lib/structured-output/index.js.map +1 -0
- package/{lib/esm/structured-output/bot-executor.d.ts → src/lib/structured-output/text-with-buttons.d.ts} +13 -13
- 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.d.ts +0 -18
- package/lib/cjs/index.js +0 -134
- 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.d.ts +0 -603
- package/lib/cjs/structured-output/index.js +0 -28
- package/lib/cjs/structured-output/index.js.map +0 -1
- package/lib/cjs/structured-output/text-with-buttons.d.ts +0 -56
- package/lib/cjs/structured-output/text-with-buttons.js +0 -24
- 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 -37
- package/lib/esm/agent-builder.js +0 -106
- 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.js +0 -134
- 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.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 -603
- package/lib/esm/structured-output/index.js +0 -28
- package/lib/esm/structured-output/index.js.map +0 -1
- package/lib/esm/structured-output/text-with-buttons.d.ts +0 -56
- package/lib/esm/structured-output/text-with-buttons.js +0 -24
- 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 -183
- 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 -210
- 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 -34
- package/src/structured-output/text-with-buttons.ts +0 -29
- 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,56 +0,0 @@
|
|
|
1
|
-
import type { TextWithButtonsMessage } from '@botonic/core';
|
|
2
|
-
import z from 'zod';
|
|
3
|
-
export type { TextWithButtonsMessage };
|
|
4
|
-
export declare const TextWithButtonsSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<["textWithButtons"]>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
buttons: z.ZodArray<z.ZodObject<{
|
|
9
|
-
text: z.ZodString;
|
|
10
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
-
target: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodEnum<["_blank", "_self"]>>>>;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
text: string;
|
|
14
|
-
url?: string | null | undefined;
|
|
15
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
text: string;
|
|
18
|
-
url?: string | null | undefined;
|
|
19
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
20
|
-
}>, "many">;
|
|
21
|
-
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
text: string;
|
|
23
|
-
buttons: {
|
|
24
|
-
text: string;
|
|
25
|
-
url?: string | null | undefined;
|
|
26
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
27
|
-
}[];
|
|
28
|
-
}, {
|
|
29
|
-
text: string;
|
|
30
|
-
buttons: {
|
|
31
|
-
text: string;
|
|
32
|
-
url?: string | null | undefined;
|
|
33
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
34
|
-
}[];
|
|
35
|
-
}>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
type: "textWithButtons";
|
|
38
|
-
content: {
|
|
39
|
-
text: string;
|
|
40
|
-
buttons: {
|
|
41
|
-
text: string;
|
|
42
|
-
url?: string | null | undefined;
|
|
43
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
44
|
-
}[];
|
|
45
|
-
};
|
|
46
|
-
}, {
|
|
47
|
-
type: "textWithButtons";
|
|
48
|
-
content: {
|
|
49
|
-
text: string;
|
|
50
|
-
buttons: {
|
|
51
|
-
text: string;
|
|
52
|
-
url?: string | null | undefined;
|
|
53
|
-
target?: "_blank" | "_self" | null | undefined;
|
|
54
|
-
}[];
|
|
55
|
-
};
|
|
56
|
-
}>;
|
|
@@ -1,24 +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
|
-
target: zod_1.default
|
|
15
|
-
.enum(['_blank', '_self'])
|
|
16
|
-
.default('_blank')
|
|
17
|
-
.nullable()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe('The target of the button when it has an url. If not provided, it will default to _blank.'),
|
|
20
|
-
})),
|
|
21
|
-
}),
|
|
22
|
-
})
|
|
23
|
-
.describe('A text message with buttons to allow the user to use quick replies');
|
|
24
|
-
//# 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;YACrC,MAAM,EAAE,aAAC;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 +0,0 @@
|
|
|
1
|
-
import type { TextMessage } from '@botonic/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export type { TextMessage };
|
|
4
|
-
export declare const TextSchema: z.ZodObject<{
|
|
5
|
-
type: z.ZodEnum<["text"]>;
|
|
6
|
-
content: z.ZodObject<{
|
|
7
|
-
text: z.ZodString;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
text: string;
|
|
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
|
-
}>;
|
|
@@ -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/cjs/tools/index.d.ts
DELETED
package/lib/cjs/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,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/cjs/types.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { AgenticOutputMessage, AiAgentArgs, type BotContext, GuardrailRule, InferenceResponse, type ResolvedPlugins, RunResult } from '@botonic/core';
|
|
2
|
-
import type { Agent, AgentInputItem, AgentOutputType, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
|
|
3
|
-
import type { ZodSchema } from 'zod';
|
|
4
|
-
import type { OutputSchema } from './structured-output';
|
|
5
|
-
export interface Context<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
6
|
-
authToken: string;
|
|
7
|
-
sourceIds: string[];
|
|
8
|
-
knowledgeUsed: {
|
|
9
|
-
query: string;
|
|
10
|
-
sourceIds: string[];
|
|
11
|
-
chunksIds: string[];
|
|
12
|
-
chunkTexts: string[];
|
|
13
|
-
};
|
|
14
|
-
request: BotContext<TPlugins, TExtraData>;
|
|
15
|
-
}
|
|
16
|
-
export type RunContext<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAIRunContext<Context<TPlugins, TExtraData>>;
|
|
17
|
-
export interface CustomTool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
schema: ZodSchema;
|
|
21
|
-
func: (input?: any, runContext?: RunContext<TPlugins, TExtraData>) => Promise<any>;
|
|
22
|
-
}
|
|
23
|
-
export interface Chunk {
|
|
24
|
-
id: string;
|
|
25
|
-
text: string;
|
|
26
|
-
}
|
|
27
|
-
export type Tool<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = OpenAITool<Context<TPlugins, TExtraData>>;
|
|
28
|
-
export type AIAgent<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = Agent<Context<TPlugins, TExtraData>, AgentOutputType<typeof OutputSchema>>;
|
|
29
|
-
export type MessageHistoryApiVersion = 'v1' | 'v2';
|
|
30
|
-
export interface MemoryOptions {
|
|
31
|
-
maxMessages?: number;
|
|
32
|
-
includeToolCalls?: boolean;
|
|
33
|
-
maxFullToolResults?: number;
|
|
34
|
-
debugMode?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export interface PluginAiAgentOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
37
|
-
authToken?: string;
|
|
38
|
-
customTools?: CustomTool<TPlugins, TExtraData>[];
|
|
39
|
-
maxRetries?: number;
|
|
40
|
-
timeout?: number;
|
|
41
|
-
/** API version for message history endpoint. Defaults to 'v2'. */
|
|
42
|
-
messageHistoryApiVersion?: MessageHistoryApiVersion;
|
|
43
|
-
/** Options for V2 message history API. Only used when messageHistoryApiVersion is 'v2'. */
|
|
44
|
-
memory?: MemoryOptions;
|
|
45
|
-
/** Enable debug logging for AI agent configuration and execution details. */
|
|
46
|
-
enableDebug?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface ResultRawResponse {
|
|
49
|
-
usage: {
|
|
50
|
-
inputTokens: number;
|
|
51
|
-
outputTokens: number;
|
|
52
|
-
};
|
|
53
|
-
providerData?: Record<string, unknown>;
|
|
54
|
-
}
|
|
55
|
-
export type AgenticInputMessage = AgentInputItem;
|
|
56
|
-
export { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
|
package/lib/cjs/types.js
DELETED
package/lib/cjs/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/core';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
|
-
import type { DebugLogger } from './debug-logger';
|
|
4
|
-
import type { GuardrailTrackingContext } from './guardrails/input';
|
|
5
|
-
import type { LLMConfig } from './llm-config';
|
|
6
|
-
import type { AIAgent, GuardrailRule, Tool } from './types';
|
|
7
|
-
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
8
|
-
name: string;
|
|
9
|
-
instructions: string;
|
|
10
|
-
tools: Tool<TPlugins, TExtraData>[];
|
|
11
|
-
campaignsContext?: CampaignV2[];
|
|
12
|
-
contactInfo: ContactInfo[];
|
|
13
|
-
inputGuardrailRules: GuardrailRule[];
|
|
14
|
-
sourceIds: string[];
|
|
15
|
-
outputMessagesSchemas?: z.ZodObject<any>[];
|
|
16
|
-
llmConfig: LLMConfig;
|
|
17
|
-
logger: DebugLogger;
|
|
18
|
-
guardrailTrackingContext: GuardrailTrackingContext;
|
|
19
|
-
}
|
|
20
|
-
export declare class AIAgentBuilder<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
21
|
-
private name;
|
|
22
|
-
private instructions;
|
|
23
|
-
private tools;
|
|
24
|
-
private externalOutputMessagesSchemas;
|
|
25
|
-
private inputGuardrails;
|
|
26
|
-
llmConfig: LLMConfig;
|
|
27
|
-
private logger;
|
|
28
|
-
constructor(options: AIAgentBuilderOptions<TPlugins, TExtraData>);
|
|
29
|
-
build(): AIAgent<TPlugins, TExtraData>;
|
|
30
|
-
private addExtraInstructions;
|
|
31
|
-
private getContactInfoInstructions;
|
|
32
|
-
private getMetadataInstructions;
|
|
33
|
-
private getCampaignInstructions;
|
|
34
|
-
private getOutputInstructions;
|
|
35
|
-
private addHubtypeTools;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
package/lib/esm/agent-builder.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AIAgentBuilder = void 0;
|
|
4
|
-
const agents_1 = require("@openai/agents");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const guardrails_1 = require("./guardrails");
|
|
7
|
-
const structured_output_1 = require("./structured-output");
|
|
8
|
-
const tools_1 = require("./tools");
|
|
9
|
-
class AIAgentBuilder {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.name = options.name;
|
|
12
|
-
this.instructions = this.addExtraInstructions(options.instructions, options.contactInfo, options.campaignsContext);
|
|
13
|
-
this.tools = this.addHubtypeTools(options.tools, options.sourceIds);
|
|
14
|
-
this.externalOutputMessagesSchemas = options.outputMessagesSchemas || [];
|
|
15
|
-
this.inputGuardrails = [];
|
|
16
|
-
this.llmConfig = options.llmConfig;
|
|
17
|
-
this.logger = options.logger;
|
|
18
|
-
if (options.inputGuardrailRules.length > 0) {
|
|
19
|
-
const inputGuardrail = (0, guardrails_1.createInputGuardrail)(options.inputGuardrailRules, options.llmConfig, options.guardrailTrackingContext);
|
|
20
|
-
this.inputGuardrails.push(inputGuardrail);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
build() {
|
|
24
|
-
// When using standard OpenAI API, we need to specify the model
|
|
25
|
-
// Azure OpenAI uses deployment name instead
|
|
26
|
-
const model = this.llmConfig.modelName;
|
|
27
|
-
const hasRetrieveKnowledge = this.tools.includes(tools_1.retrieveKnowledge);
|
|
28
|
-
this.logger.logModelSettings({
|
|
29
|
-
provider: constants_1.OPENAI_PROVIDER,
|
|
30
|
-
model,
|
|
31
|
-
reasoning: this.llmConfig.modelSettings.reasoning,
|
|
32
|
-
text: this.llmConfig.modelSettings.text,
|
|
33
|
-
toolChoice: this.llmConfig.modelSettings.toolChoice,
|
|
34
|
-
hasRetrieveKnowledge,
|
|
35
|
-
});
|
|
36
|
-
return new agents_1.Agent({
|
|
37
|
-
name: this.name,
|
|
38
|
-
model,
|
|
39
|
-
instructions: this.instructions,
|
|
40
|
-
tools: this.tools,
|
|
41
|
-
outputType: (0, structured_output_1.getOutputSchema)(this.externalOutputMessagesSchemas),
|
|
42
|
-
inputGuardrails: this.inputGuardrails,
|
|
43
|
-
outputGuardrails: [],
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
addExtraInstructions(initialInstructions, contactInfo, campaignsContext) {
|
|
47
|
-
const instructions = `<instructions>\n${initialInstructions.trim()}\n</instructions>`;
|
|
48
|
-
const metadataInstructions = this.getMetadataInstructions();
|
|
49
|
-
const contactInfoInstructions = this.getContactInfoInstructions(contactInfo);
|
|
50
|
-
const campaignInstructions = this.getCampaignInstructions(campaignsContext);
|
|
51
|
-
const outputInstructions = this.getOutputInstructions();
|
|
52
|
-
return `${instructions}\n\n${metadataInstructions}\n\n${contactInfoInstructions}\n\n${campaignInstructions}\n\n${outputInstructions}`;
|
|
53
|
-
}
|
|
54
|
-
getContactInfoInstructions(contactInfo) {
|
|
55
|
-
const structuredContactInfo = contactInfo
|
|
56
|
-
.map(info => ` <contact_info>
|
|
57
|
-
<name>${info.name}</name>
|
|
58
|
-
<value>${info.value}</value>
|
|
59
|
-
<type>${info.type}</type>
|
|
60
|
-
${info.description
|
|
61
|
-
? `<description>${info.description}</description>`
|
|
62
|
-
: ''}
|
|
63
|
-
</contact_info>`)
|
|
64
|
-
.join('\n');
|
|
65
|
-
return `<contact_info_fields>\n${structuredContactInfo}</contact_info_fields>`;
|
|
66
|
-
}
|
|
67
|
-
getMetadataInstructions() {
|
|
68
|
-
const metadata = `Current Date: ${new Date().toISOString()}`;
|
|
69
|
-
return `<metadata>\n${metadata}\n</metadata>`;
|
|
70
|
-
}
|
|
71
|
-
getCampaignInstructions(campaignsContext) {
|
|
72
|
-
if (!campaignsContext || campaignsContext.length === 0) {
|
|
73
|
-
return '';
|
|
74
|
-
}
|
|
75
|
-
const campaignsWithContext = campaignsContext.filter(campaign => campaign.agent_context);
|
|
76
|
-
if (campaignsWithContext.length === 0) {
|
|
77
|
-
return '';
|
|
78
|
-
}
|
|
79
|
-
return campaignsWithContext
|
|
80
|
-
.map((campaign, index) => `<campaign_context_${index + 1}>\n${campaign.agent_context}\n</campaign_context_${index + 1}>`)
|
|
81
|
-
.join('\n');
|
|
82
|
-
}
|
|
83
|
-
getOutputInstructions() {
|
|
84
|
-
const example = {
|
|
85
|
-
messages: [
|
|
86
|
-
{
|
|
87
|
-
type: 'text',
|
|
88
|
-
content: {
|
|
89
|
-
text: 'Hello, how can I help you today?',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
};
|
|
94
|
-
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>`;
|
|
95
|
-
return `<output>\n${output}\n</output>`;
|
|
96
|
-
}
|
|
97
|
-
addHubtypeTools(tools, sourceIds) {
|
|
98
|
-
const hubtypeTools = [...tools_1.mandatoryTools];
|
|
99
|
-
if (sourceIds.length > 0) {
|
|
100
|
-
hubtypeTools.push(tools_1.retrieveKnowledge);
|
|
101
|
-
}
|
|
102
|
-
return [...hubtypeTools, ...tools];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.AIAgentBuilder = AIAgentBuilder;
|
|
106
|
-
//# sourceMappingURL=agent-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../src/agent-builder.ts"],"names":[],"mappings":";;;AACA,2CAIuB;AAGvB,2CAA6C;AAE7C,6CAAmD;AAGnD,2DAAwE;AACxE,mCAA2D;AAoB3D,MAAa,cAAc;IAYzB,YAAY,OAAoD;QAC9D,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAC3C,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,gBAAgB,CACzB,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,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A;QACX,CAAC;QACD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAClD,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CACnC,CAAA;QACD,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,oBAAoB;aACxB,GAAG,CACF,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAClB,qBAAqB,KAAK,GAAG,CAAC,MAAM,QAAQ,CAAC,aAAa,wBAAwB,KAAK,GAAG,CAAC,GAAG,CACjG;aACA,IAAI,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;IAEO,qBAAqB;QAC3B,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE;wBACP,IAAI,EAAE,kCAAkC;qBACzC;iBACF;aACF;SACF,CAAA;QACD,MAAM,MAAM,GAAG,yIAAyI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;QAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;IACzC,CAAC;IAEO,eAAe,CACrB,KAAmC,EACnC,SAAmB;QAEnB,MAAM,YAAY,GAAW,CAAC,GAAG,sBAAc,CAAC,CAAA;QAChD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,YAAY,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAA;IACpC,CAAC;CACF;AApJD,wCAoJC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolConfigJSON } from '@botonic/core';
|
|
2
|
-
import type { CustomTool } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
|
|
5
|
-
* Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getToolsForBotConfig(customTools: CustomTool[]): ToolConfigJSON[];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getToolsForBotConfig = getToolsForBotConfig;
|
|
4
|
-
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
-
/**
|
|
6
|
-
* Maps custom AI agent tools to the format expected by bot config (e.g. for flow-builder).
|
|
7
|
-
* Converts each tool's Zod schema to JSON Schema so it can be serialized in the config.
|
|
8
|
-
*/
|
|
9
|
-
function getToolsForBotConfig(customTools) {
|
|
10
|
-
return customTools.map(tool => ({
|
|
11
|
-
name: tool.name,
|
|
12
|
-
description: tool.description,
|
|
13
|
-
// Cast to avoid TS "Type instantiation is excessively deep" with zodToJsonSchema + ZodSchema
|
|
14
|
-
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema, {
|
|
15
|
-
$refStrategy: 'none',
|
|
16
|
-
}),
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=bot-config-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bot-config-tools.js","sourceRoot":"","sources":["../../src/bot-config-tools.ts"],"names":[],"mappings":";;AASA,oDAWC;AAnBD,2DAAoD;AAIpD;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,WAAyB;IAEzB,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,6FAA6F;QAC7F,MAAM,EAAE,IAAA,oCAAe,EAAC,IAAI,CAAC,MAAe,EAAE;YAC5C,YAAY,EAAE,MAAM;SACrB,CAA6B;KAC/B,CAAC,CAAC,CAAA;AACL,CAAC"}
|
package/lib/esm/constants.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const HUBTYPE_API_URL: string;
|
|
2
|
-
export declare const OPENAI_API_KEY: string | undefined;
|
|
3
|
-
export declare const OPENAI_MODEL: string;
|
|
4
|
-
export declare const OPENAI_PROVIDER: 'openai' | 'azure';
|
|
5
|
-
export declare const AZURE_OPENAI_API_KEY: string | undefined;
|
|
6
|
-
export declare const AZURE_OPENAI_API_BASE: string | undefined;
|
|
7
|
-
export declare const AZURE_OPENAI_API_VERSION: string;
|
|
8
|
-
export declare const isProd: boolean;
|
|
9
|
-
export declare const MAX_MEMORY_LENGTH = 25;
|
|
10
|
-
export declare const DEFAULT_TIMEOUT_16_SECONDS = 16000;
|
|
11
|
-
export declare const DEFAULT_MAX_RETRIES = 2;
|
package/lib/esm/constants.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_TIMEOUT_16_SECONDS = exports.MAX_MEMORY_LENGTH = exports.isProd = exports.AZURE_OPENAI_API_VERSION = exports.AZURE_OPENAI_API_BASE = exports.AZURE_OPENAI_API_KEY = exports.OPENAI_PROVIDER = exports.OPENAI_MODEL = exports.OPENAI_API_KEY = exports.HUBTYPE_API_URL = void 0;
|
|
4
|
-
exports.HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
5
|
-
// OpenAI Provider Configuration
|
|
6
|
-
exports.OPENAI_API_KEY = process.env.OPENAI_API_KEY; // pragma: allowlist secret
|
|
7
|
-
exports.OPENAI_MODEL = process.env.OPENAI_MODEL || 'gpt-4.1-mini';
|
|
8
|
-
exports.OPENAI_PROVIDER = process.env.OPENAI_PROVIDER || 'azure';
|
|
9
|
-
// Azure OpenAI Configuration
|
|
10
|
-
exports.AZURE_OPENAI_API_KEY = process.env.AZURE_OPENAI_API_KEY; // pragma: allowlist secret
|
|
11
|
-
exports.AZURE_OPENAI_API_BASE = process.env.AZURE_OPENAI_API_BASE;
|
|
12
|
-
exports.AZURE_OPENAI_API_VERSION = process.env.AZURE_OPENAI_API_VERSION || '2025-01-01-preview';
|
|
13
|
-
exports.isProd = process.env.NODE_ENV === 'production';
|
|
14
|
-
exports.MAX_MEMORY_LENGTH = 25;
|
|
15
|
-
exports.DEFAULT_TIMEOUT_16_SECONDS = 16000;
|
|
16
|
-
exports.DEFAULT_MAX_RETRIES = 2;
|
|
17
|
-
//# sourceMappingURL=constants.js.map
|
package/lib/esm/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAE1D,gCAAgC;AACnB,QAAA,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA,CAAC,2BAA2B;AACvE,QAAA,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,cAAc,CAAA;AACzD,QAAA,eAAe,GACzB,OAAO,CAAC,GAAG,CAAC,eAAsC,IAAI,OAAO,CAAA;AAEhE,6BAA6B;AAChB,QAAA,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAA,CAAC,2BAA2B;AACnF,QAAA,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAA;AACzD,QAAA,wBAAwB,GACnC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,oBAAoB,CAAA;AAEjD,QAAA,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AAE9C,QAAA,iBAAiB,GAAG,EAAE,CAAA;AAEtB,QAAA,0BAA0B,GAAG,KAAK,CAAA;AAClC,QAAA,mBAAmB,GAAG,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|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AC,aAAa,CAAC,sBAAsB,CAAC,EAAE,CAC9F,CAAA;IACH,CAAC;CACF;AAED,MAAM,mBAAmB;IACvB,gBAAgB,KAAU,CAAC;IAC3B,iBAAiB,KAAU,CAAC;IAC5B,gBAAgB,KAAU,CAAC;IAC3B,cAAc,CAAC,MAAc,EAAE,cAA6B,IAAS,CAAC;IACtE,YAAY,KAAU,CAAC;IACvB,qBAAqB,KAAU,CAAC;IAChC,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;CAC5B;AAED,SAAgB,iBAAiB,CAAC,WAAoB;IACpD,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAA;AAC3E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './input';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/guardrails/index.ts"],"names":[],"mappings":";;;AAAA,kDAAuB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type InputGuardrail } from '@openai/agents';
|
|
2
|
-
import type { LLMConfig } from '../llm-config';
|
|
3
|
-
import type { GuardrailRule } from '../types';
|
|
4
|
-
export interface GuardrailTrackingContext {
|
|
5
|
-
botId: string;
|
|
6
|
-
isTest: boolean;
|
|
7
|
-
authToken: string;
|
|
8
|
-
inferenceId: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function createInputGuardrail(rules: GuardrailRule[], llmConfig: LLMConfig, trackingContext: GuardrailTrackingContext): InputGuardrail;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createInputGuardrail = createInputGuardrail;
|
|
4
|
-
const agents_1 = require("@openai/agents");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const constants_1 = require("../constants");
|
|
7
|
-
const hubtype_api_client_1 = require("../services/hubtype-api-client");
|
|
8
|
-
const types_1 = require("../services/types");
|
|
9
|
-
function createInputGuardrail(rules, llmConfig, trackingContext) {
|
|
10
|
-
const outputType = zod_1.z.object(Object.fromEntries(rules.map(rule => [rule.name, zod_1.z.boolean().describe(rule.description)])));
|
|
11
|
-
const agent = new agents_1.Agent({
|
|
12
|
-
name: 'InputGuardrail',
|
|
13
|
-
instructions: 'Check if the user triggers some of the following guardrails.',
|
|
14
|
-
outputType,
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
name: 'InputGuardrail',
|
|
18
|
-
execute: async ({ input, context }) => {
|
|
19
|
-
const lastMessage = input[input.length - 1];
|
|
20
|
-
const modelProvider = llmConfig.modelProvider;
|
|
21
|
-
const modelSettings = llmConfig.modelSettings;
|
|
22
|
-
modelSettings.toolChoice = undefined;
|
|
23
|
-
const runner = new agents_1.Runner({
|
|
24
|
-
modelSettings,
|
|
25
|
-
modelProvider,
|
|
26
|
-
tracingDisabled: true,
|
|
27
|
-
});
|
|
28
|
-
const startTime = Date.now();
|
|
29
|
-
const result = await runner.run(agent, [lastMessage], { context });
|
|
30
|
-
const endTime = Date.now();
|
|
31
|
-
void sendGuardrailLlmRunTracking(result, trackingContext, llmConfig, startTime, endTime);
|
|
32
|
-
const finalOutput = result.finalOutput;
|
|
33
|
-
if (finalOutput === undefined) {
|
|
34
|
-
throw new Error('Guardrail agent failed to produce output');
|
|
35
|
-
}
|
|
36
|
-
const triggered = Object.values(finalOutput).some(value => value === true);
|
|
37
|
-
const triggeredGuardrails = Object.keys(finalOutput).filter(key => finalOutput[key] === true);
|
|
38
|
-
return {
|
|
39
|
-
outputInfo: triggeredGuardrails,
|
|
40
|
-
tripwireTriggered: triggered,
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async function sendGuardrailLlmRunTracking(result, trackingContext, llmConfig, startTime, endTime) {
|
|
46
|
-
if (!constants_1.isProd) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const rawResponses = result.rawResponses ?? [];
|
|
50
|
-
if (rawResponses.length === 0) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const totalDuration = endTime - startTime;
|
|
54
|
-
const durationPerCall = Math.round(totalDuration / rawResponses.length);
|
|
55
|
-
const temperature = llmConfig.modelSettings.temperature ?? 0;
|
|
56
|
-
const apiVersion = constants_1.OPENAI_PROVIDER === 'azure' ? constants_1.AZURE_OPENAI_API_VERSION : '';
|
|
57
|
-
const llmRuns = rawResponses.map(response => ({
|
|
58
|
-
inference_id: trackingContext.inferenceId,
|
|
59
|
-
is_test: trackingContext.isTest,
|
|
60
|
-
product_name: types_1.TrackProductName.AI_AGENT,
|
|
61
|
-
deployment_name: llmConfig.modelName,
|
|
62
|
-
model_name: response.providerData?.['model'] ??
|
|
63
|
-
llmConfig.modelName,
|
|
64
|
-
feature: types_1.TrackFeature.AI_AGENT_GUARDRAIL,
|
|
65
|
-
api_version: apiVersion,
|
|
66
|
-
num_prompt_tokens: response.usage.inputTokens,
|
|
67
|
-
num_completion_tokens: response.usage.outputTokens,
|
|
68
|
-
duration_in_milliseconds: durationPerCall,
|
|
69
|
-
temperature,
|
|
70
|
-
error: null,
|
|
71
|
-
}));
|
|
72
|
-
const client = new hubtype_api_client_1.HubtypeApiClient(trackingContext.authToken);
|
|
73
|
-
await client.trackLlmRuns(trackingContext.botId, {
|
|
74
|
-
llm_runs: llmRuns,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/guardrails/input.ts"],"names":[],"mappings":";;AAoBA,oDAwDC;AA5ED,2CAKuB;AACvB,6BAAuB;AACvB,4CAAgF;AAEhF,uEAAiE;AACjE,6CAAkE;AAUlE,SAAgB,oBAAoB,CAClC,KAAsB,EACtB,SAAoB,EACpB,eAAyC;IAE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