@agentica/core 0.12.21 → 0.13.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/README.md +50 -47
- package/lib/Agentica.d.ts +9 -9
- package/lib/Agentica.js +23 -16
- package/lib/Agentica.js.map +1 -1
- package/lib/chatgpt/ChatGptAgent.d.ts +7 -7
- package/lib/chatgpt/ChatGptAgent.js +17 -12
- package/lib/chatgpt/ChatGptAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +7 -6
- package/lib/chatgpt/ChatGptCallFunctionAgent.js +121 -81
- package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +9 -7
- package/lib/chatgpt/ChatGptCancelFunctionAgent.js +177 -145
- package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCompletionMessageUtil.d.ts +13 -8
- package/lib/chatgpt/ChatGptCompletionMessageUtil.js +499 -489
- package/lib/chatgpt/ChatGptCompletionMessageUtil.js.map +1 -1
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +7 -6
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.js +33 -32
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +7 -6
- package/lib/chatgpt/ChatGptHistoryDecoder.js +60 -56
- package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +7 -6
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +121 -116
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +20 -5
- package/lib/chatgpt/ChatGptSelectFunctionAgent.js +183 -150
- package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptUsageAggregator.d.ts +9 -6
- package/lib/chatgpt/ChatGptUsageAggregator.js +46 -41
- package/lib/chatgpt/ChatGptUsageAggregator.js.map +1 -1
- package/lib/context/AgenticaCancelPrompt.d.ts +3 -3
- package/lib/context/AgenticaCancelPrompt.js +1 -1
- package/lib/context/AgenticaCancelPrompt.js.map +1 -1
- package/lib/context/AgenticaClassOperation.d.ts +1 -1
- package/lib/context/AgenticaClassOperation.js.map +1 -1
- package/lib/context/AgenticaContext.d.ts +9 -9
- package/lib/context/AgenticaHttpOperation.d.ts +1 -1
- package/lib/context/AgenticaHttpOperation.js.map +1 -1
- package/lib/context/AgenticaOperation.d.ts +4 -4
- package/lib/context/AgenticaOperationBase.d.ts +1 -1
- package/lib/context/AgenticaOperationCollection.d.ts +2 -2
- package/lib/context/AgenticaOperationSelection.d.ts +3 -3
- package/lib/context/AgenticaTokenUsage.d.ts +1 -1
- package/lib/context/AgenticaTokenUsage.js.map +1 -1
- package/lib/context/internal/AgenticaTokenUsageAggregator.d.ts +11 -10
- package/lib/context/internal/AgenticaTokenUsageAggregator.js +42 -43
- package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
- package/lib/context/internal/__IChatCancelFunctionsApplication.d.ts +2 -2
- package/lib/context/internal/__IChatInitialApplication.d.ts +2 -2
- package/lib/context/internal/__IChatSelectFunctionsApplication.d.ts +2 -2
- package/lib/events/AgenticaCallEvent.d.ts +3 -3
- package/lib/events/AgenticaCancelEvent.d.ts +3 -3
- package/lib/events/AgenticaDescribeEvent.d.ts +3 -3
- package/lib/events/AgenticaDescribeEvent.js +13 -2
- package/lib/events/AgenticaDescribeEvent.js.map +1 -1
- package/lib/events/AgenticaEvent.d.ts +12 -12
- package/lib/events/AgenticaExecuteEvent.d.ts +7 -7
- package/lib/events/AgenticaInitializeEvent.d.ts +1 -1
- package/lib/events/AgenticaRequestEvent.d.ts +3 -3
- package/lib/events/AgenticaRequestEvent.js.map +1 -1
- package/lib/events/AgenticaResponseEvent.d.ts +2 -2
- package/lib/events/AgenticaResponseEvent.js.map +1 -1
- package/lib/events/AgenticaSelectEvent.d.ts +3 -3
- package/lib/events/AgenticaSelectEvent.js.map +1 -1
- package/lib/events/AgenticaTextEvent.d.ts +1 -1
- package/lib/events/AgenticaTextEvent.js +12 -1
- package/lib/events/AgenticaTextEvent.js.map +1 -1
- package/lib/functional/assertHttpLlmApplication.d.ts +4 -3
- package/lib/functional/assertHttpLlmApplication.js +9339 -9338
- package/lib/functional/assertHttpLlmApplication.js.map +1 -1
- package/lib/functional/validateHttpLlmApplication.d.ts +5 -4
- package/lib/functional/validateHttpLlmApplication.js +19 -19
- package/lib/functional/validateHttpLlmApplication.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.js +21 -21
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +19211 -18997
- package/lib/index.mjs.map +1 -1
- package/lib/internal/AgenticaDefaultPrompt.d.ts +6 -5
- package/lib/internal/AgenticaDefaultPrompt.js +39 -19
- package/lib/internal/AgenticaDefaultPrompt.js.map +1 -1
- package/lib/internal/AgenticaOperationComposer.d.ts +11 -10
- package/lib/internal/AgenticaOperationComposer.js +60 -59
- package/lib/internal/AgenticaOperationComposer.js.map +1 -1
- package/lib/internal/AgenticaSystemPrompt.d.ts +8 -8
- package/lib/internal/AgenticaSystemPrompt.js +9 -9
- package/lib/internal/AgenticaSystemPrompt.js.map +1 -1
- package/lib/internal/AsyncQueue.d.ts +15 -0
- package/lib/internal/AsyncQueue.js +82 -0
- package/lib/internal/AsyncQueue.js.map +1 -0
- package/lib/internal/ByteArrayUtil.d.ts +1 -1
- package/lib/internal/ByteArrayUtil.js +3 -2
- package/lib/internal/ByteArrayUtil.js.map +1 -1
- package/lib/internal/MPSC.d.ts +10 -0
- package/lib/internal/MPSC.js +49 -0
- package/lib/internal/MPSC.js.map +1 -0
- package/lib/internal/Singleton.js +6 -5
- package/lib/internal/Singleton.js.map +1 -1
- package/lib/internal/StreamUtil.d.ts +16 -6
- package/lib/internal/StreamUtil.js +43 -29
- package/lib/internal/StreamUtil.js.map +1 -1
- package/lib/internal/__map_take.js +5 -5
- package/lib/internal/__map_take.js.map +1 -1
- package/lib/json/IAgenticaEventJson.d.ts +7 -7
- package/lib/json/IAgenticaOperationSelectionJson.d.ts +1 -1
- package/lib/json/IAgenticaPromptJson.d.ts +2 -2
- package/lib/prompts/AgenticaCancelPrompt.d.ts +3 -3
- package/lib/prompts/AgenticaCancelPrompt.js +1 -1
- package/lib/prompts/AgenticaCancelPrompt.js.map +1 -1
- package/lib/prompts/AgenticaDescribePrompt.d.ts +3 -3
- package/lib/prompts/AgenticaDescribePrompt.js +1 -1
- package/lib/prompts/AgenticaDescribePrompt.js.map +1 -1
- package/lib/prompts/AgenticaExecutePrompt.d.ts +5 -5
- package/lib/prompts/AgenticaExecutePrompt.js.map +1 -1
- package/lib/prompts/AgenticaPrompt.d.ts +6 -6
- package/lib/prompts/AgenticaSelectPrompt.d.ts +3 -3
- package/lib/prompts/AgenticaSelectPrompt.js +1 -1
- package/lib/prompts/AgenticaSelectPrompt.js.map +1 -1
- package/lib/prompts/AgenticaTextPrompt.d.ts +1 -1
- package/lib/structures/IAgenticaConfig.d.ts +5 -5
- package/lib/structures/IAgenticaController.d.ts +1 -1
- package/lib/structures/IAgenticaExecutor.d.ts +4 -4
- package/lib/structures/IAgenticaProps.d.ts +5 -5
- package/lib/structures/IAgenticaSystemPrompt.d.ts +4 -4
- package/lib/structures/IAgenticaVendor.d.ts +1 -1
- package/lib/transformers/AgenticaEventTransformer.d.ts +55 -37
- package/lib/transformers/AgenticaEventTransformer.js +105 -58
- package/lib/transformers/AgenticaEventTransformer.js.map +1 -1
- package/lib/transformers/AgenticaPromptTransformer.d.ts +35 -29
- package/lib/transformers/AgenticaPromptTransformer.js +74 -45
- package/lib/transformers/AgenticaPromptTransformer.js.map +1 -1
- package/package.json +20 -23
- package/prompts/cancel.md +1 -1
- package/prompts/common.md +1 -1
- package/prompts/describe.md +1 -1
- package/prompts/execute.md +1 -1
- package/prompts/initialize.md +1 -1
- package/prompts/select.md +1 -1
- package/src/Agentica.ts +41 -31
- package/src/chatgpt/ChatGptAgent.ts +63 -57
- package/src/chatgpt/ChatGptCallFunctionAgent.ts +363 -337
- package/src/chatgpt/ChatGptCancelFunctionAgent.ts +188 -164
- package/src/chatgpt/ChatGptCompletionMessageUtil.ts +136 -137
- package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +105 -101
- package/src/chatgpt/ChatGptHistoryDecoder.ts +69 -65
- package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +128 -123
- package/src/chatgpt/ChatGptSelectFunctionAgent.ts +215 -189
- package/src/chatgpt/ChatGptUsageAggregator.ts +49 -54
- package/src/context/AgenticaCancelPrompt.ts +4 -4
- package/src/context/AgenticaClassOperation.ts +5 -5
- package/src/context/AgenticaContext.ts +15 -15
- package/src/context/AgenticaHttpOperation.ts +5 -5
- package/src/context/AgenticaOperation.ts +4 -4
- package/src/context/AgenticaOperationBase.ts +1 -1
- package/src/context/AgenticaOperationCollection.ts +2 -2
- package/src/context/AgenticaOperationSelection.ts +3 -3
- package/src/context/AgenticaTokenUsage.ts +4 -3
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +59 -59
- package/src/context/internal/__IChatCancelFunctionsApplication.ts +2 -2
- package/src/context/internal/__IChatInitialApplication.ts +2 -2
- package/src/context/internal/__IChatSelectFunctionsApplication.ts +2 -2
- package/src/events/AgenticaCallEvent.ts +3 -3
- package/src/events/AgenticaCancelEvent.ts +3 -3
- package/src/events/AgenticaDescribeEvent.ts +5 -5
- package/src/events/AgenticaEvent.ts +12 -12
- package/src/events/AgenticaExecuteEvent.ts +7 -7
- package/src/events/AgenticaInitializeEvent.ts +1 -1
- package/src/events/AgenticaRequestEvent.ts +3 -3
- package/src/events/AgenticaResponseEvent.ts +2 -2
- package/src/events/AgenticaSelectEvent.ts +4 -4
- package/src/events/AgenticaTextEvent.ts +2 -2
- package/src/functional/assertHttpLlmApplication.ts +9 -6
- package/src/functional/validateHttpLlmApplication.ts +14 -8
- package/src/index.ts +24 -24
- package/src/internal/AgenticaDefaultPrompt.ts +42 -28
- package/src/internal/AgenticaOperationComposer.ts +63 -61
- package/src/internal/AgenticaSystemPrompt.ts +15 -14
- package/src/internal/AsyncQueue.ts +67 -0
- package/src/internal/ByteArrayUtil.ts +2 -2
- package/src/internal/MPSC.ts +40 -0
- package/src/internal/Singleton.ts +8 -6
- package/src/internal/StreamUtil.ts +62 -53
- package/src/internal/__map_take.ts +5 -7
- package/src/json/IAgenticaEventJson.ts +7 -8
- package/src/json/IAgenticaOperationSelectionJson.ts +1 -1
- package/src/json/IAgenticaPromptJson.ts +2 -2
- package/src/prompts/AgenticaCancelPrompt.ts +4 -4
- package/src/prompts/AgenticaDescribePrompt.ts +4 -4
- package/src/prompts/AgenticaExecutePrompt.ts +6 -5
- package/src/prompts/AgenticaPrompt.ts +6 -6
- package/src/prompts/AgenticaSelectPrompt.ts +4 -4
- package/src/prompts/AgenticaTextPrompt.ts +1 -1
- package/src/structures/IAgenticaConfig.ts +5 -5
- package/src/structures/IAgenticaController.ts +14 -14
- package/src/structures/IAgenticaExecutor.ts +4 -4
- package/src/structures/IAgenticaProps.ts +5 -5
- package/src/structures/IAgenticaSystemPrompt.ts +4 -4
- package/src/structures/IAgenticaVendor.ts +1 -1
- package/src/transformers/AgenticaEventTransformer.ts +169 -136
- package/src/transformers/AgenticaPromptTransformer.ts +125 -103
- package/lib/internal/MPSCUtil.d.ts +0 -35
- package/lib/internal/MPSCUtil.js +0 -105
- package/lib/internal/MPSCUtil.js.map +0 -1
- package/src/internal/MPSCUtil.ts +0 -111
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatGptInitializeFunctionAgent.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptInitializeFunctionAgent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatGptInitializeFunctionAgent.js","sourceRoot":"","sources":["../../src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O,CAAC,UAAU,IAAI,IAAI;eACzB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAC1B,EAAE,CAAC,EAAE,CACH,EAAE,CAAC,IAAI,KAAK,UAAU,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAC/D,CACJ,EACD,CAAC;YAAC,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC;QAAC,CAAC;QAE7B,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAEY,QAAA,8BAA8B,GAAG;IAC5C,OAAO;CACR,CAAC"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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) =>
|
|
72
|
-
|
|
73
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
100
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
248
|
-
if (
|
|
363
|
+
}
|
|
364
|
+
if (tc.function.name !== "selectFunctions") {
|
|
249
365
|
continue;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
264
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
301
|
-
|
|
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
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"ChatGptSelectFunctionAgent.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptSelectFunctionAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,0BA2DC;;AApFD,kDAA0B;AAC1B,+BAA0B;AAC1B,sFAAmF;AACnF,uEAAoE;AACpE,mEAAgE;AAChE,mEAAgE;AAChE,6EAA0E;AAC1E,2EAAwE;AACxE,uDAAoD;AACpD,0EAAuE;AACvE,sEAAmE;AACnE,iFAA8E;AAC9E,mEAAgE;AAEhE,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A0B,CAAC;YAC/B,SAAS;YACT,MAAM,EAAE,SAAS,CAAC,MAAM;SACzB,CAAC,CAAC;QACP,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1B,KAAK,GAAG,CAAC,QAAQ,CACf,IAAI,yCAAmB,CAAC;YACtB,SAAS;SACV,CAAC,CACH,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;CAAA;AAED,SAAS,aAAa,CAAC,QAAoB;IACzC,OAAO,QAAQ;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACN;YACE,IAAI,EAAE,WAAW;YACjB,UAAU,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
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
};
|