@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
## 2.23.0 (2026-03-23)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 2.22.1 (2026-03-19)
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- try to improve CI speed ([#751](https://github.com/metis-ai/hubtype-product/pull/751))
|
|
10
|
+
|
|
11
|
+
### ❤️ Thank You
|
|
12
|
+
|
|
13
|
+
- Marc Rabat @vanbasten17
|
|
14
|
+
|
|
15
|
+
## 2.22.0 (2026-03-16)
|
|
16
|
+
|
|
17
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
18
|
+
|
|
19
|
+
## 2.21.0 (2026-03-16)
|
|
20
|
+
|
|
21
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
22
|
+
|
|
23
|
+
## 2.20.0 (2026-03-13)
|
|
24
|
+
|
|
25
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
26
|
+
|
|
27
|
+
## 2.19.0 (2026-03-12)
|
|
28
|
+
|
|
29
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
30
|
+
|
|
31
|
+
## 2.18.0 (2026-03-04)
|
|
32
|
+
|
|
33
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
34
|
+
|
|
35
|
+
## 2.17.0 (2026-03-02)
|
|
36
|
+
|
|
37
|
+
### 🚀 Features
|
|
38
|
+
|
|
39
|
+
- botonic working with v2 input format ([#660](https://github.com/metis-ai/hubtype-product/pull/660))
|
|
40
|
+
|
|
41
|
+
### ❤️ Thank You
|
|
42
|
+
|
|
43
|
+
- Marc Rabat @vanbasten17
|
|
44
|
+
|
|
45
|
+
## 2.16.0 (2026-02-23)
|
|
46
|
+
|
|
47
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
48
|
+
|
|
49
|
+
## 2.15.0 (2026-02-13)
|
|
50
|
+
|
|
51
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
52
|
+
|
|
53
|
+
## 2.14.0 (2026-02-05)
|
|
54
|
+
|
|
55
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
56
|
+
|
|
57
|
+
## 2.13.4 (2026-02-02)
|
|
58
|
+
|
|
59
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
60
|
+
|
|
61
|
+
## 2.13.3 (2026-01-30)
|
|
62
|
+
|
|
63
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
64
|
+
|
|
65
|
+
## 2.13.2 (2026-01-30)
|
|
66
|
+
|
|
67
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
68
|
+
|
|
69
|
+
## 2.13.1 (2026-01-30)
|
|
70
|
+
|
|
71
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
72
|
+
|
|
73
|
+
## 2.13.0 (2026-01-29)
|
|
74
|
+
|
|
75
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
76
|
+
|
|
77
|
+
## 2.12.0 (2026-01-28)
|
|
78
|
+
|
|
79
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
80
|
+
|
|
81
|
+
## 2.11.5 (2026-01-28)
|
|
82
|
+
|
|
83
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
84
|
+
|
|
85
|
+
## 2.11.4 (2026-01-28)
|
|
86
|
+
|
|
87
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
88
|
+
|
|
89
|
+
## 2.11.3 (2026-01-28)
|
|
90
|
+
|
|
91
|
+
### 🩹 Fixes
|
|
92
|
+
|
|
93
|
+
- update entrypoints to use .js and .d.ts extensions for module and types ([#552](https://github.com/metis-ai/hubtype-product/pull/552))
|
|
94
|
+
|
|
95
|
+
### ❤️ Thank You
|
|
96
|
+
|
|
97
|
+
- David Hidalgo @Davidhidalgo
|
|
98
|
+
|
|
99
|
+
## 2.11.2 (2026-01-21)
|
|
100
|
+
|
|
101
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
102
|
+
|
|
103
|
+
## 2.11.1 (2026-01-21)
|
|
104
|
+
|
|
105
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
106
|
+
|
|
107
|
+
## 2.11.0 (2026-01-21)
|
|
108
|
+
|
|
109
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
110
|
+
|
|
111
|
+
## 2.10.1 (2026-01-19)
|
|
112
|
+
|
|
113
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
114
|
+
|
|
115
|
+
## 2.10.0 (2026-01-18)
|
|
116
|
+
|
|
117
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
118
|
+
|
|
119
|
+
## 2.9.1 (2026-01-17)
|
|
120
|
+
|
|
121
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
122
|
+
|
|
123
|
+
## 2.9.0 (2026-01-17)
|
|
124
|
+
|
|
125
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
126
|
+
|
|
127
|
+
## 2.8.1 (2026-01-16)
|
|
128
|
+
|
|
129
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
130
|
+
|
|
131
|
+
## 2.8.0 (2026-01-16)
|
|
132
|
+
|
|
133
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
134
|
+
|
|
135
|
+
## 2.7.1 (2026-01-16)
|
|
136
|
+
|
|
137
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
138
|
+
|
|
139
|
+
## 2.7.0 (2026-01-15)
|
|
140
|
+
|
|
141
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
142
|
+
|
|
143
|
+
## 2.6.0 (2025-12-09)
|
|
144
|
+
|
|
145
|
+
### 🚀 Features
|
|
146
|
+
|
|
147
|
+
- plugin-flow-builder enable SmartIntents and add tests ([#469](https://github.com/metis-ai/hubtype-product/pull/469))
|
|
148
|
+
|
|
149
|
+
### ❤️ Thank You
|
|
150
|
+
|
|
151
|
+
- Oriol Raventós @Iru89
|
|
152
|
+
|
|
153
|
+
## 2.5.0 (2025-12-09)
|
|
154
|
+
|
|
155
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
156
|
+
|
|
157
|
+
## 2.4.1 (2025-12-08)
|
|
158
|
+
|
|
159
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
160
|
+
|
|
161
|
+
## 2.4.0 (2025-12-05)
|
|
162
|
+
|
|
163
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
164
|
+
|
|
165
|
+
## 2.3.3 (2025-12-04)
|
|
166
|
+
|
|
167
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
168
|
+
|
|
169
|
+
## 2.3.2 (2025-12-04)
|
|
170
|
+
|
|
171
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
172
|
+
|
|
173
|
+
## 2.3.1 (2025-12-04)
|
|
174
|
+
|
|
175
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
176
|
+
|
|
177
|
+
## 2.3.0 (2025-12-04)
|
|
178
|
+
|
|
179
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
180
|
+
|
|
181
|
+
## 2.2.1 (2025-12-04)
|
|
182
|
+
|
|
183
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
|
184
|
+
|
|
185
|
+
## 2.2.0 (2025-12-04)
|
|
186
|
+
|
|
187
|
+
### 🚀 Features
|
|
188
|
+
|
|
189
|
+
- add custom tool and bot action ([#452](https://github.com/metis-ai/hubtype-product/pull/452))
|
|
190
|
+
- fine tuning botonic release #BLT-2010 ([#428](https://github.com/metis-ai/hubtype-product/pull/428))
|
|
191
|
+
|
|
192
|
+
### ❤️ Thank You
|
|
193
|
+
|
|
194
|
+
- David Hidalgo @Davidhidalgo
|
|
195
|
+
- Oriol Raventós @Iru89
|
|
196
|
+
|
|
197
|
+
## 2.1.0 (2025-12-02)
|
|
198
|
+
|
|
199
|
+
### 🚀 Features
|
|
200
|
+
|
|
201
|
+
- fine tuning botonic release #BLT-2010 ([#428](https://github.com/metis-ai/hubtype-product/pull/428))
|
|
202
|
+
|
|
203
|
+
### ❤️ Thank You
|
|
204
|
+
|
|
205
|
+
- David Hidalgo @Davidhidalgo
|
|
206
|
+
|
|
207
|
+
## 2.0.1-alpha.0 (2025-11-27)
|
|
208
|
+
|
|
209
|
+
This was a version bump only for @botonic/plugin-ai-agents to align it with other projects, there were no code changes.
|
package/package.json
CHANGED
|
@@ -1,50 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-ai-agents",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"lint": "biome check --write src/ tests/",
|
|
13
|
-
"lint:check": "biome check src/ tests/",
|
|
14
|
-
"format": "biome format --write src/ tests/"
|
|
3
|
+
"version": "2.23.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"module": "./src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
|
+
"import": "./src/index.js"
|
|
11
|
+
}
|
|
15
12
|
},
|
|
16
13
|
"dependencies": {
|
|
17
|
-
"@botonic/
|
|
14
|
+
"@botonic/shared": "2.23.0",
|
|
18
15
|
"@openai/agents": "^0.3.9",
|
|
19
|
-
"axios": "^1.13.6",
|
|
20
16
|
"openai": "^6.0.0",
|
|
21
|
-
"
|
|
22
|
-
"zod": "3.25.76"
|
|
23
|
-
"zod-to-json-schema": "^3.25.1"
|
|
17
|
+
"tslib": "^2.3.0",
|
|
18
|
+
"zod": "^3.25.76"
|
|
24
19
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
"references": [
|
|
21
|
+
{
|
|
22
|
+
"path": "../core/tsconfig.lib.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "../shared/tsconfig.lib.json"
|
|
26
|
+
}
|
|
32
27
|
],
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"npm": ">=10.0.0"
|
|
36
|
-
},
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/hubtype/botonic.git"
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
40
30
|
},
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"chatbot",
|
|
44
|
-
"ai-agents",
|
|
45
|
-
"conversational-app",
|
|
46
|
-
"typescript",
|
|
47
|
-
"javascript"
|
|
48
|
-
],
|
|
49
|
-
"author": ""
|
|
50
|
-
}
|
|
31
|
+
"main": "./src/index.js"
|
|
32
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/botonic/plugin-ai-agents/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;AAC7C,cAAc,aAAa,CAAA"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { CampaignV2, ContactInfo, ResolvedPlugins } from '@botonic/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import type { LLMConfig } from './llm-config';
|
|
6
|
-
import type { AIAgent, GuardrailRule, Tool } from './types';
|
|
7
|
-
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> {
|
|
1
|
+
import type { CampaignV2, ContactInfo, ResolvedPlugins, UserExtraData } from '@botonic/shared';
|
|
2
|
+
import { DebugLogger } from './debug-logger';
|
|
3
|
+
import { AIAgent, GuardrailRule, Tool } from './types';
|
|
4
|
+
interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData extends UserExtraData = UserExtraData> {
|
|
8
5
|
name: string;
|
|
9
6
|
instructions: string;
|
|
10
7
|
tools: Tool<TPlugins, TExtraData>[];
|
|
@@ -12,18 +9,13 @@ interface AIAgentBuilderOptions<TPlugins extends ResolvedPlugins = ResolvedPlugi
|
|
|
12
9
|
contactInfo: ContactInfo[];
|
|
13
10
|
inputGuardrailRules: GuardrailRule[];
|
|
14
11
|
sourceIds: string[];
|
|
15
|
-
outputMessagesSchemas?: z.ZodObject<any>[];
|
|
16
|
-
llmConfig: LLMConfig;
|
|
17
12
|
logger: DebugLogger;
|
|
18
|
-
guardrailTrackingContext: GuardrailTrackingContext;
|
|
19
13
|
}
|
|
20
|
-
export declare class AIAgentBuilder<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData =
|
|
14
|
+
export declare class AIAgentBuilder<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData extends UserExtraData = UserExtraData> {
|
|
21
15
|
private name;
|
|
22
16
|
private instructions;
|
|
23
17
|
private tools;
|
|
24
|
-
private externalOutputMessagesSchemas;
|
|
25
18
|
private inputGuardrails;
|
|
26
|
-
llmConfig: LLMConfig;
|
|
27
19
|
private logger;
|
|
28
20
|
constructor(options: AIAgentBuilderOptions<TPlugins, TExtraData>);
|
|
29
21
|
build(): AIAgent<TPlugins, TExtraData>;
|
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const structured_output_1 = require("./structured-output");
|
|
8
|
-
const tools_1 = require("./tools");
|
|
9
|
-
class AIAgentBuilder {
|
|
1
|
+
import { Agent, } from '@openai/agents';
|
|
2
|
+
import { OPENAI_MODEL, OPENAI_PROVIDER } from './constants';
|
|
3
|
+
import { createInputGuardrail } from './guardrails';
|
|
4
|
+
import { OutputSchema } from './structured-output';
|
|
5
|
+
import { mandatoryTools, retrieveKnowledge } from './tools';
|
|
6
|
+
export class AIAgentBuilder {
|
|
10
7
|
constructor(options) {
|
|
11
8
|
this.name = options.name;
|
|
12
9
|
this.instructions = this.addExtraInstructions(options.instructions, options.contactInfo, options.campaignsContext);
|
|
13
10
|
this.tools = this.addHubtypeTools(options.tools, options.sourceIds);
|
|
14
|
-
this.externalOutputMessagesSchemas = options.outputMessagesSchemas || [];
|
|
15
11
|
this.inputGuardrails = [];
|
|
16
|
-
this.llmConfig = options.llmConfig;
|
|
17
12
|
this.logger = options.logger;
|
|
18
13
|
if (options.inputGuardrailRules.length > 0) {
|
|
19
|
-
const inputGuardrail =
|
|
14
|
+
const inputGuardrail = createInputGuardrail(options.inputGuardrailRules);
|
|
20
15
|
this.inputGuardrails.push(inputGuardrail);
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
build() {
|
|
19
|
+
const modelSettings = {};
|
|
20
|
+
if (OPENAI_PROVIDER === 'openai') {
|
|
21
|
+
modelSettings.reasoning = { effort: 'none' }; // Specific to OpenAI API
|
|
22
|
+
modelSettings.text = { verbosity: 'medium' };
|
|
23
|
+
}
|
|
24
|
+
const hasRetrieveKnowledge = this.tools.some(t => t.name === retrieveKnowledge.name);
|
|
25
|
+
if (hasRetrieveKnowledge && OPENAI_PROVIDER === 'azure') {
|
|
26
|
+
modelSettings.toolChoice = retrieveKnowledge.name;
|
|
27
|
+
}
|
|
24
28
|
// When using standard OpenAI API, we need to specify the model
|
|
25
29
|
// Azure OpenAI uses deployment name instead
|
|
26
|
-
const model =
|
|
27
|
-
const hasRetrieveKnowledge = this.tools.includes(tools_1.retrieveKnowledge);
|
|
30
|
+
const model = OPENAI_PROVIDER === 'openai' ? OPENAI_MODEL : undefined;
|
|
28
31
|
this.logger.logModelSettings({
|
|
29
|
-
provider:
|
|
32
|
+
provider: OPENAI_PROVIDER,
|
|
30
33
|
model,
|
|
31
|
-
reasoning:
|
|
32
|
-
text:
|
|
33
|
-
toolChoice:
|
|
34
|
+
reasoning: modelSettings.reasoning,
|
|
35
|
+
text: modelSettings.text,
|
|
36
|
+
toolChoice: modelSettings.toolChoice,
|
|
34
37
|
hasRetrieveKnowledge,
|
|
35
38
|
});
|
|
36
|
-
return new
|
|
39
|
+
return new Agent({
|
|
37
40
|
name: this.name,
|
|
38
41
|
model,
|
|
39
42
|
instructions: this.instructions,
|
|
40
43
|
tools: this.tools,
|
|
41
|
-
outputType:
|
|
44
|
+
outputType: OutputSchema,
|
|
42
45
|
inputGuardrails: this.inputGuardrails,
|
|
43
46
|
outputGuardrails: [],
|
|
47
|
+
modelSettings,
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
50
|
addExtraInstructions(initialInstructions, contactInfo, campaignsContext) {
|
|
@@ -95,12 +99,13 @@ class AIAgentBuilder {
|
|
|
95
99
|
return `<output>\n${output}\n</output>`;
|
|
96
100
|
}
|
|
97
101
|
addHubtypeTools(tools, sourceIds) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
// Cast needed: mandatoryTools/retrieveKnowledge are Tool<ResolvedPlugins, ExtraData> at runtime but compatible with Tool<TPlugins, TExtraData>
|
|
103
|
+
const hubtypeTools = [
|
|
104
|
+
...mandatoryTools,
|
|
105
|
+
...(sourceIds.length > 0 ? [retrieveKnowledge] : []),
|
|
106
|
+
...tools,
|
|
107
|
+
];
|
|
108
|
+
return hubtypeTools;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
|
-
exports.AIAgentBuilder = AIAgentBuilder;
|
|
106
111
|
//# sourceMappingURL=agent-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-builder.js","sourceRoot":"","sources":["../../../../../../libs/botonic/plugin-ai-agents/src/lib/agent-builder.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,GAIN,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,YAAY,EAA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AC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAA;QAC7L,OAAO,aAAa,MAAM,aAAa,CAAA;IACzC,CAAC;IAEO,eAAe,CACrB,KAAmC,EACnC,SAAmB;QAEnB,+IAA+I;QAC/I,MAAM,YAAY,GAAG;YACnB,GAAG,cAAc;YACjB,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACpD,GAAG,KAAK;SACuB,CAAA;QACjC,OAAO,YAAY,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -4,8 +4,6 @@ export declare const OPENAI_MODEL: string;
|
|
|
4
4
|
export declare const OPENAI_PROVIDER: 'openai' | 'azure';
|
|
5
5
|
export declare const AZURE_OPENAI_API_KEY: string | undefined;
|
|
6
6
|
export declare const AZURE_OPENAI_API_BASE: string | undefined;
|
|
7
|
+
export declare const AZURE_OPENAI_API_DEPLOYMENT_NAME: string;
|
|
7
8
|
export declare const AZURE_OPENAI_API_VERSION: string;
|
|
8
|
-
export declare const isProd: boolean;
|
|
9
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2
|
+
export const HUBTYPE_API_URL = ((_a = import.meta.env) === null || _a === void 0 ? void 0 : _a['VITE_HUBTYPE_API_URL']) || 'https://api.hubtype.com';
|
|
3
|
+
// OpenAI Provider Configuration
|
|
4
|
+
export const OPENAI_API_KEY = (_b = import.meta.env) === null || _b === void 0 ? void 0 : _b['VITE_OPENAI_API_KEY']; // pragma: allowlist secret
|
|
5
|
+
export const OPENAI_MODEL = ((_c = import.meta.env) === null || _c === void 0 ? void 0 : _c['VITE_OPENAI_MODEL']) || 'gpt-4.1-mini';
|
|
6
|
+
export const OPENAI_PROVIDER = ((_d = import.meta.env) === null || _d === void 0 ? void 0 : _d['VITE_OPENAI_PROVIDER']) || 'azure';
|
|
7
|
+
// Azure OpenAI Configuration
|
|
8
|
+
export const AZURE_OPENAI_API_KEY = (_e = import.meta.env) === null || _e === void 0 ? void 0 : _e['VITE_AZURE_OPENAI_API_KEY']; // pragma: allowlist secret
|
|
9
|
+
export const AZURE_OPENAI_API_BASE = (_f = import.meta.env) === null || _f === void 0 ? void 0 : _f['VITE_AZURE_OPENAI_API_BASE'];
|
|
10
|
+
export const AZURE_OPENAI_API_DEPLOYMENT_NAME = ((_g = import.meta.env) === null || _g === void 0 ? void 0 : _g['VITE_AZURE_OPENAI_API_DEPLOYMENT_NAME']) || 'gpt-41-mini_p1';
|
|
11
|
+
export const AZURE_OPENAI_API_VERSION = ((_h = import.meta.env) === null || _h === void 0 ? void 0 : _h['VITE_AZURE_OPENAI_API_VERSION']) || '2025-01-01-preview';
|
|
12
|
+
export const MAX_MEMORY_LENGTH = 25;
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../libs/botonic/plugin-ai-agents/src/lib/constants.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,sBAAsB,CAAC,KAAI,yBAAyB,CAAA;AAExE,gCAAgC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,qBAAqB,CAAC,CAAA,CAAC,2BAA2B;AAClG,MAAM,CAAC,MAAM,YAAY,GACvB,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,mBAAmB,CAAC,KAAI,cAAc,CAAA;AAC1D,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAC,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,sBAAsB,CAAwB,KAAI,OAAO,CAAA;AAE9E,6BAA6B;AAC7B,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CACjD,2BAA2B,CAC5B,CAAA,CAAC,2BAA2B;AAC7B,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAClD,4BAA4B,CAC7B,CAAA;AACD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,uCAAuC,CAAC,KAAI,gBAAgB,CAAA;AAChF,MAAM,CAAC,MAAM,wBAAwB,GACnC,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAG,+BAA+B,CAAC,KAAI,oBAAoB,CAAA;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
1
|
+
import { AiAgentArgs } from '@botonic/shared';
|
|
2
|
+
import { AgenticInputMessage, MemoryOptions, RunResult } from './types';
|
|
4
3
|
export interface DebugLoggerConfig {
|
|
5
4
|
messageHistoryApiVersion: string;
|
|
6
5
|
maxRetries: number;
|
|
@@ -24,10 +23,9 @@ export interface DebugLogger {
|
|
|
24
23
|
logInitialConfig(config: DebugLoggerConfig): void;
|
|
25
24
|
logAgentDebugInfo(aiAgentArgs: AiAgentArgs, toolNames: string[], messages: AgenticInputMessage[]): void;
|
|
26
25
|
logModelSettings(settings: ModelSettingsInfo): void;
|
|
27
|
-
logRunnerStart(
|
|
26
|
+
logRunnerStart(): void;
|
|
28
27
|
logRunResult(runResult: RunResult, startTime: number): void;
|
|
29
28
|
logGuardrailTriggered(): void;
|
|
30
29
|
logRunnerError(startTime: number, error: unknown): void;
|
|
31
|
-
logToolExecution(toolExecution: ToolExecution): void;
|
|
32
30
|
}
|
|
33
31
|
export declare function createDebugLogger(enableDebug: boolean): DebugLogger;
|
|
@@ -1,31 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDebugLogger = createDebugLogger;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
1
|
+
import { AZURE_OPENAI_API_BASE, AZURE_OPENAI_API_DEPLOYMENT_NAME, MAX_MEMORY_LENGTH, OPENAI_MODEL, OPENAI_PROVIDER, } from './constants';
|
|
5
2
|
const PREFIX = '[BotonicPluginAiAgents]';
|
|
6
3
|
class EnabledDebugLogger {
|
|
4
|
+
getModelInfo() {
|
|
5
|
+
const model = OPENAI_PROVIDER === 'azure'
|
|
6
|
+
? AZURE_OPENAI_API_DEPLOYMENT_NAME
|
|
7
|
+
: OPENAI_MODEL;
|
|
8
|
+
const apiBase = OPENAI_PROVIDER === 'azure' && AZURE_OPENAI_API_BASE
|
|
9
|
+
? AZURE_OPENAI_API_BASE
|
|
10
|
+
: 'OpenAI API';
|
|
11
|
+
return { model, apiBase };
|
|
12
|
+
}
|
|
7
13
|
logInitialConfig(config) {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const { model, apiBase } = this.getModelInfo();
|
|
8
16
|
console.log(`${PREFIX} === Plugin Initialization ===`);
|
|
9
|
-
console.log(`${PREFIX} Provider: ${
|
|
17
|
+
console.log(`${PREFIX} Provider: ${OPENAI_PROVIDER}`);
|
|
18
|
+
console.log(`${PREFIX} Model/Deployment: ${model}`);
|
|
19
|
+
console.log(`${PREFIX} API Base: ${apiBase}`);
|
|
10
20
|
console.log(`${PREFIX} Message History API Version: ${config.messageHistoryApiVersion}`);
|
|
11
21
|
console.log(`${PREFIX} Max Retries: ${config.maxRetries}`);
|
|
12
22
|
console.log(`${PREFIX} Timeout: ${config.timeout}ms`);
|
|
13
23
|
console.log(`${PREFIX} Custom Tools Registered: ${config.customToolNames.join(', ') || 'none'}`);
|
|
14
24
|
console.log(`${PREFIX} Memory Options:`, {
|
|
15
|
-
maxMessages: config.memory.maxMessages
|
|
16
|
-
includeToolCalls: config.memory.includeToolCalls
|
|
17
|
-
maxFullToolResults: config.memory.maxFullToolResults
|
|
18
|
-
debugMode: config.memory.debugMode
|
|
25
|
+
maxMessages: (_a = config.memory.maxMessages) !== null && _a !== void 0 ? _a : MAX_MEMORY_LENGTH,
|
|
26
|
+
includeToolCalls: (_b = config.memory.includeToolCalls) !== null && _b !== void 0 ? _b : true,
|
|
27
|
+
maxFullToolResults: (_c = config.memory.maxFullToolResults) !== null && _c !== void 0 ? _c : 1,
|
|
28
|
+
debugMode: (_d = config.memory.debugMode) !== null && _d !== void 0 ? _d : false,
|
|
19
29
|
});
|
|
20
30
|
console.log(`${PREFIX} === End Plugin Initialization ===`);
|
|
21
31
|
}
|
|
22
32
|
logAgentDebugInfo(aiAgentArgs, toolNames, messages) {
|
|
33
|
+
var _a;
|
|
23
34
|
console.log(`${PREFIX} === AI Agent Debug Info ===`);
|
|
24
35
|
console.log(`${PREFIX} Agent Name: ${aiAgentArgs.name}`);
|
|
25
36
|
console.log(`${PREFIX} Active Tools: ${JSON.stringify(toolNames)}`);
|
|
26
37
|
console.log(`${PREFIX} Source IDs: ${JSON.stringify(aiAgentArgs.sourceIds || [])}`);
|
|
27
38
|
console.log(`${PREFIX} Message History Count: ${messages.length}`);
|
|
28
|
-
console.log(`${PREFIX} Input Guardrail Rules: ${aiAgentArgs.inputGuardrailRules
|
|
39
|
+
console.log(`${PREFIX} Input Guardrail Rules: ${((_a = aiAgentArgs.inputGuardrailRules) === null || _a === void 0 ? void 0 : _a.length) || 0}`);
|
|
29
40
|
console.log(`${PREFIX} Instructions:`);
|
|
30
41
|
console.log(aiAgentArgs.instructions);
|
|
31
42
|
console.log(`${PREFIX} === End Debug Info ===`);
|
|
@@ -44,10 +55,8 @@ class EnabledDebugLogger {
|
|
|
44
55
|
}
|
|
45
56
|
console.log(`${PREFIX} === End Model Settings ===`);
|
|
46
57
|
}
|
|
47
|
-
logRunnerStart(
|
|
58
|
+
logRunnerStart() {
|
|
48
59
|
console.log(`${PREFIX} === Runner Execution Start ===`);
|
|
49
|
-
console.log(`${PREFIX} Model: ${model}`);
|
|
50
|
-
console.log(`${PREFIX} Model Settings: ${JSON.stringify(modelSettings)}`);
|
|
51
60
|
}
|
|
52
61
|
logRunResult(runResult, startTime) {
|
|
53
62
|
const elapsedMs = Date.now() - startTime;
|
|
@@ -73,25 +82,31 @@ class EnabledDebugLogger {
|
|
|
73
82
|
console.log(`${PREFIX} Runner execution failed after ${elapsedMs}ms`);
|
|
74
83
|
console.log(`${PREFIX} Error:`, error);
|
|
75
84
|
}
|
|
76
|
-
logToolExecution(toolExecution) {
|
|
77
|
-
console.log(`${PREFIX} Tool Execution: ${toolExecution.toolName}`);
|
|
78
|
-
console.log(`${PREFIX} Tool Arguments: ${JSON.stringify(toolExecution.toolArguments)}`);
|
|
79
|
-
console.log(`${PREFIX} Tool Results: ${toolExecution.toolResults}`);
|
|
80
|
-
console.log(`${PREFIX} Knowledgebase Sources IDs: ${JSON.stringify(toolExecution.knowledgebaseSourcesIds)}`);
|
|
81
|
-
console.log(`${PREFIX} Knowledgebase Chunks IDs: ${JSON.stringify(toolExecution.knowledgebaseChunksIds)}`);
|
|
82
|
-
}
|
|
83
85
|
}
|
|
84
86
|
class DisabledDebugLogger {
|
|
85
|
-
logInitialConfig() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
logInitialConfig() {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
logAgentDebugInfo() {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
logModelSettings() {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
logRunnerStart() {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
logRunResult() {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
logGuardrailTriggered() {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
logRunnerError() {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
93
108
|
}
|
|
94
|
-
function createDebugLogger(enableDebug) {
|
|
109
|
+
export function createDebugLogger(enableDebug) {
|
|
95
110
|
return enableDebug ? new EnabledDebugLogger() : new DisabledDebugLogger();
|
|
96
111
|
}
|
|
97
112
|
//# sourceMappingURL=debug-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-logger.js","sourceRoot":"","sources":["../../../../../../libs/botonic/plugin-ai-agents/src/lib/debug-logger.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,MAAM,aAAa,CAAA;AAGpB,MAAM,MAAM,GAAG,yBAAyB,CAAA;AAiCxC,MAAM,kBAAkB;IACd,YAAY;QAClB,MAAM,KAAK,GACT,eAAe,KAAK,OAAO;YACzB,CAAC,CAAC,gCAAgC;YAClC,CAAC,CAAC,YAAY,CAAA;QAClB,MAAM,OAAO,GACX,eAAe,KAAK,OAAO,IAAI,qBAAqB;YAClD,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,YAAY,CAAA;QAClB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;IAC3B,CAAC;IAED,gBAAgB,CAAC,MAAyB;;QACxC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;QAE9C,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,gCAAgC,CAAC,CAAA;QACtD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,cAAc,eAAe,EAAE,CAAC,CAAA;QACrD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,sBAAsB,KAAK,EAAE,CAAC,CAAA;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AAG,MAAM,4BAA4B,CAAC,CAAA;IACpD,CAAC;IAED,cAAc,CAAC,SAAiB,EAAE,KAAc;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAA;QACxC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,kCAAkC,SAAS,IAAI,CAAC,CAAA;QACrE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,SAAS,EAAE,KAAK,CAAC,CAAA;IACxC,CAAC;CACF;AAED,MAAM,mBAAmB;IACvB,gBAAgB;QACd,OAAM;IACR,CAAC;IACD,iBAAiB;QACf,OAAM;IACR,CAAC;IACD,gBAAgB;QACd,OAAM;IACR,CAAC;IACD,cAAc;QACZ,OAAM;IACR,CAAC;IACD,YAAY;QACV,OAAM;IACR,CAAC;IACD,qBAAqB;QACnB,OAAM;IACR,CAAC;IACD,cAAc;QACZ,OAAM;IACR,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAoB;IACpD,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAA;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/botonic/plugin-ai-agents/src/lib/guardrails/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Agent, run } from '@openai/agents';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export function createInputGuardrail(rules) {
|
|
5
|
+
const outputType = z.object(Object.fromEntries(rules.map(rule => [rule.name, z.boolean().describe(rule.description)])));
|
|
6
|
+
const agent = new Agent({
|
|
7
|
+
name: 'InputGuardrail',
|
|
8
|
+
instructions: 'Check if the user triggers some of the following guardrails.',
|
|
9
|
+
outputType,
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
name: 'InputGuardrail',
|
|
13
|
+
execute: (_a) => __awaiter(this, [_a], void 0, function* ({ input, context }) {
|
|
14
|
+
const lastMessage = input[input.length - 1];
|
|
15
|
+
const result = yield run(agent, [lastMessage], { context });
|
|
16
|
+
const finalOutput = result.finalOutput;
|
|
17
|
+
if (finalOutput === undefined) {
|
|
18
|
+
throw new Error('Guardrail agent failed to produce output');
|
|
19
|
+
}
|
|
20
|
+
const triggered = Object.values(finalOutput).some(value => value === true);
|
|
21
|
+
const triggeredGuardrails = Object.keys(finalOutput).filter(key => finalOutput[key] === true);
|
|
22
|
+
return {
|
|
23
|
+
outputInfo: triggeredGuardrails,
|
|
24
|
+
tripwireTriggered: triggered,
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=input.js.map
|