@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,48 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChatGptUsageAggregator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
exports.sumCompletionTokenDetail = sumCompletionTokenDetail;
|
|
5
|
+
exports.sumPromptTokenDetail = sumPromptTokenDetail;
|
|
6
|
+
exports.sum = sum;
|
|
7
|
+
function sumCompletionTokenDetail(x, y) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
|
+
return {
|
|
10
|
+
accepted_prediction_tokens: ((_a = x.accepted_prediction_tokens) !== null && _a !== void 0 ? _a : 0)
|
|
11
|
+
+ ((_b = y.accepted_prediction_tokens) !== null && _b !== void 0 ? _b : 0),
|
|
12
|
+
reasoning_tokens: ((_c = x.reasoning_tokens) !== null && _c !== void 0 ? _c : 0) + ((_d = y.reasoning_tokens) !== null && _d !== void 0 ? _d : 0),
|
|
13
|
+
rejected_prediction_tokens: ((_e = x.rejected_prediction_tokens) !== null && _e !== void 0 ? _e : 0)
|
|
14
|
+
+ ((_f = y.rejected_prediction_tokens) !== null && _f !== void 0 ? _f : 0),
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
}
|
|
17
|
+
function sumPromptTokenDetail(x, y) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
return {
|
|
20
|
+
audio_tokens: ((_a = x.audio_tokens) !== null && _a !== void 0 ? _a : 0) + ((_b = y.audio_tokens) !== null && _b !== void 0 ? _b : 0),
|
|
21
|
+
cached_tokens: ((_c = x.cached_tokens) !== null && _c !== void 0 ? _c : 0) + ((_d = y.cached_tokens) !== null && _d !== void 0 ? _d : 0),
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
23
|
+
}
|
|
24
|
+
function sum(x, y) {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
26
|
+
return {
|
|
27
|
+
prompt_tokens: ((_a = x.prompt_tokens) !== null && _a !== void 0 ? _a : 0) + ((_b = y.prompt_tokens) !== null && _b !== void 0 ? _b : 0),
|
|
28
|
+
completion_tokens: ((_c = x.completion_tokens) !== null && _c !== void 0 ? _c : 0) + ((_d = y.completion_tokens) !== null && _d !== void 0 ? _d : 0),
|
|
29
|
+
total_tokens: ((_e = x.total_tokens) !== null && _e !== void 0 ? _e : 0) + ((_f = y.total_tokens) !== null && _f !== void 0 ? _f : 0),
|
|
30
|
+
completion_tokens_details: sumCompletionTokenDetail((_g = x.completion_tokens_details) !== null && _g !== void 0 ? _g : {
|
|
31
|
+
accepted_prediction_tokens: 0,
|
|
32
|
+
reasoning_tokens: 0,
|
|
33
|
+
rejected_prediction_tokens: 0,
|
|
34
|
+
}, (_h = y.completion_tokens_details) !== null && _h !== void 0 ? _h : {
|
|
35
|
+
accepted_prediction_tokens: 0,
|
|
36
|
+
reasoning_tokens: 0,
|
|
37
|
+
rejected_prediction_tokens: 0,
|
|
38
|
+
}),
|
|
39
|
+
prompt_tokens_details: sumPromptTokenDetail((_j = x.prompt_tokens_details) !== null && _j !== void 0 ? _j : {
|
|
40
|
+
audio_tokens: 0,
|
|
41
|
+
cached_tokens: 0,
|
|
42
|
+
}, (_k = y.prompt_tokens_details) !== null && _k !== void 0 ? _k : {
|
|
43
|
+
audio_tokens: 0,
|
|
44
|
+
cached_tokens: 0,
|
|
45
|
+
}),
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
|
+
exports.ChatGptUsageAggregator = {
|
|
49
|
+
sum,
|
|
50
|
+
sumCompletionTokenDetail,
|
|
51
|
+
sumPromptTokenDetail,
|
|
52
|
+
};
|
|
48
53
|
//# sourceMappingURL=ChatGptUsageAggregator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatGptUsageAggregator.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptUsageAggregator.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"ChatGptUsageAggregator.js","sourceRoot":"","sources":["../../src/chatgpt/ChatGptUsageAggregator.ts"],"names":[],"mappings":";;;AAEA,4DAUC;AAED,oDAKC;AAED,kBA6BC;AAhDD,SAAgB,wBAAwB,CAAC,CAA0C,EAAE,CAA0C;;IAC7H,OAAO;QACL,0BAA0B,EACtB,CAAC,MAAA,CAAC,CAAC,0BAA0B,mCAAI,CAAC,CAAC;cACjC,CAAC,MAAA,CAAC,CAAC,0BAA0B,mCAAI,CAAC,CAAC;QACzC,gBAAgB,EAAE,CAAC,MAAA,CAAC,CAAC,gBAAgB,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,gBAAgB,mCAAI,CAAC,CAAC;QACvE,0BAA0B,EACtB,CAAC,MAAA,CAAC,CAAC,0BAA0B,mCAAI,CAAC,CAAC;cACjC,CAAC,MAAA,CAAC,CAAC,0BAA0B,mCAAI,CAAC,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,CAAsC,EAAE,CAAsC;;IACjH,OAAO;QACL,YAAY,EAAE,CAAC,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,CAAC;QAC3D,aAAa,EAAE,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED,SAAgB,GAAG,CAAC,CAAkB,EAAE,CAAkB;;IACxD,OAAO;QACL,aAAa,EAAE,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,aAAa,mCAAI,CAAC,CAAC;QAC9D,iBAAiB,EACb,CAAC,MAAA,CAAC,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,iBAAiB,mCAAI,CAAC,CAAC;QAC3D,YAAY,EAAE,CAAC,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,YAAY,mCAAI,CAAC,CAAC;QAC3D,yBAAyB,EAAE,wBAAwB,CACjD,MAAA,CAAC,CAAC,yBAAyB,mCAAI;YAC7B,0BAA0B,EAAE,CAAC;YAC7B,gBAAgB,EAAE,CAAC;YACnB,0BAA0B,EAAE,CAAC;SAC9B,EACD,MAAA,CAAC,CAAC,yBAAyB,mCAAI;YAC7B,0BAA0B,EAAE,CAAC;YAC7B,gBAAgB,EAAE,CAAC;YACnB,0BAA0B,EAAE,CAAC;SAC9B,CACF;QACD,qBAAqB,EAAE,oBAAoB,CACzC,MAAA,CAAC,CAAC,qBAAqB,mCAAI;YACzB,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;SACjB,EACD,MAAA,CAAC,CAAC,qBAAqB,mCAAI;YACzB,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;SACjB,CACF;KACF,CAAC;AACJ,CAAC;AAEY,QAAA,sBAAsB,GAAG;IACpC,GAAG;IACH,wBAAwB;IACxB,oBAAoB;CACrB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
3
|
+
import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
|
|
3
4
|
import { AgenticaPromptBase } from "../prompts/AgenticaPromptBase";
|
|
4
|
-
import { AgenticaOperationSelection } from "./AgenticaOperationSelection";
|
|
5
5
|
export declare class AgenticaCancelPrompt<Model extends ILlmSchema.Model> extends AgenticaPromptBase<"cancel", IAgenticaPromptJson.ICancel> {
|
|
6
6
|
readonly id: string;
|
|
7
7
|
readonly selections: AgenticaOperationSelection<Model>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaCancelPrompt.js","sourceRoot":"","sources":["../../src/context/AgenticaCancelPrompt.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AgenticaCancelPrompt.js","sourceRoot":"","sources":["../../src/context/AgenticaCancelPrompt.ts"],"names":[],"mappings":";;;AAIA,sEAAmE;AAEnE,MAAa,oBAEX,SAAQ,uCAAyD;IAIjE,YAAmB,KAAyC;QAC1D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACrC,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC;CACF;AAnBD,oDAmBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILlmApplication, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
1
|
+
import type { ILlmApplication, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { AgenticaOperationBase } from "./AgenticaOperationBase";
|
|
3
3
|
export declare class AgenticaClassOperation<Model extends ILlmSchema.Model> extends AgenticaOperationBase<"class", ILlmApplication<Model>, ILlmFunction<Model>> {
|
|
4
4
|
constructor(props: AgenticaClassOperation.IProps<Model>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaClassOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaClassOperation.ts"],"names":[],"mappings":";;;AAEA,mEAAgE;AAEhE,MAAa,sBAEX,SAAQ,
|
|
1
|
+
{"version":3,"file":"AgenticaClassOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaClassOperation.ts"],"names":[],"mappings":";;;AAEA,mEAAgE;AAEhE,MAAa,sBAEX,SAAQ,6CAIP;IACD,YAAmB,KAA2C;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAVD,wDAUC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import OpenAI from "openai";
|
|
3
|
-
import { AgenticaEvent } from "../events/AgenticaEvent";
|
|
4
|
-
import { AgenticaEventSource } from "../events/AgenticaEventSource";
|
|
5
|
-
import { AgenticaPrompt } from "../prompts/AgenticaPrompt";
|
|
6
|
-
import { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
|
|
7
|
-
import { IAgenticaConfig } from "../structures/IAgenticaConfig";
|
|
8
|
-
import { AgenticaOperationCollection } from "./AgenticaOperationCollection";
|
|
9
|
-
import { AgenticaOperationSelection } from "./AgenticaOperationSelection";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type OpenAI from "openai";
|
|
3
|
+
import type { AgenticaEvent } from "../events/AgenticaEvent";
|
|
4
|
+
import type { AgenticaEventSource } from "../events/AgenticaEventSource";
|
|
5
|
+
import type { AgenticaPrompt } from "../prompts/AgenticaPrompt";
|
|
6
|
+
import type { AgenticaTextPrompt } from "../prompts/AgenticaTextPrompt";
|
|
7
|
+
import type { IAgenticaConfig } from "../structures/IAgenticaConfig";
|
|
8
|
+
import type { AgenticaOperationCollection } from "./AgenticaOperationCollection";
|
|
9
|
+
import type { AgenticaOperationSelection } from "./AgenticaOperationSelection";
|
|
10
10
|
/**
|
|
11
11
|
* Context of the Nestia A.I. agent.
|
|
12
12
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpLlmApplication, IHttpLlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
1
|
+
import type { IHttpLlmApplication, IHttpLlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import { AgenticaOperationBase } from "./AgenticaOperationBase";
|
|
3
3
|
export declare class AgenticaHttpOperation<Model extends ILlmSchema.Model> extends AgenticaOperationBase<"http", IHttpLlmApplication<Model>, IHttpLlmFunction<Model>> {
|
|
4
4
|
constructor(props: AgenticaHttpOperation.IProps<Model>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaHttpOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaHttpOperation.ts"],"names":[],"mappings":";;;AAMA,mEAAgE;AAEhE,MAAa,qBAEX,SAAQ,
|
|
1
|
+
{"version":3,"file":"AgenticaHttpOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaHttpOperation.ts"],"names":[],"mappings":";;;AAMA,mEAAgE;AAEhE,MAAa,qBAEX,SAAQ,6CAIP;IACD,YAAmB,KAA0C;QAC3D,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAVD,sDAUC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IHttpLlmFunction, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
3
|
-
import { IAgenticaController } from "../structures/IAgenticaController";
|
|
1
|
+
import type { IHttpLlmFunction, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
3
|
+
import type { IAgenticaController } from "../structures/IAgenticaController";
|
|
4
4
|
/**
|
|
5
5
|
* Operation information in the Agentica Agent.
|
|
6
6
|
*
|
|
@@ -40,7 +40,7 @@ export declare namespace AgenticaOperation {
|
|
|
40
40
|
/**
|
|
41
41
|
* Convert to primitive JSON object.
|
|
42
42
|
*/
|
|
43
|
-
toJSON()
|
|
43
|
+
toJSON: () => IAgenticaOperationJson;
|
|
44
44
|
}
|
|
45
45
|
export {};
|
|
46
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
1
|
+
import type { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
2
2
|
export declare abstract class AgenticaOperationBase<Protocol extends "http" | "class", Controller extends object, Function extends object> {
|
|
3
3
|
/**
|
|
4
4
|
* Protocol discriminator.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { AgenticaOperation } from "./AgenticaOperation";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaOperation } from "./AgenticaOperation";
|
|
3
3
|
/**
|
|
4
4
|
* Collection of operations used in the Nestia Agent.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { IAgenticaOperationSelectionJson } from "../json/IAgenticaOperationSelectionJson";
|
|
3
|
-
import { AgenticaOperation } from "./AgenticaOperation";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { IAgenticaOperationSelectionJson } from "../json/IAgenticaOperationSelectionJson";
|
|
3
|
+
import type { AgenticaOperation } from "./AgenticaOperation";
|
|
4
4
|
export declare class AgenticaOperationSelection<Model extends ILlmSchema.Model> {
|
|
5
5
|
readonly operation: AgenticaOperation<Model>;
|
|
6
6
|
readonly reason: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaTokenUsage.js","sourceRoot":"","sources":["../../src/context/AgenticaTokenUsage.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"AgenticaTokenUsage.js","sourceRoot":"","sources":["../../src/context/AgenticaTokenUsage.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { CompletionUsage } from "openai/resources";
|
|
2
|
-
import { IAgenticaTokenUsageJson } from "../../json/IAgenticaTokenUsageJson";
|
|
3
|
-
import { AgenticaTokenUsage } from "../AgenticaTokenUsage";
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { CompletionUsage } from "openai/resources";
|
|
2
|
+
import type { IAgenticaTokenUsageJson } from "../../json/IAgenticaTokenUsageJson";
|
|
3
|
+
import type { AgenticaTokenUsage } from "../AgenticaTokenUsage";
|
|
4
|
+
export declare function aggregate(props: {
|
|
5
|
+
kind: Exclude<keyof IAgenticaTokenUsageJson, "aggregate">;
|
|
6
|
+
completionUsage: CompletionUsage;
|
|
7
|
+
usage: AgenticaTokenUsage;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare const AgenticaTokenUsageAggregator: {
|
|
10
|
+
aggregate: typeof aggregate;
|
|
11
|
+
};
|
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgenticaTokenUsageAggregator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})(AgenticaTokenUsageAggregator || (exports.AgenticaTokenUsageAggregator = AgenticaTokenUsageAggregator = {}));
|
|
4
|
+
exports.aggregate = aggregate;
|
|
5
|
+
function aggregate(props) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7
|
+
// ----
|
|
8
|
+
// COMPONENT
|
|
9
|
+
// ----
|
|
10
|
+
const component = props.usage[props.kind];
|
|
11
|
+
// TOTAL
|
|
12
|
+
component.total += props.completionUsage.total_tokens;
|
|
13
|
+
// PROMPT
|
|
14
|
+
component.input.total += props.completionUsage.prompt_tokens;
|
|
15
|
+
component.input.total
|
|
16
|
+
+= (_b = (_a = props.completionUsage.prompt_tokens_details) === null || _a === void 0 ? void 0 : _a.audio_tokens) !== null && _b !== void 0 ? _b : 0;
|
|
17
|
+
component.input.cached
|
|
18
|
+
+= (_d = (_c = props.completionUsage.prompt_tokens_details) === null || _c === void 0 ? void 0 : _c.cached_tokens) !== null && _d !== void 0 ? _d : 0;
|
|
19
|
+
// COMPLETION
|
|
20
|
+
component.output.total += props.completionUsage.completion_tokens;
|
|
21
|
+
component.output.accepted_prediction
|
|
22
|
+
+= (_f = (_e = props.completionUsage.completion_tokens_details) === null || _e === void 0 ? void 0 : _e.accepted_prediction_tokens) !== null && _f !== void 0 ? _f : 0;
|
|
23
|
+
component.output.reasoning
|
|
24
|
+
+= (_h = (_g = props.completionUsage.completion_tokens_details) === null || _g === void 0 ? void 0 : _g.reasoning_tokens) !== null && _h !== void 0 ? _h : 0;
|
|
25
|
+
component.output.rejected_prediction
|
|
26
|
+
+= (_k = (_j = props.completionUsage.completion_tokens_details) === null || _j === void 0 ? void 0 : _j.rejected_prediction_tokens) !== null && _k !== void 0 ? _k : 0;
|
|
27
|
+
// ----
|
|
28
|
+
// RE-AGGREGATE
|
|
29
|
+
// ----
|
|
30
|
+
const sum = (getter) => Object.entries(props.usage)
|
|
31
|
+
.filter(([key]) => key !== "aggregate")
|
|
32
|
+
.map(([, comp]) => getter(comp))
|
|
33
|
+
.reduce((a, b) => a + b, 0);
|
|
34
|
+
const aggregate = props.usage.aggregate;
|
|
35
|
+
aggregate.total = sum(comp => comp.total);
|
|
36
|
+
aggregate.input.total = sum(comp => comp.input.total);
|
|
37
|
+
aggregate.input.cached = sum(comp => comp.input.cached);
|
|
38
|
+
aggregate.output.total = sum(comp => comp.output.total);
|
|
39
|
+
aggregate.output.reasoning = sum(comp => comp.output.reasoning);
|
|
40
|
+
aggregate.output.accepted_prediction = sum(comp => comp.output.accepted_prediction);
|
|
41
|
+
aggregate.output.rejected_prediction = sum(comp => comp.output.rejected_prediction);
|
|
42
|
+
}
|
|
43
|
+
exports.AgenticaTokenUsageAggregator = {
|
|
44
|
+
aggregate,
|
|
45
|
+
};
|
|
47
46
|
//# sourceMappingURL=AgenticaTokenUsageAggregator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaTokenUsageAggregator.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaTokenUsageAggregator.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"AgenticaTokenUsageAggregator.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaTokenUsageAggregator.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __IChatFunctionReference } from "./__IChatFunctionReference";
|
|
1
|
+
import type { __IChatFunctionReference } from "./__IChatFunctionReference";
|
|
2
2
|
export interface __IChatCancelFunctionsApplication {
|
|
3
3
|
/**
|
|
4
4
|
* Cancel a function from the candidate list to call.
|
|
@@ -18,5 +18,5 @@ export interface __IChatCancelFunctionsApplication {
|
|
|
18
18
|
*
|
|
19
19
|
* @param props Properties of the function
|
|
20
20
|
*/
|
|
21
|
-
cancelFunctions(props: __IChatFunctionReference.IProps)
|
|
21
|
+
cancelFunctions: (props: __IChatFunctionReference.IProps) => Promise<void>;
|
|
22
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpLlmFunction } from "@samchon/openapi";
|
|
1
|
+
import type { IHttpLlmFunction } from "@samchon/openapi";
|
|
2
2
|
export interface __IChatInitialApplication {
|
|
3
3
|
/**
|
|
4
4
|
* Get list of API functions.
|
|
@@ -10,5 +10,5 @@ export interface __IChatInitialApplication {
|
|
|
10
10
|
* Also, user just wants to list up every remote API functions that can be
|
|
11
11
|
* called from the backend server, utilize this function too.
|
|
12
12
|
*/
|
|
13
|
-
getApiFunctions(
|
|
13
|
+
getApiFunctions: (props: object) => Promise<Array<IHttpLlmFunction<"chatgpt">>>;
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __IChatFunctionReference } from "./__IChatFunctionReference";
|
|
1
|
+
import type { __IChatFunctionReference } from "./__IChatFunctionReference";
|
|
2
2
|
export interface __IChatSelectFunctionsApplication {
|
|
3
3
|
/**
|
|
4
4
|
* Select proper API functions to call.
|
|
@@ -19,5 +19,5 @@ export interface __IChatSelectFunctionsApplication {
|
|
|
19
19
|
*
|
|
20
20
|
* @param props Properties of the function
|
|
21
21
|
*/
|
|
22
|
-
selectFunctions(props: __IChatFunctionReference.IProps)
|
|
22
|
+
selectFunctions: (props: __IChatFunctionReference.IProps) => Promise<void>;
|
|
23
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
4
4
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
5
5
|
export declare class AgenticaCallEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"call"> {
|
|
6
6
|
readonly id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
3
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
3
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
4
4
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
5
5
|
export declare class AgenticaCancelEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"cancel"> {
|
|
6
6
|
readonly selection: AgenticaOperationSelection<Model>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
3
|
+
import type { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
|
|
3
4
|
import { AgenticaDescribePrompt } from "../prompts/AgenticaDescribePrompt";
|
|
4
|
-
import { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
|
|
5
5
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
6
6
|
export declare class AgenticaDescribeEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"describe"> {
|
|
7
7
|
readonly executes: AgenticaExecutePrompt<Model>[];
|
|
@@ -1,4 +1,13 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.AgenticaDescribeEvent = void 0;
|
|
4
13
|
const AgenticaDescribePrompt_1 = require("../prompts/AgenticaDescribePrompt");
|
|
@@ -23,12 +32,14 @@ class AgenticaDescribeEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
|
23
32
|
this.join_ = props.join;
|
|
24
33
|
}
|
|
25
34
|
join() {
|
|
26
|
-
return this
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return this.join_();
|
|
37
|
+
});
|
|
27
38
|
}
|
|
28
39
|
toJSON() {
|
|
29
40
|
return {
|
|
30
41
|
type: "describe",
|
|
31
|
-
executes: this.executes.map(
|
|
42
|
+
executes: this.executes.map(e => e.toJSON()),
|
|
32
43
|
text: this.text,
|
|
33
44
|
done: this.done,
|
|
34
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaDescribeEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaDescribeEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgenticaDescribeEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaDescribeEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,8EAA2E;AAC3E,2DAAwD;AAExD,MAAa,qBAEX,SAAQ,qCAA6B;IAGrC,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,YAAmB,KAA0C;QAC3D,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;IAC1B,CAAC;IAEY,IAAI;;YACf,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KAAA;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,+CAAsB,CAAC;YAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;CAKF;AAjDD,sDAiDC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { AgenticaCallEvent } from "./AgenticaCallEvent";
|
|
3
|
-
import { AgenticaCancelEvent } from "./AgenticaCancelEvent";
|
|
4
|
-
import { AgenticaDescribeEvent } from "./AgenticaDescribeEvent";
|
|
5
|
-
import { AgenticaExecuteEvent } from "./AgenticaExecuteEvent";
|
|
6
|
-
import { AgenticaInitializeEvent } from "./AgenticaInitializeEvent";
|
|
7
|
-
import { AgenticaRequestEvent } from "./AgenticaRequestEvent";
|
|
8
|
-
import { AgenticaResponseEvent } from "./AgenticaResponseEvent";
|
|
9
|
-
import { AgenticaSelectEvent } from "./AgenticaSelectEvent";
|
|
10
|
-
import { AgenticaTextEvent } from "./AgenticaTextEvent";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaCallEvent } from "./AgenticaCallEvent";
|
|
3
|
+
import type { AgenticaCancelEvent } from "./AgenticaCancelEvent";
|
|
4
|
+
import type { AgenticaDescribeEvent } from "./AgenticaDescribeEvent";
|
|
5
|
+
import type { AgenticaExecuteEvent } from "./AgenticaExecuteEvent";
|
|
6
|
+
import type { AgenticaInitializeEvent } from "./AgenticaInitializeEvent";
|
|
7
|
+
import type { AgenticaRequestEvent } from "./AgenticaRequestEvent";
|
|
8
|
+
import type { AgenticaResponseEvent } from "./AgenticaResponseEvent";
|
|
9
|
+
import type { AgenticaSelectEvent } from "./AgenticaSelectEvent";
|
|
10
|
+
import type { AgenticaTextEvent } from "./AgenticaTextEvent";
|
|
11
11
|
export type AgenticaEvent<Model extends ILlmSchema.Model> = AgenticaCallEvent<Model> | AgenticaCancelEvent<Model> | AgenticaDescribeEvent<Model> | AgenticaExecuteEvent<Model> | AgenticaInitializeEvent | AgenticaRequestEvent | AgenticaResponseEvent | AgenticaSelectEvent<Model> | AgenticaTextEvent;
|
|
12
12
|
export declare namespace AgenticaEvent {
|
|
13
13
|
type Type = AgenticaEvent<any>["type"];
|
|
14
|
-
|
|
14
|
+
interface Mapper<Model extends ILlmSchema.Model> {
|
|
15
15
|
call: AgenticaCallEvent<Model>;
|
|
16
16
|
cancel: AgenticaCancelEvent<Model>;
|
|
17
17
|
describe: AgenticaDescribeEvent<Model>;
|
|
@@ -21,5 +21,5 @@ export declare namespace AgenticaEvent {
|
|
|
21
21
|
response: AgenticaResponseEvent;
|
|
22
22
|
select: AgenticaSelectEvent<Model>;
|
|
23
23
|
text: AgenticaTextEvent;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
25
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
4
4
|
import { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
|
|
5
5
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
6
6
|
export declare class AgenticaExecuteEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"execute"> {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly operation: AgenticaOperation<Model>;
|
|
9
|
-
readonly arguments: Record<string,
|
|
10
|
-
readonly value:
|
|
9
|
+
readonly arguments: Record<string, unknown>;
|
|
10
|
+
readonly value: unknown;
|
|
11
11
|
constructor(props: AgenticaExecuteEvent.IProps<Model>);
|
|
12
12
|
toJSON(): IAgenticaEventJson.IExecute;
|
|
13
13
|
toPrompt(): AgenticaExecutePrompt<Model>;
|
|
@@ -16,7 +16,7 @@ export declare namespace AgenticaExecuteEvent {
|
|
|
16
16
|
interface IProps<Model extends ILlmSchema.Model> {
|
|
17
17
|
id: string;
|
|
18
18
|
operation: AgenticaOperation<Model>;
|
|
19
|
-
arguments: Record<string,
|
|
20
|
-
value:
|
|
19
|
+
arguments: Record<string, unknown>;
|
|
20
|
+
value: unknown;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
2
2
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
3
3
|
export declare class AgenticaInitializeEvent extends AgenticaEventBase<"initialize"> {
|
|
4
4
|
constructor();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import OpenAI from "openai";
|
|
2
|
-
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
1
|
+
import type OpenAI from "openai";
|
|
2
|
+
import type { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
3
|
+
import type { AgenticaEventSource } from "./AgenticaEventSource";
|
|
3
4
|
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
4
|
-
import { AgenticaEventSource } from "./AgenticaEventSource";
|
|
5
5
|
export declare class AgenticaRequestEvent extends AgenticaEventBase<"request"> {
|
|
6
6
|
readonly source: AgenticaEventSource;
|
|
7
7
|
readonly body: OpenAI.ChatCompletionCreateParamsStreaming;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgenticaRequestEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaRequestEvent.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AgenticaRequestEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaRequestEvent.ts"],"names":[],"mappings":";;;AAIA,2DAAwD;AAExD,MAAa,oBAAqB,SAAQ,qCAA4B;IAKpE,YAAmB,KAAkC;QACnD,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC/B,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AApBD,oDAoBC"}
|