@agentica/core 0.12.21 → 0.13.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 (205) hide show
  1. package/README.md +50 -47
  2. package/lib/Agentica.d.ts +9 -9
  3. package/lib/Agentica.js +23 -16
  4. package/lib/Agentica.js.map +1 -1
  5. package/lib/chatgpt/ChatGptAgent.d.ts +7 -7
  6. package/lib/chatgpt/ChatGptAgent.js +17 -12
  7. package/lib/chatgpt/ChatGptAgent.js.map +1 -1
  8. package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +7 -6
  9. package/lib/chatgpt/ChatGptCallFunctionAgent.js +120 -81
  10. package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
  11. package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +9 -7
  12. package/lib/chatgpt/ChatGptCancelFunctionAgent.js +177 -145
  13. package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
  14. package/lib/chatgpt/ChatGptCompletionMessageUtil.d.ts +13 -8
  15. package/lib/chatgpt/ChatGptCompletionMessageUtil.js +499 -489
  16. package/lib/chatgpt/ChatGptCompletionMessageUtil.js.map +1 -1
  17. package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +7 -6
  18. package/lib/chatgpt/ChatGptDescribeFunctionAgent.js +33 -32
  19. package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
  20. package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +7 -6
  21. package/lib/chatgpt/ChatGptHistoryDecoder.js +60 -56
  22. package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
  23. package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +7 -6
  24. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +121 -116
  25. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
  26. package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +20 -5
  27. package/lib/chatgpt/ChatGptSelectFunctionAgent.js +183 -150
  28. package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
  29. package/lib/chatgpt/ChatGptUsageAggregator.d.ts +9 -6
  30. package/lib/chatgpt/ChatGptUsageAggregator.js +46 -41
  31. package/lib/chatgpt/ChatGptUsageAggregator.js.map +1 -1
  32. package/lib/context/AgenticaCancelPrompt.d.ts +3 -3
  33. package/lib/context/AgenticaCancelPrompt.js +1 -1
  34. package/lib/context/AgenticaCancelPrompt.js.map +1 -1
  35. package/lib/context/AgenticaClassOperation.d.ts +1 -1
  36. package/lib/context/AgenticaClassOperation.js.map +1 -1
  37. package/lib/context/AgenticaContext.d.ts +9 -9
  38. package/lib/context/AgenticaHttpOperation.d.ts +1 -1
  39. package/lib/context/AgenticaHttpOperation.js.map +1 -1
  40. package/lib/context/AgenticaOperation.d.ts +4 -4
  41. package/lib/context/AgenticaOperationBase.d.ts +1 -1
  42. package/lib/context/AgenticaOperationCollection.d.ts +2 -2
  43. package/lib/context/AgenticaOperationSelection.d.ts +3 -3
  44. package/lib/context/AgenticaTokenUsage.d.ts +1 -1
  45. package/lib/context/AgenticaTokenUsage.js.map +1 -1
  46. package/lib/context/internal/AgenticaTokenUsageAggregator.d.ts +11 -10
  47. package/lib/context/internal/AgenticaTokenUsageAggregator.js +42 -43
  48. package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
  49. package/lib/context/internal/__IChatCancelFunctionsApplication.d.ts +2 -2
  50. package/lib/context/internal/__IChatInitialApplication.d.ts +2 -2
  51. package/lib/context/internal/__IChatSelectFunctionsApplication.d.ts +2 -2
  52. package/lib/events/AgenticaCallEvent.d.ts +3 -3
  53. package/lib/events/AgenticaCancelEvent.d.ts +3 -3
  54. package/lib/events/AgenticaDescribeEvent.d.ts +3 -3
  55. package/lib/events/AgenticaDescribeEvent.js +13 -2
  56. package/lib/events/AgenticaDescribeEvent.js.map +1 -1
  57. package/lib/events/AgenticaEvent.d.ts +12 -12
  58. package/lib/events/AgenticaExecuteEvent.d.ts +7 -7
  59. package/lib/events/AgenticaInitializeEvent.d.ts +1 -1
  60. package/lib/events/AgenticaRequestEvent.d.ts +3 -3
  61. package/lib/events/AgenticaRequestEvent.js.map +1 -1
  62. package/lib/events/AgenticaResponseEvent.d.ts +2 -2
  63. package/lib/events/AgenticaResponseEvent.js.map +1 -1
  64. package/lib/events/AgenticaSelectEvent.d.ts +3 -3
  65. package/lib/events/AgenticaSelectEvent.js.map +1 -1
  66. package/lib/events/AgenticaTextEvent.d.ts +1 -1
  67. package/lib/events/AgenticaTextEvent.js +12 -1
  68. package/lib/events/AgenticaTextEvent.js.map +1 -1
  69. package/lib/functional/assertHttpLlmApplication.d.ts +4 -3
  70. package/lib/functional/assertHttpLlmApplication.js +9339 -9338
  71. package/lib/functional/assertHttpLlmApplication.js.map +1 -1
  72. package/lib/functional/validateHttpLlmApplication.d.ts +5 -4
  73. package/lib/functional/validateHttpLlmApplication.js +19 -19
  74. package/lib/functional/validateHttpLlmApplication.js.map +1 -1
  75. package/lib/index.d.ts +19 -19
  76. package/lib/index.js +21 -21
  77. package/lib/index.js.map +1 -1
  78. package/lib/index.mjs +19210 -18997
  79. package/lib/index.mjs.map +1 -1
  80. package/lib/internal/AgenticaDefaultPrompt.d.ts +6 -5
  81. package/lib/internal/AgenticaDefaultPrompt.js +39 -19
  82. package/lib/internal/AgenticaDefaultPrompt.js.map +1 -1
  83. package/lib/internal/AgenticaOperationComposer.d.ts +11 -10
  84. package/lib/internal/AgenticaOperationComposer.js +60 -59
  85. package/lib/internal/AgenticaOperationComposer.js.map +1 -1
  86. package/lib/internal/AgenticaSystemPrompt.d.ts +8 -8
  87. package/lib/internal/AgenticaSystemPrompt.js +9 -9
  88. package/lib/internal/AgenticaSystemPrompt.js.map +1 -1
  89. package/lib/internal/AsyncQueue.d.ts +15 -0
  90. package/lib/internal/AsyncQueue.js +82 -0
  91. package/lib/internal/AsyncQueue.js.map +1 -0
  92. package/lib/internal/ByteArrayUtil.d.ts +1 -1
  93. package/lib/internal/ByteArrayUtil.js +3 -2
  94. package/lib/internal/ByteArrayUtil.js.map +1 -1
  95. package/lib/internal/MPSC.d.ts +10 -0
  96. package/lib/internal/MPSC.js +49 -0
  97. package/lib/internal/MPSC.js.map +1 -0
  98. package/lib/internal/Singleton.js +6 -5
  99. package/lib/internal/Singleton.js.map +1 -1
  100. package/lib/internal/StreamUtil.d.ts +16 -6
  101. package/lib/internal/StreamUtil.js +43 -29
  102. package/lib/internal/StreamUtil.js.map +1 -1
  103. package/lib/internal/__map_take.js +5 -5
  104. package/lib/internal/__map_take.js.map +1 -1
  105. package/lib/json/IAgenticaEventJson.d.ts +7 -7
  106. package/lib/json/IAgenticaOperationSelectionJson.d.ts +1 -1
  107. package/lib/json/IAgenticaPromptJson.d.ts +2 -2
  108. package/lib/prompts/AgenticaCancelPrompt.d.ts +3 -3
  109. package/lib/prompts/AgenticaCancelPrompt.js +1 -1
  110. package/lib/prompts/AgenticaCancelPrompt.js.map +1 -1
  111. package/lib/prompts/AgenticaDescribePrompt.d.ts +3 -3
  112. package/lib/prompts/AgenticaDescribePrompt.js +1 -1
  113. package/lib/prompts/AgenticaDescribePrompt.js.map +1 -1
  114. package/lib/prompts/AgenticaExecutePrompt.d.ts +5 -5
  115. package/lib/prompts/AgenticaExecutePrompt.js.map +1 -1
  116. package/lib/prompts/AgenticaPrompt.d.ts +6 -6
  117. package/lib/prompts/AgenticaSelectPrompt.d.ts +3 -3
  118. package/lib/prompts/AgenticaSelectPrompt.js +1 -1
  119. package/lib/prompts/AgenticaSelectPrompt.js.map +1 -1
  120. package/lib/prompts/AgenticaTextPrompt.d.ts +1 -1
  121. package/lib/structures/IAgenticaConfig.d.ts +5 -5
  122. package/lib/structures/IAgenticaController.d.ts +1 -1
  123. package/lib/structures/IAgenticaExecutor.d.ts +4 -4
  124. package/lib/structures/IAgenticaProps.d.ts +5 -5
  125. package/lib/structures/IAgenticaSystemPrompt.d.ts +4 -4
  126. package/lib/structures/IAgenticaVendor.d.ts +1 -1
  127. package/lib/transformers/AgenticaEventTransformer.d.ts +55 -37
  128. package/lib/transformers/AgenticaEventTransformer.js +105 -58
  129. package/lib/transformers/AgenticaEventTransformer.js.map +1 -1
  130. package/lib/transformers/AgenticaPromptTransformer.d.ts +35 -29
  131. package/lib/transformers/AgenticaPromptTransformer.js +74 -45
  132. package/lib/transformers/AgenticaPromptTransformer.js.map +1 -1
  133. package/package.json +20 -23
  134. package/prompts/cancel.md +1 -1
  135. package/prompts/common.md +1 -1
  136. package/prompts/describe.md +1 -1
  137. package/prompts/execute.md +1 -1
  138. package/prompts/initialize.md +1 -1
  139. package/prompts/select.md +1 -1
  140. package/src/Agentica.ts +41 -31
  141. package/src/chatgpt/ChatGptAgent.ts +63 -57
  142. package/src/chatgpt/ChatGptCallFunctionAgent.ts +361 -337
  143. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +188 -164
  144. package/src/chatgpt/ChatGptCompletionMessageUtil.ts +136 -137
  145. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +105 -101
  146. package/src/chatgpt/ChatGptHistoryDecoder.ts +69 -65
  147. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +128 -123
  148. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +215 -189
  149. package/src/chatgpt/ChatGptUsageAggregator.ts +49 -54
  150. package/src/context/AgenticaCancelPrompt.ts +4 -4
  151. package/src/context/AgenticaClassOperation.ts +5 -5
  152. package/src/context/AgenticaContext.ts +15 -15
  153. package/src/context/AgenticaHttpOperation.ts +5 -5
  154. package/src/context/AgenticaOperation.ts +4 -4
  155. package/src/context/AgenticaOperationBase.ts +1 -1
  156. package/src/context/AgenticaOperationCollection.ts +2 -2
  157. package/src/context/AgenticaOperationSelection.ts +3 -3
  158. package/src/context/AgenticaTokenUsage.ts +4 -3
  159. package/src/context/internal/AgenticaTokenUsageAggregator.ts +59 -59
  160. package/src/context/internal/__IChatCancelFunctionsApplication.ts +2 -2
  161. package/src/context/internal/__IChatInitialApplication.ts +2 -2
  162. package/src/context/internal/__IChatSelectFunctionsApplication.ts +2 -2
  163. package/src/events/AgenticaCallEvent.ts +3 -3
  164. package/src/events/AgenticaCancelEvent.ts +3 -3
  165. package/src/events/AgenticaDescribeEvent.ts +5 -5
  166. package/src/events/AgenticaEvent.ts +12 -12
  167. package/src/events/AgenticaExecuteEvent.ts +7 -7
  168. package/src/events/AgenticaInitializeEvent.ts +1 -1
  169. package/src/events/AgenticaRequestEvent.ts +3 -3
  170. package/src/events/AgenticaResponseEvent.ts +2 -2
  171. package/src/events/AgenticaSelectEvent.ts +4 -4
  172. package/src/events/AgenticaTextEvent.ts +2 -2
  173. package/src/functional/assertHttpLlmApplication.ts +9 -6
  174. package/src/functional/validateHttpLlmApplication.ts +14 -8
  175. package/src/index.ts +24 -24
  176. package/src/internal/AgenticaDefaultPrompt.ts +42 -28
  177. package/src/internal/AgenticaOperationComposer.ts +63 -61
  178. package/src/internal/AgenticaSystemPrompt.ts +15 -14
  179. package/src/internal/AsyncQueue.ts +67 -0
  180. package/src/internal/ByteArrayUtil.ts +2 -2
  181. package/src/internal/MPSC.ts +40 -0
  182. package/src/internal/Singleton.ts +8 -6
  183. package/src/internal/StreamUtil.ts +62 -53
  184. package/src/internal/__map_take.ts +5 -7
  185. package/src/json/IAgenticaEventJson.ts +7 -8
  186. package/src/json/IAgenticaOperationSelectionJson.ts +1 -1
  187. package/src/json/IAgenticaPromptJson.ts +2 -2
  188. package/src/prompts/AgenticaCancelPrompt.ts +4 -4
  189. package/src/prompts/AgenticaDescribePrompt.ts +4 -4
  190. package/src/prompts/AgenticaExecutePrompt.ts +6 -5
  191. package/src/prompts/AgenticaPrompt.ts +6 -6
  192. package/src/prompts/AgenticaSelectPrompt.ts +4 -4
  193. package/src/prompts/AgenticaTextPrompt.ts +1 -1
  194. package/src/structures/IAgenticaConfig.ts +5 -5
  195. package/src/structures/IAgenticaController.ts +14 -14
  196. package/src/structures/IAgenticaExecutor.ts +4 -4
  197. package/src/structures/IAgenticaProps.ts +5 -5
  198. package/src/structures/IAgenticaSystemPrompt.ts +4 -4
  199. package/src/structures/IAgenticaVendor.ts +1 -1
  200. package/src/transformers/AgenticaEventTransformer.ts +169 -136
  201. package/src/transformers/AgenticaPromptTransformer.ts +125 -103
  202. package/lib/internal/MPSCUtil.d.ts +0 -35
  203. package/lib/internal/MPSCUtil.js +0 -105
  204. package/lib/internal/MPSCUtil.js.map +0 -1
  205. package/src/internal/MPSCUtil.ts +0 -111
@@ -1 +1 @@
1
- {"version":3,"file":"ChatGptInitializeFunctionAgent.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptInitializeFunctionAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kDAA0B;AAI1B,mEAAgE;AAChE,6EAA0E;AAC1E,2EAAwE;AACxE,mDAAgD;AAChD,uDAAoD;AAEpD,sEAAmE;AACnE,iFAA8E;AAC9E,mEAAgE;AAEhE,IAAiB,8BAA8B,CA8I9C;AA9ID,WAAiB,8BAA8B;IAChC,sCAAO,GAAG,CACrB,GAA2B,EACO,EAAE;;QACpC,MAAM;QACN,sBAAsB;QACtB,MAAM;QACN,MAAM,gBAAgB,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE;YACvD,QAAQ,EAAE;gBACR,uBAAuB;gBACvB;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,6CAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;iBACC;gBACnD,qBAAqB;gBACrB,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,6CAAqB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;gBACzD,aAAa;gBACb;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;iBACzB;gBACD;oBACE,gBAAgB;oBAChB,IAAI,EAAE,QAAQ;oBACd,OAAO,E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AA,8BAA8B,GAAG;IAC5C,OAAO;CACR,CAAC"}
@@ -1,6 +1,21 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
- import { AgenticaContext } from "../context/AgenticaContext";
3
- import { AgenticaPrompt } from "../prompts/AgenticaPrompt";
4
- export declare namespace ChatGptSelectFunctionAgent {
5
- const execute: <Model extends ILlmSchema.Model>(ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
1
+ import type { ILlmSchema } from "@samchon/openapi";
2
+ import type OpenAI from "openai";
3
+ import type { IValidation } from "typia";
4
+ import type { AgenticaContext } from "../context/AgenticaContext";
5
+ import type { AgenticaOperation } from "../context/AgenticaOperation";
6
+ import type { __IChatFunctionReference } from "../context/internal/__IChatFunctionReference";
7
+ import type { AgenticaPrompt } from "../prompts/AgenticaPrompt";
8
+ interface IFailure {
9
+ id: string;
10
+ name: string;
11
+ validation: IValidation.IFailure;
6
12
  }
13
+ export declare function execute<Model extends ILlmSchema.Model>(ctx: AgenticaContext<Model>): Promise<AgenticaPrompt<Model>[]>;
14
+ declare function selectFunction<Model extends ILlmSchema.Model>(ctx: AgenticaContext<Model>, reference: __IChatFunctionReference): Promise<AgenticaOperation<Model> | null>;
15
+ declare function emendMessages(failures: IFailure[]): OpenAI.ChatCompletionMessageParam[];
16
+ export declare const ChatGptSelectFunctionAgent: {
17
+ execute: typeof execute;
18
+ selectFunction: typeof selectFunction;
19
+ emendMessages: typeof emendMessages;
20
+ };
21
+ export {};
@@ -46,6 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.ChatGptSelectFunctionAgent = void 0;
49
+ exports.execute = execute;
49
50
  const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
50
51
  const typia_1 = __importDefault(require("typia"));
51
52
  const uuid_1 = require("uuid");
@@ -60,33 +61,137 @@ const AgenticaSelectPrompt_1 = require("../prompts/AgenticaSelectPrompt");
60
61
  const AgenticaTextPrompt_1 = require("../prompts/AgenticaTextPrompt");
61
62
  const ChatGptCompletionMessageUtil_1 = require("./ChatGptCompletionMessageUtil");
62
63
  const ChatGptHistoryDecoder_1 = require("./ChatGptHistoryDecoder");
63
- var ChatGptSelectFunctionAgent;
64
- (function (ChatGptSelectFunctionAgent) {
65
- ChatGptSelectFunctionAgent.execute = (ctx) => __awaiter(this, void 0, void 0, function* () {
64
+ const CONTAINER = {
65
+ model: "chatgpt",
66
+ options: {
67
+ reference: false,
68
+ strict: false,
69
+ separate: null
70
+ },
71
+ functions: [
72
+ {
73
+ name: "selectFunctions",
74
+ parameters: {
75
+ type: "object",
76
+ properties: {
77
+ functions: {
78
+ title: "List of target functions",
79
+ description: "List of target functions.",
80
+ type: "array",
81
+ items: {
82
+ type: "object",
83
+ properties: {
84
+ reason: {
85
+ title: "The reason of the function selection",
86
+ description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
87
+ type: "string"
88
+ },
89
+ name: {
90
+ title: "Name of the target function to call",
91
+ description: "Name of the target function to call.",
92
+ type: "string"
93
+ }
94
+ },
95
+ required: [
96
+ "reason",
97
+ "name"
98
+ ]
99
+ }
100
+ }
101
+ },
102
+ required: [
103
+ "functions"
104
+ ],
105
+ additionalProperties: false,
106
+ $defs: {}
107
+ },
108
+ description: "Select proper API functions to call.\n\nIf you A.I. agent has found some proper API functions to call\nfrom the conversation with user, please select the API functions\njust by calling this function.\n\nWhen user wants to call a same function multiply, you A.I. agent must\nlist up it multiply in the `functions` property. Otherwise the user has\nrequested to call many different functions, you A.I. agent have to assign\nthem all into the `functions` property.\n\nAlso, if you A.I. agent can't specify a specific function to call due to lack\nof specificity or homogeneity of candidate functions, just assign all of them\nby in the` functions` property` too. Instead, when you A.I. agent can specify\na specific function to call, the others would be eliminated.",
109
+ validate: (() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.functions) || _report(_exceptionable, {
110
+ path: _path + ".functions",
111
+ expected: "Array<___IChatFunctionReference>",
112
+ value: input.functions
113
+ })) && input.functions.map((elem, _index2) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
114
+ path: _path + ".functions[" + _index2 + "]",
115
+ expected: "___IChatFunctionReference",
116
+ value: elem
117
+ })) && _vo1(elem, _path + ".functions[" + _index2 + "]", true && _exceptionable) || _report(_exceptionable, {
118
+ path: _path + ".functions[" + _index2 + "]",
119
+ expected: "___IChatFunctionReference",
120
+ value: elem
121
+ })).every(flag => flag) || _report(_exceptionable, {
122
+ path: _path + ".functions",
123
+ expected: "Array<___IChatFunctionReference>",
124
+ value: input.functions
125
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
126
+ path: _path + ".reason",
127
+ expected: "string",
128
+ value: input.reason
129
+ }), "string" === typeof input.name || _report(_exceptionable, {
130
+ path: _path + ".name",
131
+ expected: "string",
132
+ value: input.name
133
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
134
+ if (false === __is(input)) {
135
+ errors = [];
136
+ _report = __typia_transform__validateReport._validateReport(errors);
137
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
138
+ path: _path + "",
139
+ expected: "__IChatFunctionReference.IProps",
140
+ value: input
141
+ })) && _vo0(input, _path + "", true) || _report(true, {
142
+ path: _path + "",
143
+ expected: "__IChatFunctionReference.IProps",
144
+ value: input
145
+ }))(input, "$input", true);
146
+ const success = 0 === errors.length;
147
+ return success ? {
148
+ success,
149
+ data: input
150
+ } : {
151
+ success,
152
+ errors,
153
+ data: input
154
+ };
155
+ }
156
+ return {
157
+ success: true,
158
+ data: input
159
+ };
160
+ }; })()
161
+ }
162
+ ]
163
+ };
164
+ function execute(ctx) {
165
+ return __awaiter(this, void 0, void 0, function* () {
66
166
  var _a, _b;
67
- if (ctx.operations.divided === undefined)
167
+ if (ctx.operations.divided === undefined) {
68
168
  return step(ctx, ctx.operations.array, 0);
169
+ }
69
170
  const stacks = ctx.operations.divided.map(() => []);
70
171
  const events = [];
71
- const prompts = yield Promise.all(ctx.operations.divided.map((operations, i) => step(Object.assign(Object.assign({}, ctx), { stack: stacks[i], dispatch: (e) => __awaiter(this, void 0, void 0, function* () {
72
- events.push(e);
73
- }) }), operations, 0)));
172
+ const prompts = yield Promise.all(ctx.operations.divided.map((operations, i) => __awaiter(this, void 0, void 0, function* () {
173
+ return step(Object.assign(Object.assign({}, ctx), { stack: stacks[i], dispatch: (e) => __awaiter(this, void 0, void 0, function* () {
174
+ events.push(e);
175
+ }) }), operations, 0);
176
+ })));
74
177
  // NO FUNCTION SELECTION, SO THAT ONLY TEXT LEFT
75
- if (stacks.every((s) => s.length === 0))
178
+ if (stacks.every(s => s.length === 0)) {
76
179
  return prompts[0];
180
+ }
77
181
  // ELITICISM
78
- else if (((_b = (_a = ctx.config) === null || _a === void 0 ? void 0 : _a.eliticism) !== null && _b !== void 0 ? _b : AgenticaConstant_1.AgenticaConstant.ELITICISM) === true)
182
+ else if (((_b = (_a = ctx.config) === null || _a === void 0 ? void 0 : _a.eliticism) !== null && _b !== void 0 ? _b : AgenticaConstant_1.AgenticaConstant.ELITICISM) === true) {
79
183
  return step(ctx, stacks
80
184
  .flat()
81
- .map((s) => ctx.operations.group
185
+ .map(s => ctx.operations.group
82
186
  .get(s.operation.controller.name)
83
187
  .get(s.operation.function.name)), 0);
188
+ }
84
189
  // RE-COLLECT SELECT FUNCTION EVENTS
85
190
  const collection = new AgenticaSelectPrompt_1.AgenticaSelectPrompt({
86
191
  id: (0, uuid_1.v4)(),
87
192
  selections: [],
88
193
  });
89
- for (const e of events)
194
+ for (const e of events) {
90
195
  if (e.type === "select") {
91
196
  collection.selections.push(e.selection);
92
197
  yield selectFunction(ctx, {
@@ -94,13 +199,16 @@ var ChatGptSelectFunctionAgent;
94
199
  reason: e.selection.reason,
95
200
  });
96
201
  }
202
+ }
97
203
  return [collection];
98
204
  });
99
- const step = (ctx, operations, retry, failures) => __awaiter(this, void 0, void 0, function* () {
100
- var _a, _b, _c, _d, _e, _f, _g, _h;
101
- //----
205
+ }
206
+ function step(ctx, operations, retry, failures) {
207
+ return __awaiter(this, void 0, void 0, function* () {
208
+ var _a, _b, _c, _d, _e, _f, _g;
209
+ // ----
102
210
  // EXECUTE CHATGPT API
103
- //----
211
+ // ----
104
212
  const completionStream = yield ctx.request("select", {
105
213
  messages: [
106
214
  // COMMON SYSTEM PROMPT
@@ -125,7 +233,7 @@ var ChatGptSelectFunctionAgent;
125
233
  {
126
234
  role: "tool",
127
235
  tool_call_id: "getApiFunctions",
128
- content: JSON.stringify(operations.map((op) => (Object.assign({ name: op.name, description: op.function.description }, (op.protocol === "http"
236
+ content: JSON.stringify(operations.map(op => (Object.assign({ name: op.name, description: op.function.description }, (op.protocol === "http"
129
237
  ? {
130
238
  method: op.function.method,
131
239
  path: op.function.path,
@@ -149,11 +257,15 @@ var ChatGptSelectFunctionAgent;
149
257
  ...emendMessages(failures !== null && failures !== void 0 ? failures : []),
150
258
  ],
151
259
  // STACK FUNCTIONS
152
- tools: CONTAINER.functions.map((func) => ({
260
+ tools: CONTAINER.functions.map(func => ({
153
261
  type: "function",
154
262
  function: {
155
263
  name: func.name,
156
264
  description: func.description,
265
+ /**
266
+ * @TODO fix it
267
+ * The property and value have a type mismatch, but it works.
268
+ */
157
269
  parameters: func.parameters,
158
270
  },
159
271
  })),
@@ -162,15 +274,16 @@ var ChatGptSelectFunctionAgent;
162
274
  });
163
275
  const chunks = yield StreamUtil_1.StreamUtil.readAll(completionStream);
164
276
  const completion = ChatGptCompletionMessageUtil_1.ChatGptCompletionMessageUtil.merge(chunks);
165
- //----
277
+ // ----
166
278
  // VALIDATION
167
- //----
279
+ // ----
168
280
  if (retry++ < ((_f = (_e = ctx.config) === null || _e === void 0 ? void 0 : _e.retry) !== null && _f !== void 0 ? _f : AgenticaConstant_1.AgenticaConstant.RETRY)) {
169
281
  const failures = [];
170
- for (const choice of completion.choices)
282
+ for (const choice of completion.choices) {
171
283
  for (const tc of (_g = choice.message.tool_calls) !== null && _g !== void 0 ? _g : []) {
172
- if (tc.function.name !== "selectFunctions")
284
+ if (tc.function.name !== "selectFunctions") {
173
285
  continue;
286
+ }
174
287
  const input = JSON.parse(tc.function.arguments);
175
288
  const validation = (() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.functions) || _report(_exceptionable, {
176
289
  path: _path + ".functions",
@@ -224,49 +337,59 @@ var ChatGptSelectFunctionAgent;
224
337
  data: input
225
338
  };
226
339
  }; })()(input);
227
- if (validation.success === false)
340
+ if (validation.success === false) {
228
341
  failures.push({
229
342
  id: tc.id,
230
343
  name: tc.function.name,
231
344
  validation,
232
345
  });
346
+ }
233
347
  }
234
- if (failures.length > 0)
348
+ }
349
+ if (failures.length > 0) {
235
350
  return step(ctx, operations, retry, failures);
351
+ }
236
352
  }
237
- //----
353
+ // ----
238
354
  // PROCESS COMPLETION
239
- //----
355
+ // ----
240
356
  const prompts = [];
241
357
  for (const choice of completion.choices) {
242
358
  // TOOL CALLING HANDLER
243
- if (choice.message.tool_calls)
359
+ if (choice.message.tool_calls != null) {
244
360
  for (const tc of choice.message.tool_calls) {
245
- if (tc.type !== "function")
361
+ if (tc.type !== "function") {
246
362
  continue;
247
- const input = JSON.parse(tc.function.arguments);
248
- if ((() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; return input => "object" === typeof input && null !== input && _io0(input); })()(input) === false)
363
+ }
364
+ if (tc.function.name !== "selectFunctions") {
249
365
  continue;
250
- else if (tc.function.name === "selectFunctions") {
251
- const collection = new AgenticaSelectPrompt_1.AgenticaSelectPrompt({
252
- id: tc.id,
253
- selections: [],
254
- });
255
- for (const reference of input.functions) {
256
- const operation = yield selectFunction(ctx, reference);
257
- if (operation !== null)
258
- collection.selections.push(new AgenticaOperationSelection_1.AgenticaOperationSelection({
259
- operation,
260
- reason: reference.reason,
261
- }));
366
+ }
367
+ const input = (() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; const __is = input => "object" === typeof input && null !== input && _io0(input); return input => { input = JSON.parse(input); return __is(input) ? input : null; }; })()(tc.function.arguments);
368
+ if (input === null) {
369
+ continue;
370
+ }
371
+ const collection = new AgenticaSelectPrompt_1.AgenticaSelectPrompt({
372
+ id: tc.id,
373
+ selections: [],
374
+ });
375
+ for (const reference of input.functions) {
376
+ const operation = yield selectFunction(ctx, reference);
377
+ if (operation === null) {
378
+ continue;
262
379
  }
263
- if (collection.selections.length !== 0)
264
- prompts.push(collection);
380
+ collection.selections.push(new AgenticaOperationSelection_1.AgenticaOperationSelection({
381
+ operation,
382
+ reason: reference.reason,
383
+ }));
384
+ }
385
+ if (collection.selections.length !== 0) {
386
+ prompts.push(collection);
265
387
  }
266
388
  }
389
+ }
267
390
  // ASSISTANT MESSAGE
268
- if (choice.message.role === "assistant" &&
269
- !!((_h = choice.message.content) === null || _h === void 0 ? void 0 : _h.length)) {
391
+ if (choice.message.role === "assistant"
392
+ && choice.message.content != null) {
270
393
  const text = new AgenticaTextPrompt_1.AgenticaTextPrompt({
271
394
  role: "assistant",
272
395
  text: choice.message.content,
@@ -275,7 +398,7 @@ var ChatGptSelectFunctionAgent;
275
398
  yield ctx.dispatch(new AgenticaTextEvent_1.AgenticaTextEvent({
276
399
  role: "assistant",
277
400
  stream: StreamUtil_1.StreamUtil.to(text.text),
278
- join: () => Promise.resolve(text.text),
401
+ join: () => __awaiter(this, void 0, void 0, function* () { return Promise.resolve(text.text); }),
279
402
  done: () => true,
280
403
  get: () => text.text,
281
404
  }));
@@ -283,10 +406,13 @@ var ChatGptSelectFunctionAgent;
283
406
  }
284
407
  return prompts;
285
408
  });
286
- const selectFunction = (ctx, reference) => __awaiter(this, void 0, void 0, function* () {
409
+ }
410
+ function selectFunction(ctx, reference) {
411
+ return __awaiter(this, void 0, void 0, function* () {
287
412
  const operation = ctx.operations.flat.get(reference.name);
288
- if (operation === undefined)
413
+ if (operation === undefined) {
289
414
  return null;
415
+ }
290
416
  const selection = new AgenticaOperationSelection_1.AgenticaOperationSelection({
291
417
  operation,
292
418
  reason: reference.reason,
@@ -297,8 +423,10 @@ var ChatGptSelectFunctionAgent;
297
423
  }));
298
424
  return operation;
299
425
  });
300
- const emendMessages = (failures) => failures
301
- .map((f) => [
426
+ }
427
+ function emendMessages(failures) {
428
+ return failures
429
+ .map(f => [
302
430
  {
303
431
  role: "assistant",
304
432
  tool_calls: [
@@ -327,105 +455,10 @@ var ChatGptSelectFunctionAgent;
327
455
  },
328
456
  ])
329
457
  .flat();
330
- })(ChatGptSelectFunctionAgent || (exports.ChatGptSelectFunctionAgent = ChatGptSelectFunctionAgent = {}));
331
- const CONTAINER = {
332
- model: "chatgpt",
333
- options: {
334
- reference: false,
335
- strict: false,
336
- separate: null
337
- },
338
- functions: [
339
- {
340
- name: "selectFunctions",
341
- parameters: {
342
- type: "object",
343
- properties: {
344
- functions: {
345
- title: "List of target functions",
346
- description: "List of target functions.",
347
- type: "array",
348
- items: {
349
- type: "object",
350
- properties: {
351
- reason: {
352
- title: "The reason of the function selection",
353
- description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
354
- type: "string"
355
- },
356
- name: {
357
- title: "Name of the target function to call",
358
- description: "Name of the target function to call.",
359
- type: "string"
360
- }
361
- },
362
- required: [
363
- "reason",
364
- "name"
365
- ]
366
- }
367
- }
368
- },
369
- required: [
370
- "functions"
371
- ],
372
- additionalProperties: false,
373
- $defs: {}
374
- },
375
- description: "Select proper API functions to call.\n\nIf you A.I. agent has found some proper API functions to call\nfrom the conversation with user, please select the API functions\njust by calling this function.\n\nWhen user wants to call a same function multiply, you A.I. agent must\nlist up it multiply in the `functions` property. Otherwise the user has\nrequested to call many different functions, you A.I. agent have to assign\nthem all into the `functions` property.\n\nAlso, if you A.I. agent can't specify a specific function to call due to lack\nof specificity or homogeneity of candidate functions, just assign all of them\nby in the` functions` property` too. Instead, when you A.I. agent can specify\na specific function to call, the others would be eliminated.",
376
- validate: (() => { const _io0 = input => Array.isArray(input.functions) && input.functions.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "string" === typeof input.reason && "string" === typeof input.name; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.functions) || _report(_exceptionable, {
377
- path: _path + ".functions",
378
- expected: "Array<___IChatFunctionReference>",
379
- value: input.functions
380
- })) && input.functions.map((elem, _index2) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
381
- path: _path + ".functions[" + _index2 + "]",
382
- expected: "___IChatFunctionReference",
383
- value: elem
384
- })) && _vo1(elem, _path + ".functions[" + _index2 + "]", true && _exceptionable) || _report(_exceptionable, {
385
- path: _path + ".functions[" + _index2 + "]",
386
- expected: "___IChatFunctionReference",
387
- value: elem
388
- })).every(flag => flag) || _report(_exceptionable, {
389
- path: _path + ".functions",
390
- expected: "Array<___IChatFunctionReference>",
391
- value: input.functions
392
- })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
393
- path: _path + ".reason",
394
- expected: "string",
395
- value: input.reason
396
- }), "string" === typeof input.name || _report(_exceptionable, {
397
- path: _path + ".name",
398
- expected: "string",
399
- value: input.name
400
- })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
401
- if (false === __is(input)) {
402
- errors = [];
403
- _report = __typia_transform__validateReport._validateReport(errors);
404
- ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
405
- path: _path + "",
406
- expected: "__IChatFunctionReference.IProps",
407
- value: input
408
- })) && _vo0(input, _path + "", true) || _report(true, {
409
- path: _path + "",
410
- expected: "__IChatFunctionReference.IProps",
411
- value: input
412
- }))(input, "$input", true);
413
- const success = 0 === errors.length;
414
- return success ? {
415
- success,
416
- data: input
417
- } : {
418
- success,
419
- errors,
420
- data: input
421
- };
422
- }
423
- return {
424
- success: true,
425
- data: input
426
- };
427
- }; })()
428
- }
429
- ]
458
+ }
459
+ exports.ChatGptSelectFunctionAgent = {
460
+ execute,
461
+ selectFunction,
462
+ emendMessages,
430
463
  };
431
464
  //# sourceMappingURL=ChatGptSelectFunctionAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatGptSelectFunctionAgent.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptSelectFunctionAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kDAA2C;AAC3C,+BAA0B;AAI1B,sFAAmF;AAInF,uEAAoE;AACpE,mEAAgE;AAChE,mEAAgE;AAChE,6EAA0E;AAC1E,2EAAwE;AACxE,uDAAoD;AAEpD,0EAAuE;AACvE,sEAAmE;AACnE,iFAA8E;AAC9E,mEAAgE;AAEhE,IAAiB,0BAA0B,CAoR1C;AApRD,WAAiB,0BAA0B;IAC5B,kCAAO,GAAG,CACrB,GAA2B,EACO,EAAE;;QACpC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,KAAK,SAAS;YACtC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE5C,MAAM,MAAM,GACV,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,MAAM,OAAO,GAA8B,MAAM,OAAO,CAA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AAU,EAAE;gBACV;oBACE,IAAI,EAAE,UAAU;oBAChB,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,QAAQ,EAAE;wBACR,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;qBAC7C;iBACF;aACF;SACmD;QACtD;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;YAC5C,YAAY,EAAE,CAAC,CAAC,EAAE;SAC6B;QACjD;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,wDAAwD;gBACxD,EAAE;gBACF,0CAA0C;aAC3C,CAAC,IAAI,CAAC,IAAI,CAAC;SACqC;KACtD,CAAC;SACD,IAAI,EAAE,CAAC;AACZ,CAAC;AAEY,QAAA,0BAA0B,GAAG;IACxC,OAAO;IACP,cAAc;IACd,aAAa;CACd,CAAC"}
@@ -1,6 +1,9 @@
1
- import { CompletionUsage } from "openai/resources";
2
- export declare namespace ChatGptUsageAggregator {
3
- const sumCompletionTokenDetail: (x: CompletionUsage.CompletionTokensDetails, y: CompletionUsage.CompletionTokensDetails) => CompletionUsage.CompletionTokensDetails;
4
- const sumPromptTokenDetail: (x: CompletionUsage.PromptTokensDetails, y: CompletionUsage.PromptTokensDetails) => CompletionUsage.PromptTokensDetails;
5
- const sum: (x: CompletionUsage, y: CompletionUsage) => CompletionUsage;
6
- }
1
+ import type { CompletionUsage } from "openai/resources";
2
+ export declare function sumCompletionTokenDetail(x: CompletionUsage.CompletionTokensDetails, y: CompletionUsage.CompletionTokensDetails): CompletionUsage.CompletionTokensDetails;
3
+ export declare function sumPromptTokenDetail(x: CompletionUsage.PromptTokensDetails, y: CompletionUsage.PromptTokensDetails): CompletionUsage.PromptTokensDetails;
4
+ export declare function sum(x: CompletionUsage, y: CompletionUsage): CompletionUsage;
5
+ export declare const ChatGptUsageAggregator: {
6
+ sum: typeof sum;
7
+ sumCompletionTokenDetail: typeof sumCompletionTokenDetail;
8
+ sumPromptTokenDetail: typeof sumPromptTokenDetail;
9
+ };