@botonic/plugin-ai-agents 0.40.0-alpha.1 → 0.40.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.
Files changed (55) hide show
  1. package/lib/cjs/agent-builder.d.ts +1 -1
  2. package/lib/cjs/agent-builder.js +11 -3
  3. package/lib/cjs/agent-builder.js.map +1 -1
  4. package/lib/cjs/hubtype-api-client.d.ts +1 -0
  5. package/lib/cjs/hubtype-api-client.js +19 -1
  6. package/lib/cjs/hubtype-api-client.js.map +1 -1
  7. package/lib/cjs/index.d.ts +2 -2
  8. package/lib/cjs/index.js +2 -1
  9. package/lib/cjs/index.js.map +1 -1
  10. package/lib/cjs/structured-output/carousel.d.ts +9 -9
  11. package/lib/cjs/structured-output/carousel.js +1 -1
  12. package/lib/cjs/structured-output/carousel.js.map +1 -1
  13. package/lib/cjs/structured-output/index.d.ts +36 -18
  14. package/lib/cjs/structured-output/text-with-buttons.d.ts +19 -5
  15. package/lib/cjs/structured-output/text-with-buttons.js +3 -1
  16. package/lib/cjs/structured-output/text-with-buttons.js.map +1 -1
  17. package/lib/cjs/tools/index.d.ts +1 -0
  18. package/lib/cjs/tools/index.js +3 -1
  19. package/lib/cjs/tools/index.js.map +1 -1
  20. package/lib/cjs/tools/retrieve-knowledge.d.ts +2 -0
  21. package/lib/cjs/tools/retrieve-knowledge.js +25 -0
  22. package/lib/cjs/tools/retrieve-knowledge.js.map +1 -0
  23. package/lib/cjs/types.d.ts +3 -14
  24. package/lib/esm/agent-builder.d.ts +1 -1
  25. package/lib/esm/agent-builder.js +12 -4
  26. package/lib/esm/agent-builder.js.map +1 -1
  27. package/lib/esm/hubtype-api-client.d.ts +1 -0
  28. package/lib/esm/hubtype-api-client.js +19 -1
  29. package/lib/esm/hubtype-api-client.js.map +1 -1
  30. package/lib/esm/index.d.ts +2 -2
  31. package/lib/esm/index.js +2 -1
  32. package/lib/esm/index.js.map +1 -1
  33. package/lib/esm/structured-output/carousel.d.ts +9 -9
  34. package/lib/esm/structured-output/carousel.js +1 -1
  35. package/lib/esm/structured-output/carousel.js.map +1 -1
  36. package/lib/esm/structured-output/index.d.ts +36 -18
  37. package/lib/esm/structured-output/text-with-buttons.d.ts +19 -5
  38. package/lib/esm/structured-output/text-with-buttons.js +3 -1
  39. package/lib/esm/structured-output/text-with-buttons.js.map +1 -1
  40. package/lib/esm/tools/index.d.ts +1 -0
  41. package/lib/esm/tools/index.js +1 -0
  42. package/lib/esm/tools/index.js.map +1 -1
  43. package/lib/esm/tools/retrieve-knowledge.d.ts +2 -0
  44. package/lib/esm/tools/retrieve-knowledge.js +22 -0
  45. package/lib/esm/tools/retrieve-knowledge.js.map +1 -0
  46. package/lib/esm/types.d.ts +3 -14
  47. package/package.json +3 -3
  48. package/src/agent-builder.ts +16 -5
  49. package/src/hubtype-api-client.ts +22 -1
  50. package/src/index.ts +4 -3
  51. package/src/structured-output/carousel.ts +1 -1
  52. package/src/structured-output/text-with-buttons.ts +5 -1
  53. package/src/tools/index.ts +1 -0
  54. package/src/tools/retrieve-knowledge.ts +27 -0
  55. package/src/types.ts +10 -13
@@ -4,7 +4,7 @@ export declare class AIAgentBuilder {
4
4
  private instructions;
5
5
  private tools;
6
6
  private inputGuardrails;
7
- constructor(name: string, instructions: string, tools: Tool[], contactInfo: ContactInfo, inputGuardrailRules: GuardrailRule[]);
7
+ constructor(name: string, instructions: string, tools: Tool[], contactInfo: ContactInfo, inputGuardrailRules: GuardrailRule[], sourceIds: string[]);
8
8
  build(): AIAgent;
9
9
  private addExtraInstructions;
10
10
  private getContactInfoInstructions;
@@ -6,10 +6,10 @@ const guardrails_1 = require("./guardrails");
6
6
  const structured_output_1 = require("./structured-output");
7
7
  const tools_1 = require("./tools");
8
8
  class AIAgentBuilder {
9
- constructor(name, instructions, tools, contactInfo, inputGuardrailRules) {
9
+ constructor(name, instructions, tools, contactInfo, inputGuardrailRules, sourceIds) {
10
10
  this.name = name;
11
11
  this.instructions = this.addExtraInstructions(instructions, contactInfo);
12
- this.tools = this.addHubtypeTools(tools);
12
+ this.tools = this.addHubtypeTools(tools, sourceIds);
13
13
  this.inputGuardrails = [];
14
14
  if (inputGuardrailRules.length > 0) {
15
15
  const inputGuardrail = (0, guardrails_1.createInputGuardrail)(inputGuardrailRules);
@@ -17,6 +17,10 @@ class AIAgentBuilder {
17
17
  }
18
18
  }
19
19
  build() {
20
+ const modelSettings = {};
21
+ if (this.tools.includes(tools_1.retrieveKnowledge)) {
22
+ modelSettings.toolChoice = tools_1.retrieveKnowledge.name;
23
+ }
20
24
  return new agents_1.Agent({
21
25
  name: this.name,
22
26
  instructions: this.instructions,
@@ -24,6 +28,7 @@ class AIAgentBuilder {
24
28
  outputType: structured_output_1.OutputSchema,
25
29
  inputGuardrails: this.inputGuardrails,
26
30
  outputGuardrails: [],
31
+ modelSettings,
27
32
  });
28
33
  }
29
34
  addExtraInstructions(initialInstructions, contactInfo) {
@@ -57,8 +62,11 @@ class AIAgentBuilder {
57
62
  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>`;
58
63
  return `<output>\n${output}\n</output>`;
59
64
  }
60
- addHubtypeTools(tools) {
65
+ addHubtypeTools(tools, sourceIds) {
61
66
  const hubtypeTools = [...tools_1.mandatoryTools];
67
+ if (sourceIds.length > 0) {
68
+ hubtypeTools.push(tools_1.retrieveKnowledge);
69
+ }
62
70
  return [...hubtypeTools, ...tools];
63
71
  }
64
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../src/agent-builder.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AAEtD,6CAAmD;AACnD,2DAAkD;AAClD,mCAAwC;AAGxC,MAAa,cAAc;IAMzB,YACE,IAAY,EACZ,YAAoB,EACpB,KAAa,EACb,WAAwB,EACxB,mBAAoC;QAEpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,YAAY,GAA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B,mBAAmB,CAAA;IACpE,CAAC;IAEO,uBAAuB;QAC7B,MAAM,QAAQ,GAAG,iBAAiB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAA;QAC5D,OAAO,eAAe,QAAQ,eAAe,CAAA;IAC/C,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,CAAC,KAAa,EAAE,SAAmB;QACxD,MAAM,YAAY,GAAW,CAAC,GAAG,sBAAc,CAAC,CAAA;QAChD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,YAAY,CAAC,IAAI,CAAC,yBAAiB,CAAC,CAAA;SACrC;QACD,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAA;IACpC,CAAC;CACF;AAvFD,wCAuFC"}
@@ -3,6 +3,7 @@ import { AgenticInputMessage } from './types';
3
3
  export declare class HubtypeApiClient {
4
4
  private readonly authToken;
5
5
  constructor(authToken: string);
6
+ retrieveSimilarChunks(query: string, sources: string[]): Promise<string[]>;
6
7
  getLocalMessages(maxMemoryLength: number): Promise<AgenticInputMessage[]>;
7
8
  getMessages(request: BotContext, maxMemoryLength: number): Promise<AgenticInputMessage[]>;
8
9
  private formatMessage;
@@ -8,9 +8,27 @@ class HubtypeApiClient {
8
8
  constructor(authToken) {
9
9
  this.authToken = authToken;
10
10
  }
11
+ retrieveSimilarChunks(query, sources) {
12
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ const url = `${constants_1.HUBTYPE_API_URL}/external/v1/ai/knowledge_base/similar_chunks/`;
14
+ const headers = {
15
+ 'Content-Type': 'application/json',
16
+ Authorization: `Bearer ${this.authToken}`,
17
+ };
18
+ const params = {
19
+ query,
20
+ source_ids: sources,
21
+ num_chunks: 5,
22
+ };
23
+ const response = yield axios_1.default.post(url, params, { headers });
24
+ return response.data.chunks.map((chunk) => chunk.text);
25
+ });
26
+ }
11
27
  getLocalMessages(maxMemoryLength) {
12
28
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
- const localBotonicState = localStorage.getItem('botonicState');
29
+ const localBotonicState = typeof globalThis !== 'undefined' && globalThis.localStorage
30
+ ? globalThis.localStorage.getItem('botonicState')
31
+ : null;
14
32
  const botonicState = JSON.parse(localBotonicState || '{}');
15
33
  const messages = botonicState.messages;
16
34
  const filteredMessages = messages
@@ -1 +1 @@
1
- {"version":3,"file":"hubtype-api-client.js","sourceRoot":"","sources":["../../src/hubtype-api-client.ts"],"names":[],"mappings":";;;;AAEA,0DAAyB;AAEzB,2CAA6C;AAe7C,MAAa,gBAAgB;IAG3B,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEK,gBAAgB,CACpB,eAAuB;;YAEvB,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;YAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAA;YAC1D,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAA;YACtC,MAAM,gBAAgB,GAAG,QAAQ;iBAC9B,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;iBACpC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBACf,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW;gBACtD,OAAO,EAAE,OAAO,CAAC,IAAI,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BACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBACpB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;aACvD;QACH,CAAC;KAAA;IAEO,aAAa,CAAC,OAAuB;QAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YAC3B,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,MAAM;aACb,CAAA;SACF;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE;YACvC,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE,OAAO,CAAC,OAAO;qBACtB;iBACF;gBACD,MAAM,EAAE,WAAW;aACpB,CAAA;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;SACxC;IACH,CAAC;CACF;AA5FD,4CA4FC"}
@@ -1,5 +1,5 @@
1
- import { BotContext, Plugin } from '@botonic/core';
2
- import { AiAgentArgs, CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
1
+ import { AiAgentArgs, BotContext, Plugin } from '@botonic/core';
2
+ import { CustomTool, InferenceResponse, PluginAiAgentOptions } from './types';
3
3
  export default class BotonicPluginAiAgents implements Plugin {
4
4
  private readonly authToken?;
5
5
  toolDefinitions: CustomTool[];
package/lib/cjs/index.js CHANGED
@@ -26,10 +26,11 @@ class BotonicPluginAiAgents {
26
26
  throw new Error('Auth token is required');
27
27
  }
28
28
  const tools = this.buildTools(((_a = aiAgentArgs.activeTools) === null || _a === void 0 ? void 0 : _a.map(tool => tool.name)) || []);
29
- const agent = new agent_builder_1.AIAgentBuilder(aiAgentArgs.name, aiAgentArgs.instructions, tools, request.session.user.contact_info || {}, aiAgentArgs.inputGuardrailRules || []).build();
29
+ const agent = new agent_builder_1.AIAgentBuilder(aiAgentArgs.name, aiAgentArgs.instructions, tools, request.session.user.contact_info || {}, aiAgentArgs.inputGuardrailRules || [], aiAgentArgs.sourceIds || []).build();
30
30
  const messages = yield this.getMessages(request, authToken, constants_1.MAX_MEMORY_LENGTH);
31
31
  const context = {
32
32
  authToken,
33
+ sources: aiAgentArgs.sourceIds || [],
33
34
  };
34
35
  const runner = new runner_1.AIAgentRunner(agent);
35
36
  return yield runner.run(messages, context);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,2CAAqC;AAErC,mDAAgD;AAChD,2CAAuD;AACvD,6DAAuD;AACvD,qCAAsC;AACtC,qCAAwC;AAWxC,MAAqB,qBAAqB;IAIxC,YAAY,OAA8B;QAFnC,oBAAe,GAAiB,EAAE,CAAA;QAGvC,IAAA,oBAAW,GAAE,CAAA;QACb,IAAI,CAAC,SAAS,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA;QACnC,IAAI,CAAC,eAAe,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,KAAI,EAAE,CAAA;IACnD,CAAC;IAED,GAAG;QACD,OAAM;IACR,CAAC;IAEK,YAAY,CAChB,OAAmB,EACnB,WAAwB;;;YAExB,IAAI;gBACF,MAAM,SAAS,GAAG,kBAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;gBACzE,IAAI,CAAC,SAAS,EAAE;oBACd,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;iBAC1C;gBAED,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAC3B,CAAA,MAAA,WAAW,CAAC,WAAW,0CAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAI,EAAE,CACtD,CAAA;gBACD,MAAM,KAAK,GAAG,IAAI,8BAAc,CAC9B,WAAW,CAAC,IAAI,EAChB,WAAW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AC,SAAS,CAAC,CAAA;YACrD,OAAO,MAAM,aAAa,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAA;QAC3D,CAAC;KAAA;IAEO,UAAU,CAAC,eAAyB;QAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CACxD,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CACpC,CAAA;QACD,OAAO,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;YACzC,OAAO,IAAA,aAAI,EAAoB;gBAC7B,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,WAAW,EAAE,cAAc,CAAC,WAAW;gBACvC,UAAU,EAAE,cAAc,CAAC,MAAM;gBACjC,OAAO,EAAE,cAAc,CAAC,IAAI;aAC7B,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAxFD,wCAwFC;AAED,kDAAuB"}
@@ -10,13 +10,13 @@ export declare const CarouselSchema: z.ZodObject<{
10
10
  image: z.ZodString;
11
11
  button: z.ZodObject<{
12
12
  text: z.ZodString;
13
- url: z.ZodString;
13
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
14
  }, "strip", z.ZodTypeAny, {
15
15
  text: string;
16
- url: string;
16
+ url?: string | null | undefined;
17
17
  }, {
18
18
  text: string;
19
- url: string;
19
+ url?: string | null | undefined;
20
20
  }>;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  title: string;
@@ -24,7 +24,7 @@ export declare const CarouselSchema: z.ZodObject<{
24
24
  image: string;
25
25
  button: {
26
26
  text: string;
27
- url: string;
27
+ url?: string | null | undefined;
28
28
  };
29
29
  }, {
30
30
  title: string;
@@ -32,7 +32,7 @@ export declare const CarouselSchema: z.ZodObject<{
32
32
  image: string;
33
33
  button: {
34
34
  text: string;
35
- url: string;
35
+ url?: string | null | undefined;
36
36
  };
37
37
  }>, "many">;
38
38
  }, "strip", z.ZodTypeAny, {
@@ -42,7 +42,7 @@ export declare const CarouselSchema: z.ZodObject<{
42
42
  image: string;
43
43
  button: {
44
44
  text: string;
45
- url: string;
45
+ url?: string | null | undefined;
46
46
  };
47
47
  }[];
48
48
  }, {
@@ -52,7 +52,7 @@ export declare const CarouselSchema: z.ZodObject<{
52
52
  image: string;
53
53
  button: {
54
54
  text: string;
55
- url: string;
55
+ url?: string | null | undefined;
56
56
  };
57
57
  }[];
58
58
  }>;
@@ -65,7 +65,7 @@ export declare const CarouselSchema: z.ZodObject<{
65
65
  image: string;
66
66
  button: {
67
67
  text: string;
68
- url: string;
68
+ url?: string | null | undefined;
69
69
  };
70
70
  }[];
71
71
  };
@@ -78,7 +78,7 @@ export declare const CarouselSchema: z.ZodObject<{
78
78
  image: string;
79
79
  button: {
80
80
  text: string;
81
- url: string;
81
+ url?: string | null | undefined;
82
82
  };
83
83
  }[];
84
84
  };
@@ -12,7 +12,7 @@ exports.CarouselSchema = zod_1.z
12
12
  image: zod_1.z.string(),
13
13
  button: zod_1.z.object({
14
14
  text: zod_1.z.string(),
15
- url: zod_1.z.string(),
15
+ url: zod_1.z.string().nullable().optional(),
16
16
  }),
17
17
  })),
18
18
  }),
@@ -1 +1 @@
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,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;aAChB,CAAC;SACH,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAC,CAAA"}
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,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"}
@@ -27,25 +27,39 @@ export declare const OutputSchema: z.ZodObject<{
27
27
  type: z.ZodEnum<["textWithButtons"]>;
28
28
  content: z.ZodObject<{
29
29
  text: z.ZodString;
30
- buttons: z.ZodArray<z.ZodString, "many">;
30
+ buttons: z.ZodArray<z.ZodObject<{
31
+ text: z.ZodString;
32
+ }, "strip", z.ZodTypeAny, {
33
+ text: string;
34
+ }, {
35
+ text: string;
36
+ }>, "many">;
31
37
  }, "strip", z.ZodTypeAny, {
32
38
  text: string;
33
- buttons: string[];
39
+ buttons: {
40
+ text: string;
41
+ }[];
34
42
  }, {
35
43
  text: string;
36
- buttons: string[];
44
+ buttons: {
45
+ text: string;
46
+ }[];
37
47
  }>;
38
48
  }, "strip", z.ZodTypeAny, {
39
49
  type: "textWithButtons";
40
50
  content: {
41
51
  text: string;
42
- buttons: string[];
52
+ buttons: {
53
+ text: string;
54
+ }[];
43
55
  };
44
56
  }, {
45
57
  type: "textWithButtons";
46
58
  content: {
47
59
  text: string;
48
- buttons: string[];
60
+ buttons: {
61
+ text: string;
62
+ }[];
49
63
  };
50
64
  }>, z.ZodObject<{
51
65
  type: z.ZodEnum<["carousel"]>;
@@ -56,13 +70,13 @@ export declare const OutputSchema: z.ZodObject<{
56
70
  image: z.ZodString;
57
71
  button: z.ZodObject<{
58
72
  text: z.ZodString;
59
- url: z.ZodString;
73
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
74
  }, "strip", z.ZodTypeAny, {
61
75
  text: string;
62
- url: string;
76
+ url?: string | null | undefined;
63
77
  }, {
64
78
  text: string;
65
- url: string;
79
+ url?: string | null | undefined;
66
80
  }>;
67
81
  }, "strip", z.ZodTypeAny, {
68
82
  title: string;
@@ -70,7 +84,7 @@ export declare const OutputSchema: z.ZodObject<{
70
84
  image: string;
71
85
  button: {
72
86
  text: string;
73
- url: string;
87
+ url?: string | null | undefined;
74
88
  };
75
89
  }, {
76
90
  title: string;
@@ -78,7 +92,7 @@ export declare const OutputSchema: z.ZodObject<{
78
92
  image: string;
79
93
  button: {
80
94
  text: string;
81
- url: string;
95
+ url?: string | null | undefined;
82
96
  };
83
97
  }>, "many">;
84
98
  }, "strip", z.ZodTypeAny, {
@@ -88,7 +102,7 @@ export declare const OutputSchema: z.ZodObject<{
88
102
  image: string;
89
103
  button: {
90
104
  text: string;
91
- url: string;
105
+ url?: string | null | undefined;
92
106
  };
93
107
  }[];
94
108
  }, {
@@ -98,7 +112,7 @@ export declare const OutputSchema: z.ZodObject<{
98
112
  image: string;
99
113
  button: {
100
114
  text: string;
101
- url: string;
115
+ url?: string | null | undefined;
102
116
  };
103
117
  }[];
104
118
  }>;
@@ -111,7 +125,7 @@ export declare const OutputSchema: z.ZodObject<{
111
125
  image: string;
112
126
  button: {
113
127
  text: string;
114
- url: string;
128
+ url?: string | null | undefined;
115
129
  };
116
130
  }[];
117
131
  };
@@ -124,7 +138,7 @@ export declare const OutputSchema: z.ZodObject<{
124
138
  image: string;
125
139
  button: {
126
140
  text: string;
127
- url: string;
141
+ url?: string | null | undefined;
128
142
  };
129
143
  }[];
130
144
  };
@@ -145,7 +159,7 @@ export declare const OutputSchema: z.ZodObject<{
145
159
  image: string;
146
160
  button: {
147
161
  text: string;
148
- url: string;
162
+ url?: string | null | undefined;
149
163
  };
150
164
  }[];
151
165
  };
@@ -160,7 +174,9 @@ export declare const OutputSchema: z.ZodObject<{
160
174
  type: "textWithButtons";
161
175
  content: {
162
176
  text: string;
163
- buttons: string[];
177
+ buttons: {
178
+ text: string;
179
+ }[];
164
180
  };
165
181
  })[];
166
182
  }, {
@@ -173,7 +189,7 @@ export declare const OutputSchema: z.ZodObject<{
173
189
  image: string;
174
190
  button: {
175
191
  text: string;
176
- url: string;
192
+ url?: string | null | undefined;
177
193
  };
178
194
  }[];
179
195
  };
@@ -188,7 +204,9 @@ export declare const OutputSchema: z.ZodObject<{
188
204
  type: "textWithButtons";
189
205
  content: {
190
206
  text: string;
191
- buttons: string[];
207
+ buttons: {
208
+ text: string;
209
+ }[];
192
210
  };
193
211
  })[];
194
212
  }>;
@@ -5,24 +5,38 @@ export declare const TextWithButtonsSchema: z.ZodObject<{
5
5
  type: z.ZodEnum<["textWithButtons"]>;
6
6
  content: z.ZodObject<{
7
7
  text: z.ZodString;
8
- buttons: z.ZodArray<z.ZodString, "many">;
8
+ buttons: z.ZodArray<z.ZodObject<{
9
+ text: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ text: string;
12
+ }, {
13
+ text: string;
14
+ }>, "many">;
9
15
  }, "strip", z.ZodTypeAny, {
10
16
  text: string;
11
- buttons: string[];
17
+ buttons: {
18
+ text: string;
19
+ }[];
12
20
  }, {
13
21
  text: string;
14
- buttons: string[];
22
+ buttons: {
23
+ text: string;
24
+ }[];
15
25
  }>;
16
26
  }, "strip", z.ZodTypeAny, {
17
27
  type: "textWithButtons";
18
28
  content: {
19
29
  text: string;
20
- buttons: string[];
30
+ buttons: {
31
+ text: string;
32
+ }[];
21
33
  };
22
34
  }, {
23
35
  type: "textWithButtons";
24
36
  content: {
25
37
  text: string;
26
- buttons: string[];
38
+ buttons: {
39
+ text: string;
40
+ }[];
27
41
  };
28
42
  }>;
@@ -8,7 +8,9 @@ exports.TextWithButtonsSchema = zod_1.default
8
8
  type: zod_1.default.enum(['textWithButtons']),
9
9
  content: zod_1.default.object({
10
10
  text: zod_1.default.string(),
11
- buttons: zod_1.default.array(zod_1.default.string()),
11
+ buttons: zod_1.default.array(zod_1.default.object({
12
+ text: zod_1.default.string(),
13
+ })),
12
14
  }),
13
15
  })
14
16
  .describe('A text message with buttons to allow the user to use quick replies');
@@ -1 +1 @@
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,CAAC,aAAC,CAAC,MAAM,EAAE,CAAC;KAC7B,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
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;SACjB,CAAC,CACH;KACF,CAAC;CACH,CAAC;KACD,QAAQ,CACP,oEAAoE,CACrE,CAAA"}
@@ -1,2 +1,3 @@
1
1
  import { Tool } from '../types';
2
+ export { retrieveKnowledge } from './retrieve-knowledge';
2
3
  export declare const mandatoryTools: Tool[];
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mandatoryTools = void 0;
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; } });
4
6
  exports.mandatoryTools = [];
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";;;AACA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA;AAEb,QAAA,cAAc,GAAW,EAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Context } from '../types';
2
+ export declare const retrieveKnowledge: import("@openai/agents").FunctionTool<Context, any, any>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retrieveKnowledge = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const agents_1 = require("@openai/agents");
6
+ const zod_1 = require("zod");
7
+ const hubtype_api_client_1 = require("../hubtype-api-client");
8
+ exports.retrieveKnowledge = (0, agents_1.tool)({
9
+ name: 'retrieve_knowledge',
10
+ description: 'Consult the knowledge base for information before answering. Use this tool to make sure the information you provide is faithful.',
11
+ parameters: zod_1.z.object({
12
+ query: zod_1.z.string().describe('The query to search the knowledge base for'),
13
+ }),
14
+ execute: ({ query }, runContext) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
15
+ const context = runContext === null || runContext === void 0 ? void 0 : runContext.context;
16
+ if (!context) {
17
+ throw new Error('Context is required');
18
+ }
19
+ const sources = context.sources;
20
+ const client = new hubtype_api_client_1.HubtypeApiClient(context.authToken);
21
+ const chunks = yield client.retrieveSimilarChunks(query, sources);
22
+ return chunks;
23
+ }),
24
+ });
25
+ //# sourceMappingURL=retrieve-knowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retrieve-knowledge.js","sourceRoot":"","sources":["../../../src/tools/retrieve-knowledge.ts"],"names":[],"mappings":";;;;AAAA,2CAAiD;AACjD,6BAAuB;AAEvB,8DAAwD;AAG3C,QAAA,iBAAiB,GAAG,IAAA,aAAI,EAAoB;IACvD,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,CACP,EAAE,KAAK,EAAqB,EAC5B,UAAgC,EACb,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,CAAA;QACnC,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;SACvC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC/B,MAAM,MAAM,GAAG,IAAI,qCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACjE,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;CACF,CAAC,CAAA"}
@@ -1,9 +1,10 @@
1
- import { AgenticOutputMessage, InferenceResponse, RunResult } from '@botonic/core';
1
+ import { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult } from '@botonic/core';
2
2
  import { Agent, AgentInputItem, RunContext as OpenAIRunContext, Tool as OpenAITool } from '@openai/agents';
3
3
  import { ZodSchema } from 'zod';
4
4
  import { OutputSchema } from './structured-output';
5
5
  export interface Context {
6
6
  authToken: string;
7
+ sources: string[];
7
8
  }
8
9
  export type RunContext = OpenAIRunContext<Context>;
9
10
  export interface CustomTool {
@@ -12,10 +13,6 @@ export interface CustomTool {
12
13
  schema: ZodSchema;
13
14
  func: (input?: any, runContext?: RunContext) => Promise<any>;
14
15
  }
15
- export interface GuardrailRule {
16
- name: string;
17
- description: string;
18
- }
19
16
  export type ContactInfo = Record<string, string>;
20
17
  export type Tool = OpenAITool<Context>;
21
18
  export type AIAgent = Agent<Context, typeof OutputSchema>;
@@ -23,13 +20,5 @@ export interface PluginAiAgentOptions {
23
20
  authToken?: string;
24
21
  customTools?: CustomTool[];
25
22
  }
26
- export interface AiAgentArgs {
27
- name: string;
28
- instructions: string;
29
- activeTools?: {
30
- name: string;
31
- }[];
32
- inputGuardrailRules?: GuardrailRule[];
33
- }
34
23
  export type AgenticInputMessage = AgentInputItem;
35
- export type { AgenticOutputMessage, InferenceResponse, RunResult };
24
+ export { AgenticOutputMessage, AiAgentArgs, GuardrailRule, InferenceResponse, RunResult, };
@@ -4,7 +4,7 @@ export declare class AIAgentBuilder {
4
4
  private instructions;
5
5
  private tools;
6
6
  private inputGuardrails;
7
- constructor(name: string, instructions: string, tools: Tool[], contactInfo: ContactInfo, inputGuardrailRules: GuardrailRule[]);
7
+ constructor(name: string, instructions: string, tools: Tool[], contactInfo: ContactInfo, inputGuardrailRules: GuardrailRule[], sourceIds: string[]);
8
8
  build(): AIAgent;
9
9
  private addExtraInstructions;
10
10
  private getContactInfoInstructions;
@@ -1,12 +1,12 @@
1
1
  import { Agent } from '@openai/agents';
2
2
  import { createInputGuardrail } from './guardrails';
3
3
  import { OutputSchema } from './structured-output';
4
- import { mandatoryTools } from './tools';
4
+ import { mandatoryTools, retrieveKnowledge } from './tools';
5
5
  export class AIAgentBuilder {
6
- constructor(name, instructions, tools, contactInfo, inputGuardrailRules) {
6
+ constructor(name, instructions, tools, contactInfo, inputGuardrailRules, sourceIds) {
7
7
  this.name = name;
8
8
  this.instructions = this.addExtraInstructions(instructions, contactInfo);
9
- this.tools = this.addHubtypeTools(tools);
9
+ this.tools = this.addHubtypeTools(tools, sourceIds);
10
10
  this.inputGuardrails = [];
11
11
  if (inputGuardrailRules.length > 0) {
12
12
  const inputGuardrail = createInputGuardrail(inputGuardrailRules);
@@ -14,6 +14,10 @@ export class AIAgentBuilder {
14
14
  }
15
15
  }
16
16
  build() {
17
+ const modelSettings = {};
18
+ if (this.tools.includes(retrieveKnowledge)) {
19
+ modelSettings.toolChoice = retrieveKnowledge.name;
20
+ }
17
21
  return new Agent({
18
22
  name: this.name,
19
23
  instructions: this.instructions,
@@ -21,6 +25,7 @@ export class AIAgentBuilder {
21
25
  outputType: OutputSchema,
22
26
  inputGuardrails: this.inputGuardrails,
23
27
  outputGuardrails: [],
28
+ modelSettings,
24
29
  });
25
30
  }
26
31
  addExtraInstructions(initialInstructions, contactInfo) {
@@ -54,8 +59,11 @@ export class AIAgentBuilder {
54
59
  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>`;
55
60
  return `<output>\n${output}\n</output>`;
56
61
  }
57
- addHubtypeTools(tools) {
62
+ addHubtypeTools(tools, sourceIds) {
58
63
  const hubtypeTools = [...mandatoryTools];
64
+ if (sourceIds.length > 0) {
65
+ hubtypeTools.push(retrieveKnowledge);
66
+ }
59
67
  return [...hubtypeTools, ...tools];
60
68
  }
61
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../src/agent-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxC,MAAM,OAAO,cAAc;IAMzB,YACE,IAAY,EACZ,YAAoB,EACpB,KAAa,EACb,WAAwB,EACxB,mBAAoC;QAEpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;QACxE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;QACxC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAA;QACzB,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,MAAM,cAAc,GAAG,oBAAoB,CAAC,mBAAmB,CAAC,CAAA;YAChE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;SAC1C;IACH,CAAC;IAED,KAAK;QACH,OAAO,IAAI,KAAK,CAAC;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,YAAY;YACxB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,gBAAgB,EAAE,EAAE;SACrB,CAAC,CAAA;IACJ,CAAC;IAEO,oBAAoB,CAC1B,mBAA2B,EAC3B,WAA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,GAAG,cAAc,CAAC,CAAA;QAChD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;SACrC;QACD,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC,CAAA;IACpC,CAAC;CACF"}
@@ -3,6 +3,7 @@ import { AgenticInputMessage } from './types';
3
3
  export declare class HubtypeApiClient {
4
4
  private readonly authToken;
5
5
  constructor(authToken: string);
6
+ retrieveSimilarChunks(query: string, sources: string[]): Promise<string[]>;
6
7
  getLocalMessages(maxMemoryLength: number): Promise<AgenticInputMessage[]>;
7
8
  getMessages(request: BotContext, maxMemoryLength: number): Promise<AgenticInputMessage[]>;
8
9
  private formatMessage;