@agentica/core 0.15.7 → 0.16.1

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 (195) hide show
  1. package/lib/Agentica.d.ts +21 -21
  2. package/lib/Agentica.js +29 -29
  3. package/lib/Agentica.js.map +1 -1
  4. package/lib/MicroAgentica.d.ts +115 -0
  5. package/lib/MicroAgentica.js +279 -0
  6. package/lib/MicroAgentica.js.map +1 -0
  7. package/lib/constants/AgenticaDefaultPrompt.d.ts +2 -1
  8. package/lib/constants/AgenticaDefaultPrompt.js +4 -4
  9. package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
  10. package/lib/context/AgenticaCancelPrompt.d.ts +3 -3
  11. package/lib/context/AgenticaContext.d.ts +12 -12
  12. package/lib/context/AgenticaOperationCollection.d.ts +1 -1
  13. package/lib/context/MicroAgenticaContext.d.ts +75 -0
  14. package/lib/{prompts/AgenticaCancelPrompt.js → context/MicroAgenticaContext.js} +1 -1
  15. package/lib/context/MicroAgenticaContext.js.map +1 -0
  16. package/lib/context/internal/AgenticaOperationComposer.d.ts +2 -1
  17. package/lib/context/internal/AgenticaOperationComposer.js +3 -2
  18. package/lib/context/internal/AgenticaOperationComposer.js.map +1 -1
  19. package/lib/context/internal/isAgenticaContext.d.ts +1 -0
  20. package/lib/context/internal/isAgenticaContext.js +10 -0
  21. package/lib/context/internal/isAgenticaContext.js.map +1 -0
  22. package/lib/events/AgenticaDescribeEvent.d.ts +4 -4
  23. package/lib/events/AgenticaEvent.d.ts +1 -0
  24. package/lib/events/AgenticaExecuteEvent.d.ts +5 -5
  25. package/lib/events/AgenticaSelectEvent.d.ts +2 -2
  26. package/lib/events/AgenticaTextEvent.d.ts +2 -2
  27. package/lib/events/MicroAgenticaEvent.d.ts +32 -0
  28. package/lib/{prompts/AgenticaTextPrompt.js → events/MicroAgenticaEvent.js} +1 -1
  29. package/lib/events/MicroAgenticaEvent.js.map +1 -0
  30. package/lib/factory/events.d.ts +2 -2
  31. package/lib/factory/events.js +5 -5
  32. package/lib/factory/events.js.map +1 -1
  33. package/lib/factory/histories.d.ts +33 -0
  34. package/lib/factory/{prompts.js → histories.js} +13 -13
  35. package/lib/factory/histories.js.map +1 -0
  36. package/lib/factory/index.d.ts +1 -1
  37. package/lib/factory/index.js +1 -1
  38. package/lib/factory/index.js.map +1 -1
  39. package/lib/functional/assertHttpLlmApplication.js +577 -387
  40. package/lib/functional/assertHttpLlmApplication.js.map +1 -1
  41. package/lib/functional/validateHttpLlmApplication.js +500 -348
  42. package/lib/functional/validateHttpLlmApplication.js.map +1 -1
  43. package/lib/histories/AgenticaCancelHistory.d.ts +8 -0
  44. package/lib/{prompts/AgenticaExecutePrompt.js → histories/AgenticaCancelHistory.js} +1 -1
  45. package/lib/histories/AgenticaCancelHistory.js.map +1 -0
  46. package/lib/histories/AgenticaDescribeHistory.d.ts +16 -0
  47. package/lib/histories/AgenticaDescribeHistory.js +3 -0
  48. package/lib/histories/AgenticaDescribeHistory.js.map +1 -0
  49. package/lib/{prompts/AgenticaExecutePrompt.d.ts → histories/AgenticaExecuteHistory.d.ts} +5 -5
  50. package/lib/{prompts/AgenticaDescribePrompt.js → histories/AgenticaExecuteHistory.js} +1 -1
  51. package/lib/histories/AgenticaExecuteHistory.js.map +1 -0
  52. package/lib/histories/AgenticaHistory.d.ts +17 -0
  53. package/lib/{prompts/AgenticaPrompt.js → histories/AgenticaHistory.js} +1 -1
  54. package/lib/histories/AgenticaHistory.js.map +1 -0
  55. package/lib/{prompts/AgenticaPromptBase.d.ts → histories/AgenticaHistoryBase.d.ts} +4 -4
  56. package/lib/{json/IAgenticaPromptJson.js → histories/AgenticaHistoryBase.js} +1 -1
  57. package/lib/histories/AgenticaHistoryBase.js.map +1 -0
  58. package/lib/histories/AgenticaSelectHistory.d.ts +8 -0
  59. package/lib/histories/AgenticaSelectHistory.js +3 -0
  60. package/lib/histories/AgenticaSelectHistory.js.map +1 -0
  61. package/lib/histories/AgenticaTextHistory.d.ts +6 -0
  62. package/lib/{prompts/AgenticaPromptBase.js → histories/AgenticaTextHistory.js} +1 -1
  63. package/lib/histories/AgenticaTextHistory.js.map +1 -0
  64. package/lib/histories/MicroAgenticaHistory.d.ts +13 -0
  65. package/lib/histories/MicroAgenticaHistory.js +3 -0
  66. package/lib/histories/MicroAgenticaHistory.js.map +1 -0
  67. package/lib/index.d.ts +12 -7
  68. package/lib/index.js +12 -7
  69. package/lib/index.js.map +1 -1
  70. package/lib/index.mjs +1408 -917
  71. package/lib/index.mjs.map +1 -1
  72. package/lib/json/IAgenticaEventJson.d.ts +6 -5
  73. package/lib/json/{IAgenticaPromptJson.d.ts → IAgenticaHistoryJson.d.ts} +8 -8
  74. package/lib/json/IAgenticaHistoryJson.js +3 -0
  75. package/lib/json/IAgenticaHistoryJson.js.map +1 -0
  76. package/lib/json/IAgenticaOperationSelectionJson.d.ts +7 -1
  77. package/lib/json/IMicroAgenticaEventJson.d.ts +13 -0
  78. package/lib/json/IMicroAgenticaEventJson.js +3 -0
  79. package/lib/json/IMicroAgenticaEventJson.js.map +1 -0
  80. package/lib/json/IMicroAgenticaHistoryJson.d.ts +19 -0
  81. package/lib/json/IMicroAgenticaHistoryJson.js +3 -0
  82. package/lib/json/IMicroAgenticaHistoryJson.js.map +1 -0
  83. package/lib/orchestrate/call.d.ts +4 -2
  84. package/lib/orchestrate/call.js +58 -49
  85. package/lib/orchestrate/call.js.map +1 -1
  86. package/lib/orchestrate/cancel.js +4 -4
  87. package/lib/orchestrate/cancel.js.map +1 -1
  88. package/lib/orchestrate/describe.d.ts +4 -3
  89. package/lib/orchestrate/describe.js +5 -5
  90. package/lib/orchestrate/describe.js.map +1 -1
  91. package/lib/orchestrate/execute.d.ts +2 -2
  92. package/lib/orchestrate/execute.js +1 -1
  93. package/lib/orchestrate/execute.js.map +1 -1
  94. package/lib/orchestrate/initialize.d.ts +2 -2
  95. package/lib/orchestrate/initialize.js +5 -5
  96. package/lib/orchestrate/initialize.js.map +1 -1
  97. package/lib/orchestrate/internal/selectFunction.d.ts +1 -5
  98. package/lib/orchestrate/internal/selectFunction.js +5 -2
  99. package/lib/orchestrate/internal/selectFunction.js.map +1 -1
  100. package/lib/orchestrate/select.d.ts +2 -2
  101. package/lib/orchestrate/select.js +5 -5
  102. package/lib/orchestrate/select.js.map +1 -1
  103. package/lib/structures/IAgenticaConfig.d.ts +6 -5
  104. package/lib/structures/IAgenticaController.d.ts +1 -1
  105. package/lib/structures/IAgenticaExecutor.d.ts +11 -9
  106. package/lib/structures/IAgenticaProps.d.ts +3 -3
  107. package/lib/structures/IAgenticaSystemPrompt.d.ts +13 -13
  108. package/lib/structures/IAgenticaVendor.d.ts +1 -1
  109. package/lib/structures/IMicroAgenticaConfig.d.ts +74 -0
  110. package/lib/structures/IMicroAgenticaConfig.js +3 -0
  111. package/lib/structures/IMicroAgenticaConfig.js.map +1 -0
  112. package/lib/structures/IMicroAgenticaExecutor.d.ts +57 -0
  113. package/lib/structures/IMicroAgenticaExecutor.js +3 -0
  114. package/lib/structures/IMicroAgenticaExecutor.js.map +1 -0
  115. package/lib/structures/IMicroAgenticaProps.d.ts +63 -0
  116. package/lib/structures/IMicroAgenticaProps.js +3 -0
  117. package/lib/structures/IMicroAgenticaProps.js.map +1 -0
  118. package/lib/structures/IMicroAgenticaSystemPrompt.d.ts +66 -0
  119. package/lib/structures/IMicroAgenticaSystemPrompt.js +3 -0
  120. package/lib/structures/IMicroAgenticaSystemPrompt.js.map +1 -0
  121. package/lib/transformers/AgenticaPromptTransformer.d.ts +19 -19
  122. package/lib/transformers/AgenticaPromptTransformer.js +27 -27
  123. package/lib/transformers/AgenticaPromptTransformer.js.map +1 -1
  124. package/package.json +7 -7
  125. package/src/Agentica.ts +36 -36
  126. package/src/MicroAgentica.ts +337 -0
  127. package/src/constants/AgenticaDefaultPrompt.ts +4 -2
  128. package/src/context/AgenticaCancelPrompt.ts +3 -3
  129. package/src/context/AgenticaContext.ts +12 -12
  130. package/src/context/AgenticaOperationCollection.ts +1 -1
  131. package/src/context/MicroAgenticaContext.ts +95 -0
  132. package/src/context/internal/AgenticaOperationComposer.ts +6 -3
  133. package/src/context/internal/isAgenticaContext.ts +13 -0
  134. package/src/events/AgenticaDescribeEvent.ts +4 -4
  135. package/src/events/AgenticaEvent.ts +6 -0
  136. package/src/events/AgenticaExecuteEvent.ts +5 -5
  137. package/src/events/AgenticaSelectEvent.ts +2 -2
  138. package/src/events/AgenticaTextEvent.ts +2 -2
  139. package/src/events/MicroAgenticaEvent.ts +41 -0
  140. package/src/factory/events.ts +8 -8
  141. package/src/factory/{prompts.ts → histories.ts} +18 -18
  142. package/src/factory/index.ts +1 -1
  143. package/src/histories/AgenticaCancelHistory.ts +13 -0
  144. package/src/histories/AgenticaDescribeHistory.ts +22 -0
  145. package/src/{prompts/AgenticaExecutePrompt.ts → histories/AgenticaExecuteHistory.ts} +7 -7
  146. package/src/histories/AgenticaHistory.ts +25 -0
  147. package/src/{prompts/AgenticaPromptBase.ts → histories/AgenticaHistoryBase.ts} +4 -4
  148. package/src/histories/AgenticaSelectHistory.ts +13 -0
  149. package/src/histories/AgenticaTextHistory.ts +10 -0
  150. package/src/histories/MicroAgenticaHistory.ts +18 -0
  151. package/src/index.ts +18 -15
  152. package/src/json/IAgenticaEventJson.ts +6 -5
  153. package/src/json/{IAgenticaPromptJson.ts → IAgenticaHistoryJson.ts} +13 -13
  154. package/src/json/IAgenticaOperationSelectionJson.ts +8 -1
  155. package/src/json/IMicroAgenticaEventJson.ts +21 -0
  156. package/src/json/IMicroAgenticaHistoryJson.ts +23 -0
  157. package/src/orchestrate/call.ts +91 -67
  158. package/src/orchestrate/cancel.ts +4 -4
  159. package/src/orchestrate/describe.ts +13 -9
  160. package/src/orchestrate/execute.ts +7 -7
  161. package/src/orchestrate/initialize.ts +8 -8
  162. package/src/orchestrate/internal/selectFunction.ts +5 -2
  163. package/src/orchestrate/select.ts +13 -13
  164. package/src/structures/IAgenticaConfig.ts +6 -5
  165. package/src/structures/IAgenticaController.ts +1 -1
  166. package/src/structures/IAgenticaExecutor.ts +12 -10
  167. package/src/structures/IAgenticaProps.ts +3 -3
  168. package/src/structures/IAgenticaSystemPrompt.ts +13 -13
  169. package/src/structures/IAgenticaVendor.ts +1 -1
  170. package/src/structures/IMicroAgenticaConfig.ts +82 -0
  171. package/src/structures/IMicroAgenticaExecutor.ts +63 -0
  172. package/src/structures/IMicroAgenticaProps.ts +70 -0
  173. package/src/structures/IMicroAgenticaSystemPrompt.ts +71 -0
  174. package/src/transformers/AgenticaPromptTransformer.ts +46 -46
  175. package/lib/factory/prompts.d.ts +0 -33
  176. package/lib/factory/prompts.js.map +0 -1
  177. package/lib/json/IAgenticaPromptJson.js.map +0 -1
  178. package/lib/prompts/AgenticaCancelPrompt.d.ts +0 -8
  179. package/lib/prompts/AgenticaCancelPrompt.js.map +0 -1
  180. package/lib/prompts/AgenticaDescribePrompt.d.ts +0 -16
  181. package/lib/prompts/AgenticaDescribePrompt.js.map +0 -1
  182. package/lib/prompts/AgenticaExecutePrompt.js.map +0 -1
  183. package/lib/prompts/AgenticaPrompt.d.ts +0 -17
  184. package/lib/prompts/AgenticaPrompt.js.map +0 -1
  185. package/lib/prompts/AgenticaPromptBase.js.map +0 -1
  186. package/lib/prompts/AgenticaSelectPrompt.d.ts +0 -8
  187. package/lib/prompts/AgenticaSelectPrompt.js +0 -3
  188. package/lib/prompts/AgenticaSelectPrompt.js.map +0 -1
  189. package/lib/prompts/AgenticaTextPrompt.d.ts +0 -6
  190. package/lib/prompts/AgenticaTextPrompt.js.map +0 -1
  191. package/src/prompts/AgenticaCancelPrompt.ts +0 -13
  192. package/src/prompts/AgenticaDescribePrompt.ts +0 -22
  193. package/src/prompts/AgenticaPrompt.ts +0 -25
  194. package/src/prompts/AgenticaSelectPrompt.ts +0 -13
  195. package/src/prompts/AgenticaTextPrompt.ts +0 -10
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MicroAgentica = void 0;
13
+ const AgenticaTokenUsage_1 = require("./context/AgenticaTokenUsage");
14
+ const AgenticaOperationComposer_1 = require("./context/internal/AgenticaOperationComposer");
15
+ const AgenticaTokenUsageAggregator_1 = require("./context/internal/AgenticaTokenUsageAggregator");
16
+ const events_1 = require("./factory/events");
17
+ const histories_1 = require("./factory/histories");
18
+ const orchestrate_1 = require("./orchestrate");
19
+ const AgenticaPromptTransformer_1 = require("./transformers/AgenticaPromptTransformer");
20
+ const __map_take_1 = require("./utils/__map_take");
21
+ const ChatGptCompletionMessageUtil_1 = require("./utils/ChatGptCompletionMessageUtil");
22
+ const StreamUtil_1 = require("./utils/StreamUtil");
23
+ /**
24
+ * Micro AI chatbot.
25
+ *
26
+ * `MicroAgentica` is a facade class for the micro AI chatbot agent
27
+ * which performs LLM (Large Language Model) function calling from the
28
+ * {@link conversate user's conversation} and manages the
29
+ * {@link getHistories prompt histories}.
30
+ *
31
+ * Different between `MicroAgentica` and {@link Agentica} is that
32
+ * `MicroAgentica` does not have function selecting filter. It directly
33
+ * list up every functions to the agent. Besides, {@link Agentica} has
34
+ * a function selecting mechanism to reduce the number of functions to
35
+ * be listed up to the agent.
36
+ *
37
+ * Therefore, if you have a lot of functions to call, you must not
38
+ * use this `MicroAgentica` class. Use this `MicroAgentica` class only
39
+ * when you have a few functions to call.
40
+ *
41
+ * - [Multi-agent orchestration of `@agentica`](https://wrtnlabs.io/agentica/docs/concepts/function-calling/#orchestration-strategy)
42
+ * - Internal agents of `MicroAgentica`
43
+ * - executor
44
+ * - describier
45
+ * - Internal agents of {@link Agentica}
46
+ * - initializer
47
+ * - **selector**
48
+ * - executor
49
+ * - describer
50
+ *
51
+ * @author Samchon
52
+ */
53
+ class MicroAgentica {
54
+ /* -----------------------------------------------------------
55
+ CONSTRUCTOR
56
+ ----------------------------------------------------------- */
57
+ /**
58
+ * Initializer Constructor.
59
+ *
60
+ * @param props Properties to construct the micro agent
61
+ */
62
+ constructor(props) {
63
+ var _a;
64
+ this.props = props;
65
+ this.operations_ = AgenticaOperationComposer_1.AgenticaOperationComposer.compose({
66
+ controllers: props.controllers,
67
+ config: props.config,
68
+ });
69
+ this.histories_ = ((_a = props.histories) !== null && _a !== void 0 ? _a : []).map(input => AgenticaPromptTransformer_1.AgenticaPromptTransformer.transform({
70
+ operations: this.operations_.group,
71
+ history: input,
72
+ }));
73
+ this.listeners_ = new Map();
74
+ this.token_usage_ = AgenticaTokenUsage_1.AgenticaTokenUsage.zero();
75
+ }
76
+ /**
77
+ * @internal
78
+ */
79
+ clone() {
80
+ var _a;
81
+ return new MicroAgentica(Object.assign(Object.assign({}, this.props), { histories: (_a = this.props.histories) === null || _a === void 0 ? void 0 : _a.slice() }));
82
+ }
83
+ /* -----------------------------------------------------------
84
+ ACCESSORS
85
+ ----------------------------------------------------------- */
86
+ /**
87
+ * Conversate with the micro agent.
88
+ *
89
+ * User talks to the AI chatbot with the given content.
90
+ *
91
+ * When the user's conversation implies the AI chatbot to execute a
92
+ * function calling, the returned chat prompts will contain the
93
+ * function callinng information like {@link AgenticaExecuteHistory}
94
+ *
95
+ * @param content The content to talk
96
+ * @returns List of newly created histories
97
+ */
98
+ conversate(content) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const talk = (0, histories_1.createTextHistory)({
101
+ role: "user",
102
+ text: content,
103
+ });
104
+ yield this.dispatch((0, events_1.createTextEvent)({
105
+ role: "user",
106
+ stream: StreamUtil_1.StreamUtil.to(content),
107
+ done: () => true,
108
+ get: () => content,
109
+ join: () => __awaiter(this, void 0, void 0, function* () { return Promise.resolve(content); }),
110
+ }));
111
+ const ctx = this.getContext({
112
+ prompt: talk,
113
+ usage: this.token_usage_,
114
+ });
115
+ const histories = yield (0, orchestrate_1.call)(ctx, this.operations_.array);
116
+ const executes = histories.filter(p => p.type === "execute");
117
+ if (executes.length) {
118
+ histories.push(...yield (0, orchestrate_1.describe)(ctx, executes));
119
+ }
120
+ this.histories_.push(talk, ...histories);
121
+ return histories;
122
+ });
123
+ }
124
+ /**
125
+ * Get configuration.
126
+ */
127
+ getConfig() {
128
+ return this.props.config;
129
+ }
130
+ /**
131
+ * Get LLM vendor.
132
+ */
133
+ getVendor() {
134
+ return this.props.vendor;
135
+ }
136
+ /**
137
+ * Get controllers.
138
+ *
139
+ * Get list of controllers, which are the collection of functions that
140
+ * the agent can execute.
141
+ */
142
+ getControllers() {
143
+ return this.props.controllers;
144
+ }
145
+ /**
146
+ * Get the chatbot's histories.
147
+ *
148
+ * Get list of chat histories that the chatbot has been conversated.
149
+ *
150
+ * @returns List of chat histories
151
+ */
152
+ getHistories() {
153
+ return this.histories_;
154
+ }
155
+ /**
156
+ * Get token usage of the AI chatbot.
157
+ *
158
+ * Entire token usage of the AI chatbot during the conversating
159
+ * with the user by {@link conversate} method callings.
160
+ *
161
+ * @returns Cost of the AI chatbot
162
+ */
163
+ getTokenUsage() {
164
+ return this.token_usage_;
165
+ }
166
+ /**
167
+ * @internal
168
+ */
169
+ getContext(props) {
170
+ const dispatch = this.dispatch.bind(this);
171
+ return {
172
+ operations: this.operations_,
173
+ config: this.props.config,
174
+ histories: this.histories_,
175
+ prompt: props.prompt,
176
+ dispatch,
177
+ request: (source, body) => __awaiter(this, void 0, void 0, function* () {
178
+ // request information
179
+ const event = (0, events_1.createRequestEvent)({
180
+ source,
181
+ body: Object.assign(Object.assign({}, body), { model: this.props.vendor.model, stream: true, stream_options: {
182
+ include_usage: true,
183
+ } }),
184
+ options: this.props.vendor.options,
185
+ });
186
+ yield dispatch(event);
187
+ // completion
188
+ const completion = yield this.props.vendor.api.chat.completions.create(event.body, event.options);
189
+ const [streamForEvent, temporaryStream] = StreamUtil_1.StreamUtil.transform(completion.toReadableStream(), value => ChatGptCompletionMessageUtil_1.ChatGptCompletionMessageUtil.transformCompletionChunk(value)).tee();
190
+ const [streamForAggregate, streamForReturn] = temporaryStream.tee();
191
+ void (() => __awaiter(this, void 0, void 0, function* () {
192
+ const reader = streamForAggregate.getReader();
193
+ while (true) {
194
+ const chunk = yield reader.read();
195
+ if (chunk.done) {
196
+ break;
197
+ }
198
+ if (chunk.value.usage != null) {
199
+ AgenticaTokenUsageAggregator_1.AgenticaTokenUsageAggregator.aggregate({
200
+ kind: source,
201
+ completionUsage: chunk.value.usage,
202
+ usage: props.usage,
203
+ });
204
+ }
205
+ }
206
+ }))();
207
+ const [streamForStream, streamForJoin] = streamForEvent.tee();
208
+ yield dispatch({
209
+ type: "response",
210
+ source,
211
+ stream: streamForStream,
212
+ body: event.body,
213
+ options: event.options,
214
+ join: () => __awaiter(this, void 0, void 0, function* () {
215
+ const chunks = yield StreamUtil_1.StreamUtil.readAll(streamForJoin);
216
+ return ChatGptCompletionMessageUtil_1.ChatGptCompletionMessageUtil.merge(chunks);
217
+ }),
218
+ });
219
+ return streamForReturn;
220
+ }),
221
+ };
222
+ }
223
+ /* -----------------------------------------------------------
224
+ EVENT HANDLERS
225
+ ----------------------------------------------------------- */
226
+ /**
227
+ * Add an event listener.
228
+ *
229
+ * Add an event listener to be called whenever the event is emitted.
230
+ *
231
+ * @param type Type of event
232
+ * @param listener Callback function to be called whenever the event is emitted
233
+ */
234
+ on(type, listener) {
235
+ /**
236
+ * @TODO remove `as`
237
+ */
238
+ (0, __map_take_1.__map_take)(this.listeners_, type, () => new Set()).add(listener);
239
+ return this;
240
+ }
241
+ /**
242
+ * Erase an event listener.
243
+ *
244
+ * Erase an event listener to stop calling the callback function.
245
+ *
246
+ * @param type Type of event
247
+ * @param listener Callback function to erase
248
+ */
249
+ off(type, listener) {
250
+ const set = this.listeners_.get(type);
251
+ if (set !== undefined) {
252
+ /**
253
+ * @TODO remove `as`
254
+ */
255
+ set.delete(listener);
256
+ if (set.size === 0) {
257
+ this.listeners_.delete(type);
258
+ }
259
+ }
260
+ return this;
261
+ }
262
+ dispatch(event) {
263
+ return __awaiter(this, void 0, void 0, function* () {
264
+ const set = this.listeners_.get(event.type);
265
+ if (set !== undefined) {
266
+ yield Promise.all(Array.from(set).map((listener) => __awaiter(this, void 0, void 0, function* () {
267
+ try {
268
+ yield listener(event);
269
+ }
270
+ catch (_a) {
271
+ /* empty */
272
+ }
273
+ })));
274
+ }
275
+ });
276
+ }
277
+ }
278
+ exports.MicroAgentica = MicroAgentica;
279
+ //# sourceMappingURL=MicroAgentica.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicroAgentica.js","sourceRoot":"","sources":["../src/MicroAgentica.ts"],"names":[],"mappings":";;;;;;;;;;;;AAcA,qEAAkE;AAClE,4FAAyF;AACzF,kGAA+F;AAC/F,6CAAuE;AACvE,mDAAwD;AACxD,+CAA+C;AAC/C,wFAAqF;AACrF,mDAAgD;AAChD,uFAAoF;AACpF,mDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,aAAa;IAMxB;;kEAE8D;IAC9D;;;;OAIG;IACH,YAAoC,KAAiC;;QAAjC,UAAK,GAAL,KAAK,CAA4B;QACnE,IAAI,CAAC,WAAW,GAAG,qDAAyB,CAAC,OAAO,CAAC;YACnD,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,CAAC,MAAA,KAAK,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CACpD,qDAAyB,CAAC,SAAS,CAAC;YAClC,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,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAO,QAAQ,EAAE,EAAE;oBACrC,IAAI,CAAC;wBACH,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACxB,CAAC;oBACD,WAAM,CAAC;wBACL,WAAW;oBACb,CAAC;gBACH,CAAC,CAAA,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAzRD,sCAyRC"}
@@ -1,6 +1,7 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { IAgenticaConfig } from "../structures/IAgenticaConfig";
3
- export declare function write<Model extends ILlmSchema.Model>(config?: IAgenticaConfig<Model>): string;
3
+ import type { IMicroAgenticaConfig } from "../structures/IMicroAgenticaConfig";
4
+ export declare function write<Model extends ILlmSchema.Model>(config?: IAgenticaConfig<Model> | IMicroAgenticaConfig<Model>): string;
4
5
  export declare const AgenticaDefaultPrompt: {
5
6
  write: typeof write;
6
7
  };
@@ -33,12 +33,12 @@ const getLocale = new Singleton_1.Singleton(() => {
33
33
  });
34
34
  const getTimezone = new Singleton_1.Singleton(() => Intl.DateTimeFormat().resolvedOptions().timeZone);
35
35
  function write(config) {
36
- var _a, _b, _c, _d;
36
+ var _a, _b, _c;
37
37
  if (((_a = config === null || config === void 0 ? void 0 : config.systemPrompt) === null || _a === void 0 ? void 0 : _a.common) !== undefined) {
38
- return (_b = config === null || config === void 0 ? void 0 : config.systemPrompt) === null || _b === void 0 ? void 0 : _b.common(config);
38
+ return config.systemPrompt.common(config);
39
39
  }
40
- const locale = (_c = config === null || config === void 0 ? void 0 : config.locale) !== null && _c !== void 0 ? _c : getLocale.get();
41
- const timezone = (_d = config === null || config === void 0 ? void 0 : config.timezone) !== null && _d !== void 0 ? _d : getTimezone.get();
40
+ const locale = (_b = config === null || config === void 0 ? void 0 : config.locale) !== null && _b !== void 0 ? _b : getLocale.get();
41
+ const timezone = (_c = config === null || config === void 0 ? void 0 : config.timezone) !== null && _c !== void 0 ? _c : getTimezone.get();
42
42
  return AgenticaSystemPrompt_1.AgenticaSystemPrompt.COMMON
43
43
  // intended code
44
44
  // eslint-disable-next-line no-template-curly-in-string
@@ -1 +1 @@
1
- {"version":3,"file":"AgenticaDefaultPrompt.js","sourceRoot":"","sources":["../../src/constants/AgenticaDefaultPrompt.ts"],"names":[],"mappings":";;;AAyCA,sBAgBC;AArDD,kDAA+C;AAE/C,iEAA8D;AAE9D;;GAEG;AACH,MAAM,MAAM,GAAG,IAAI,qBAAS,CAAC,GAAG,EAAE;IAChC,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;IACvE,OAAO;IACL,iDAAiD;IACjD,OAAO,MAAM,KAAK,QAAQ;QAC1B,iDAAiD;WAC9C,QAAQ,CAAC,MAAM,CAAC;QACnB,6EAA6E;WAC1E,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;QAC3B,6EAA6E;WAC1E,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;QACpC,6EAA6E;WAC1E,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CACvD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,GAAG,EAAE;;IACnC,OAAA,MAAM,CAAC,GAAG,EAAE;QACV,sDAAsD;QACtD,CAAC,CAAC,CAAC,MAAA,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,mCAAI,OAAO,CAAC;QAC9C,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAA;CAAA,CACvB,CAAC;AAEF,MAA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AG,EAAE,CAAC;IAE/D,OAAO,2CAAoB,CAAC,MAAM;QAChC,gBAAgB;QAChB,uDAAuD;SACtD,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,uDAAuD;SACtD,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC;QACjC,uDAAuD;SACtD,OAAO,CAAC,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC;AACY,QAAA,qBAAqB,GAAG;IACnC,KAAK;CACN,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
- import type { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
3
- import type { AgenticaPromptBase } from "../prompts/AgenticaPromptBase";
2
+ import type { AgenticaHistoryBase } from "../histories/AgenticaHistoryBase";
3
+ import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
4
4
  import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
5
- export interface AgenticaCancelPrompt<Model extends ILlmSchema.Model> extends AgenticaPromptBase<"cancel", IAgenticaPromptJson.ICancel> {
5
+ export interface AgenticaCancelPrompt<Model extends ILlmSchema.Model> extends AgenticaHistoryBase<"cancel", IAgenticaHistoryJson.ICancel> {
6
6
  id: string;
7
7
  selections: AgenticaOperationSelection<Model>[];
8
8
  }
@@ -2,26 +2,26 @@ import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type OpenAI from "openai";
3
3
  import type { AgenticaEvent } from "../events/AgenticaEvent";
4
4
  import type { AgenticaEventSource } from "../events/AgenticaEventSource";
5
- import type { AgenticaPrompt } from "../prompts/AgenticaPrompt";
6
- import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
5
+ import type { AgenticaHistory } from "../histories/AgenticaHistory";
6
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
7
7
  import type { IAgenticaConfig } from "../structures/IAgenticaConfig";
8
8
  import type { AgenticaOperationCollection } from "./AgenticaOperationCollection";
9
9
  import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
10
10
  /**
11
- * Context of the Nestia A.I. agent.
11
+ * Context of the Agentic AI agent.
12
12
  *
13
- * `IAgenticaContext` is a structure defining the context of the
13
+ * `AgenticaContext` is a structure defining the context of the
14
14
  * internal agents composing the {@link Agentica}, like function
15
15
  * selector, executor, and describer, and so on. For example, if an
16
16
  * agent has been configured to utilize the OpenAI, the context will
17
17
  * be delivered to the below components.
18
18
  *
19
- * - {@link ChatGptAgent}
20
- * - {@link ChatGptInitializeFunctionAgent}
21
- * - {@link ChatGptSelectFunctionAgent}
22
- * - {@link ChatGptExecuteFunctionAgent}
23
- * - {@link ChatGptDescribeFunctionAgent}
24
- * - {@link ChatGptCancelFunctionAgent}
19
+ * - {@link orchestrate.execute}
20
+ * - {@link orchestrate.initialize}
21
+ * - {@link orchestrate.select}
22
+ * - {@link orchestrate.call}
23
+ * - {@link orchestrate.describe}
24
+ * - {@link orchestrate.cancel}
25
25
  *
26
26
  * Also, as its name is context, it contains every information that
27
27
  * is required to interact with the AI vendor like OpenAI. It
@@ -59,7 +59,7 @@ export interface AgenticaContext<Model extends ILlmSchema.Model> {
59
59
  /**
60
60
  * Prompt histories.
61
61
  */
62
- histories: AgenticaPrompt<Model>[];
62
+ histories: AgenticaHistory<Model>[];
63
63
  /**
64
64
  * Stacked operations.
65
65
  *
@@ -72,7 +72,7 @@ export interface AgenticaContext<Model extends ILlmSchema.Model> {
72
72
  * Text conversation written the by user through the
73
73
  * {@link Agentica.conversate} function.
74
74
  */
75
- prompt: AgenticaTextPrompt<"user">;
75
+ prompt: AgenticaTextHistory<"user">;
76
76
  /**
77
77
  * Whether the agent is ready.
78
78
  *
@@ -1,7 +1,7 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperation } from "./AgenticaOperation";
3
3
  /**
4
- * Collection of operations used in the Nestia Agent.
4
+ * Collection of operations used in the Agentica Agent.
5
5
  *
6
6
  * `IAgenticaOperationCollection` is an interface type representing
7
7
  * a collection of operations for several purposes used in the
@@ -0,0 +1,75 @@
1
+ import type { ILlmSchema } from "@samchon/openapi";
2
+ import type OpenAI from "openai";
3
+ import type { MicroAgenticaEvent } from "../events/MicroAgenticaEvent";
4
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
5
+ import type { MicroAgenticaHistory } from "../histories/MicroAgenticaHistory";
6
+ import type { IMicroAgenticaConfig } from "../structures/IMicroAgenticaConfig";
7
+ import type { AgenticaOperationCollection } from "./AgenticaOperationCollection";
8
+ /**
9
+ * Context of the Micro Agentic AI agent.
10
+ *
11
+ * `MicroAgenticaContext` is a structure defining the context of the
12
+ * internal agents composing the {@link MicroAgentica}.
13
+ *
14
+ * It contains every information that is required to interact with
15
+ * the AI vendor like OpenAI. It contains every operations for LLM
16
+ * function calling, and configuration used for the agent construction.
17
+ * And it contains the prompt histories, and facade controller
18
+ * functions for interacting with the {@link MicroAgentica} like
19
+ * {@link dispatch}.
20
+ *
21
+ * In such reasons, if you're planning to customize some internal
22
+ * agents, or add new agents with new process routine, you have to
23
+ * understand this context structure. Otherwise you don't have any
24
+ * plan to customize the internal agents, this context information is
25
+ * not important for you.
26
+ *
27
+ * @author Samchon
28
+ */
29
+ export interface MicroAgenticaContext<Model extends ILlmSchema.Model> {
30
+ /**
31
+ * Collection of operations.
32
+ *
33
+ * Collection of operations from every controllers, and their
34
+ * groups composed by the divide and conquer rule for the
35
+ * efficient operation selection if configured.
36
+ */
37
+ operations: AgenticaOperationCollection<Model>;
38
+ /**
39
+ * Configuration of the agent.
40
+ *
41
+ * Configuration of the agent, that is used when constructing the
42
+ * {@link Agentica} instance.
43
+ *
44
+ * @todo Write detaily after supporting the agent customization feature
45
+ */
46
+ config: IMicroAgenticaConfig<Model> | undefined;
47
+ /**
48
+ * Prompt histories.
49
+ */
50
+ histories: MicroAgenticaHistory<Model>[];
51
+ /**
52
+ * Text prompt of the user.
53
+ *
54
+ * Text conversation written the by user through the
55
+ * {@link Agentica.conversate} function.
56
+ */
57
+ prompt: AgenticaTextHistory<"user">;
58
+ /**
59
+ * Dispatch event.
60
+ *
61
+ * Dispatch event so that the agent can be handle the event
62
+ * through the {@link Agentica.on} function.
63
+ *
64
+ * @param event Event to deliver
65
+ */
66
+ dispatch: (event: MicroAgenticaEvent<Model>) => Promise<void>;
67
+ /**
68
+ * Request to the OpenAI server.
69
+ *
70
+ * @param source The source agent of the agent
71
+ * @param body The request body to the OpenAI server
72
+ * @returns Response from the OpenAI server
73
+ */
74
+ request: (source: MicroAgenticaEvent.Source, body: Omit<OpenAI.ChatCompletionCreateParamsStreaming, "model" | "stream">) => Promise<ReadableStream<OpenAI.Chat.Completions.ChatCompletionChunk>>;
75
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=AgenticaCancelPrompt.js.map
3
+ //# sourceMappingURL=MicroAgenticaContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicroAgenticaContext.js","sourceRoot":"","sources":["../../src/context/MicroAgenticaContext.ts"],"names":[],"mappings":""}
@@ -1,10 +1,11 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { IAgenticaConfig } from "../../structures/IAgenticaConfig";
3
3
  import type { IAgenticaController } from "../../structures/IAgenticaController";
4
+ import type { IMicroAgenticaConfig } from "../../structures/IMicroAgenticaConfig";
4
5
  import type { AgenticaOperationCollection } from "../AgenticaOperationCollection";
5
6
  export declare function compose<Model extends ILlmSchema.Model>(props: {
6
7
  controllers: IAgenticaController<Model>[];
7
- config?: IAgenticaConfig<Model> | undefined;
8
+ config?: IAgenticaConfig<Model> | IMicroAgenticaConfig<Model> | undefined;
8
9
  }): AgenticaOperationCollection<Model>;
9
10
  export declare const AgenticaOperationComposer: {
10
11
  compose: typeof compose;
@@ -40,10 +40,11 @@ function compose(props) {
40
40
  }),
41
41
  })))
42
42
  .flat();
43
- const divided = ((_a = props.config) === null || _a === void 0 ? void 0 : _a.capacity) !== undefined && array.length > props.config.capacity
43
+ const capacity = (_a = props.config) === null || _a === void 0 ? void 0 : _a.capacity;
44
+ const divided = capacity !== undefined && array.length > capacity
44
45
  ? divide({
45
46
  array,
46
- capacity: props.config.capacity,
47
+ capacity,
47
48
  })
48
49
  : undefined;
49
50
  const flat = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"AgenticaOperationComposer.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaOperationComposer.ts"],"names":[],"mappings":";;;AASA,0BA2EC;AA7ED,uDAAoD;AAEpD,SAAgB,OAAO,CAAiC,KAGvD;;IACC,MAAM,MAAM,GACN,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;WAC3B,CAAC,GAAG,EAAE;YACP,MAAM,KAAK,GAAa,KAAK,CAAC,WAAW;iBACtC,GAAG,CAAC,UAAU,CAAC,EAAE,CAChB,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CACxD;iBACA,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IACX,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE,CAC1C,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;IAEnC,MAAM,KAAK,GAA+B,KAAK,CAAC,WAAW;SACxD,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,CACtB,UAAU,CAAC,QAAQ,KAAK,MAAM;QAC5B,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAClC,IAAI,CAAC,EAAE,CACH,CAAC;YACC,QAAQ,EAAE,MAAM;YAChB,UAAU;YAC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,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAA,uBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAC1D,IAAI,CAAC,IAAI,EACT,IAAI,CACL,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK;QACL,OAAO;QACP,IAAI;QACJ,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAI,KAGlB;IACC,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpE,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAQ,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAEY,QAAA,yBAAyB,GAAG;IACvC,OAAO;CACR,CAAC"}
1
+ {"version":3,"file":"AgenticaOperationComposer.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaOperationComposer.ts"],"names":[],"mappings":";;;AAUA,0BA6EC;AA/ED,uDAAoD;AAEpD,SAAgB,OAAO,CAAiC,KAGvD;;IACC,MAAM,MAAM,GACN,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;WAC3B,CAAC,GAAG,EAAE;YACP,MAAM,KAAK,GAAa,KAAK,CAAC,WAAW;iBACtC,GAAG,CAAC,UAAU,CAAC,EAAE,CAChB,UAAU,CAAC,W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,OAAO,GAAQ,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAEY,QAAA,yBAAyB,GAAG;IACvC,OAAO;CACR,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAgenticaContext = isAgenticaContext;
4
+ /**
5
+ * @internal
6
+ */
7
+ function isAgenticaContext(ctx) {
8
+ return typeof ctx.initialize === "function";
9
+ }
10
+ //# sourceMappingURL=isAgenticaContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAgenticaContext.js","sourceRoot":"","sources":["../../../src/context/internal/isAgenticaContext.ts"],"names":[],"mappings":";;AAQA,8CAIC;AAPD;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,GAAyD;IAEzD,OAAO,OAAQ,GAA8B,CAAC,UAAU,KAAK,UAAU,CAAC;AAC1E,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
+ import type { AgenticaDescribeHistory } from "../histories/AgenticaDescribeHistory";
3
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
2
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
3
- import type { AgenticaDescribePrompt } from "../prompts/AgenticaDescribePrompt";
4
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export interface AgenticaDescribeEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"describe"> {
7
- executes: AgenticaExecutePrompt<Model>[];
7
+ executes: AgenticaExecuteHistory<Model>[];
8
8
  stream: ReadableStream<string>;
9
9
  join: () => Promise<string>;
10
10
  toJSON: () => IAgenticaEventJson.IDescribe;
11
- toPrompt: () => AgenticaDescribePrompt<Model>;
11
+ toHistory: () => AgenticaDescribeHistory<Model>;
12
12
  }
@@ -34,4 +34,5 @@ export declare namespace AgenticaEvent {
34
34
  text: AgenticaTextEvent;
35
35
  validate: AgenticaValidateEvent<Model>;
36
36
  }
37
+ type Source = "initialize" | "select" | "cancel" | "call" | "describe";
37
38
  }
@@ -1,22 +1,22 @@
1
1
  import type { IHttpResponse, ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperation } from "../context/AgenticaOperation";
3
+ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
3
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
4
- import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export type AgenticaExecuteEvent<Model extends ILlmSchema.Model> = AgenticaExecuteEvent.Class<Model> | AgenticaExecuteEvent.Protocol<Model>;
7
7
  export declare namespace AgenticaExecuteEvent {
8
- export interface Class<Model extends ILlmSchema.Model> extends Base<"class", AgenticaOperation.Class<Model>, AgenticaExecutePrompt.Class<Model>, unknown> {
8
+ export interface Class<Model extends ILlmSchema.Model> extends Base<"class", AgenticaOperation.Class<Model>, AgenticaExecuteHistory.Class<Model>, unknown> {
9
9
  }
10
- export interface Protocol<Model extends ILlmSchema.Model> extends Base<"http", AgenticaOperation.Http<Model>, AgenticaExecutePrompt.Http<Model>, IHttpResponse> {
10
+ export interface Protocol<Model extends ILlmSchema.Model> extends Base<"http", AgenticaOperation.Http<Model>, AgenticaExecuteHistory.Http<Model>, IHttpResponse> {
11
11
  }
12
- interface Base<Protocol extends "http" | "class", Operation extends AgenticaOperation<any>, Prompt extends AgenticaExecutePrompt<any>, Value> extends AgenticaEventBase<"execute"> {
12
+ interface Base<Protocol extends "http" | "class", Operation extends AgenticaOperation<any>, History extends AgenticaExecuteHistory<any>, Value> extends AgenticaEventBase<"execute"> {
13
13
  protocol: Protocol;
14
14
  id: string;
15
15
  operation: Operation;
16
16
  arguments: Record<string, unknown>;
17
17
  value: Value;
18
18
  toJSON: () => IAgenticaEventJson.IExecute;
19
- toPrompt: () => Prompt;
19
+ toHistory: () => History;
20
20
  }
21
21
  export {};
22
22
  }
@@ -1,10 +1,10 @@
1
1
  import type { ILlmSchema } from "@samchon/openapi";
2
2
  import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
3
+ import type { AgenticaSelectHistory } from "../histories/AgenticaSelectHistory";
3
4
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
4
- import type { AgenticaSelectPrompt } from "../prompts/AgenticaSelectPrompt";
5
5
  import type { AgenticaEventBase } from "./AgenticaEventBase";
6
6
  export interface AgenticaSelectEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"select"> {
7
7
  selection: AgenticaOperationSelection<Model>;
8
8
  toJSON: () => IAgenticaEventJson.ISelect;
9
- toPrompt: () => AgenticaSelectPrompt<Model>;
9
+ toHistory: () => AgenticaSelectHistory<Model>;
10
10
  }
@@ -1,10 +1,10 @@
1
+ import type { AgenticaTextHistory } from "../histories/AgenticaTextHistory";
1
2
  import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
2
- import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
3
3
  import type { AgenticaEventBase } from "./AgenticaEventBase";
4
4
  export interface AgenticaTextEvent<Role extends "assistant" | "user" = "assistant" | "user"> extends AgenticaEventBase<"text"> {
5
5
  role: Role;
6
6
  stream: ReadableStream<string>;
7
7
  join: () => Promise<string>;
8
8
  toJSON: () => IAgenticaEventJson.IText;
9
- toPrompt: () => AgenticaTextPrompt;
9
+ toHistory: () => AgenticaTextHistory;
10
10
  }