@agentica/core 0.10.4 → 0.11.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/lib/Agentica.d.ts +14 -14
- package/lib/Agentica.js +54 -31
- package/lib/Agentica.js.map +1 -1
- package/lib/chatgpt/ChatGptAgent.d.ts +3 -3
- package/lib/chatgpt/ChatGptAgent.js +1 -1
- package/lib/chatgpt/ChatGptAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +3 -3
- package/lib/chatgpt/ChatGptCallFunctionAgent.js +61 -63
- package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +6 -6
- package/lib/chatgpt/ChatGptCancelFunctionAgent.js +28 -30
- package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptCompletionMessageUtil.d.ts +8 -0
- package/lib/chatgpt/ChatGptCompletionMessageUtil.js +536 -0
- package/lib/chatgpt/ChatGptCompletionMessageUtil.js.map +1 -0
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +4 -3
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.js +56 -6
- package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +2 -2
- package/lib/chatgpt/ChatGptHistoryDecoder.js +8 -8
- package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +3 -3
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +11 -5
- package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +3 -3
- package/lib/chatgpt/ChatGptSelectFunctionAgent.js +39 -42
- package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
- package/lib/chatgpt/ChatGptUsageAggregator.d.ts +6 -0
- package/lib/chatgpt/ChatGptUsageAggregator.js +48 -0
- package/lib/chatgpt/ChatGptUsageAggregator.js.map +1 -0
- package/lib/context/AgenticaCancelPrompt.d.ts +16 -0
- package/lib/context/AgenticaCancelPrompt.js +20 -0
- package/lib/context/AgenticaCancelPrompt.js.map +1 -0
- package/lib/context/AgenticaClassOperation.d.ts +8 -0
- package/lib/context/AgenticaClassOperation.js +11 -0
- package/lib/context/AgenticaClassOperation.js.map +1 -0
- package/lib/{structures/IAgenticaContext.d.ts → context/AgenticaContext.d.ts} +15 -14
- package/lib/{structures/IAgenticaPrompt.js → context/AgenticaContext.js} +1 -1
- package/lib/context/AgenticaContext.js.map +1 -0
- package/lib/context/AgenticaHttpOperation.d.ts +8 -0
- package/lib/context/AgenticaHttpOperation.js +11 -0
- package/lib/context/AgenticaHttpOperation.js.map +1 -0
- package/lib/context/AgenticaOperation.d.ts +46 -0
- package/lib/{structures/IAgenticaContext.js → context/AgenticaOperation.js} +1 -1
- package/lib/context/AgenticaOperation.js.map +1 -0
- package/lib/context/AgenticaOperationBase.d.ts +29 -0
- package/lib/context/AgenticaOperationBase.js +21 -0
- package/lib/context/AgenticaOperationBase.js.map +1 -0
- package/lib/{structures/IAgenticaOperationCollection.d.ts → context/AgenticaOperationCollection.d.ts} +6 -6
- package/lib/{structures/IAgenticaOperationSelection.js → context/AgenticaOperationCollection.js} +1 -1
- package/lib/context/AgenticaOperationCollection.js.map +1 -0
- package/lib/context/AgenticaOperationSelection.d.ts +15 -0
- package/lib/context/AgenticaOperationSelection.js +17 -0
- package/lib/context/AgenticaOperationSelection.js.map +1 -0
- package/lib/context/AgenticaTokenUsage.d.ts +82 -0
- package/lib/context/AgenticaTokenUsage.js +97 -0
- package/lib/context/AgenticaTokenUsage.js.map +1 -0
- package/lib/context/internal/AgenticaTokenUsageAggregator.d.ts +10 -0
- package/lib/{internal → context/internal}/AgenticaTokenUsageAggregator.js +0 -46
- package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -0
- package/lib/context/internal/__IChatCancelFunctionsApplication.js.map +1 -0
- package/lib/context/internal/__IChatFunctionReference.js.map +1 -0
- package/lib/context/internal/__IChatInitialApplication.js.map +1 -0
- package/lib/context/internal/__IChatSelectFunctionsApplication.js.map +1 -0
- package/lib/events/AgenticaCallEvent.d.ts +18 -0
- package/lib/events/AgenticaCallEvent.js +22 -0
- package/lib/events/AgenticaCallEvent.js.map +1 -0
- package/lib/events/AgenticaCancelEvent.d.ts +14 -0
- package/lib/events/AgenticaCancelEvent.js +18 -0
- package/lib/events/AgenticaCancelEvent.js.map +1 -0
- package/lib/events/AgenticaDescribeEvent.d.ts +27 -0
- package/lib/events/AgenticaDescribeEvent.js +40 -0
- package/lib/events/AgenticaDescribeEvent.js.map +1 -0
- package/lib/events/AgenticaEvent.d.ts +25 -0
- package/lib/{structures/IAgenticaEvent.js → events/AgenticaEvent.js} +1 -1
- package/lib/events/AgenticaEvent.js.map +1 -0
- package/lib/events/AgenticaEventBase.d.ts +4 -0
- package/lib/events/AgenticaEventBase.js +10 -0
- package/lib/events/AgenticaEventBase.js.map +1 -0
- package/lib/events/AgenticaEventSource.d.ts +1 -0
- package/lib/events/AgenticaEventSource.js +3 -0
- package/lib/events/AgenticaEventSource.js.map +1 -0
- package/lib/events/AgenticaExecuteEvent.d.ts +22 -0
- package/lib/events/AgenticaExecuteEvent.js +33 -0
- package/lib/events/AgenticaExecuteEvent.js.map +1 -0
- package/lib/events/AgenticaInitializeEvent.d.ts +6 -0
- package/lib/events/AgenticaInitializeEvent.js +16 -0
- package/lib/events/AgenticaInitializeEvent.js.map +1 -0
- package/lib/events/AgenticaRequestEvent.d.ts +27 -0
- package/lib/events/AgenticaRequestEvent.js +22 -0
- package/lib/events/AgenticaRequestEvent.js.map +1 -0
- package/lib/events/AgenticaResponseEvent.d.ts +35 -0
- package/lib/events/AgenticaResponseEvent.js +16 -0
- package/lib/events/AgenticaResponseEvent.js.map +1 -0
- package/lib/events/AgenticaSelectEvent.d.ts +16 -0
- package/lib/events/AgenticaSelectEvent.js +26 -0
- package/lib/events/AgenticaSelectEvent.js.map +1 -0
- package/lib/events/AgenticaTextEvent.d.ts +25 -0
- package/lib/events/AgenticaTextEvent.js +40 -0
- package/lib/events/AgenticaTextEvent.js.map +1 -0
- package/lib/index.d.ts +26 -8
- package/lib/index.js +29 -9
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1391 -306
- package/lib/index.mjs.map +1 -1
- package/lib/internal/AgenticaOperationComposer.d.ts +2 -2
- package/lib/internal/AgenticaOperationComposer.js +12 -0
- package/lib/internal/AgenticaOperationComposer.js.map +1 -1
- package/lib/internal/ByteArrayUtil.d.ts +3 -0
- package/lib/internal/ByteArrayUtil.js +10 -0
- package/lib/internal/ByteArrayUtil.js.map +1 -0
- package/lib/internal/MPSCUtil.d.ts +21 -0
- package/lib/internal/MPSCUtil.js +84 -0
- package/lib/internal/MPSCUtil.js.map +1 -0
- package/lib/internal/StreamUtil.d.ts +6 -0
- package/lib/internal/StreamUtil.js +65 -0
- package/lib/internal/StreamUtil.js.map +1 -0
- package/lib/json/IAgenticaEventJson.d.ts +149 -0
- package/lib/{structures/IAgenticaOperation.js → json/IAgenticaEventJson.js} +1 -1
- package/lib/json/IAgenticaEventJson.js.map +1 -0
- package/lib/json/IAgenticaOperationJson.d.ts +33 -0
- package/lib/json/IAgenticaOperationJson.js +3 -0
- package/lib/json/IAgenticaOperationJson.js.map +1 -0
- package/lib/json/IAgenticaOperationSelectionJson.d.ts +18 -0
- package/lib/{structures/IAgenticaOperationCollection.js → json/IAgenticaOperationSelectionJson.js} +1 -1
- package/lib/json/IAgenticaOperationSelectionJson.js.map +1 -0
- package/lib/json/IAgenticaPromptJson.d.ts +111 -0
- package/lib/json/IAgenticaPromptJson.js +3 -0
- package/lib/json/IAgenticaPromptJson.js.map +1 -0
- package/lib/{structures/IAgenticaTokenUsage.d.ts → json/IAgenticaTokenUsageJson.d.ts} +10 -10
- package/lib/json/IAgenticaTokenUsageJson.js +3 -0
- package/lib/json/IAgenticaTokenUsageJson.js.map +1 -0
- package/lib/prompts/AgenticaCancelPrompt.d.ts +16 -0
- package/lib/prompts/AgenticaCancelPrompt.js +20 -0
- package/lib/prompts/AgenticaCancelPrompt.js.map +1 -0
- package/lib/prompts/AgenticaDescribePrompt.d.ts +24 -0
- package/lib/prompts/AgenticaDescribePrompt.js +20 -0
- package/lib/prompts/AgenticaDescribePrompt.js.map +1 -0
- package/lib/prompts/AgenticaExecutePrompt.d.ts +20 -0
- package/lib/prompts/AgenticaExecutePrompt.js +24 -0
- package/lib/prompts/AgenticaExecutePrompt.js.map +1 -0
- package/lib/prompts/AgenticaPrompt.d.ts +7 -0
- package/lib/{typings/AgenticaSource.js → prompts/AgenticaPrompt.js} +1 -1
- package/lib/prompts/AgenticaPrompt.js.map +1 -0
- package/lib/prompts/AgenticaPromptBase.d.ts +22 -0
- package/lib/prompts/AgenticaPromptBase.js +22 -0
- package/lib/prompts/AgenticaPromptBase.js.map +1 -0
- package/lib/prompts/AgenticaSelectPrompt.d.ts +16 -0
- package/lib/prompts/AgenticaSelectPrompt.js +20 -0
- package/lib/prompts/AgenticaSelectPrompt.js.map +1 -0
- package/lib/prompts/AgenticaTextPrompt.d.ts +14 -0
- package/lib/prompts/AgenticaTextPrompt.js +20 -0
- package/lib/prompts/AgenticaTextPrompt.js.map +1 -0
- package/lib/structures/IAgenticaConfig.d.ts +3 -3
- package/lib/structures/IAgenticaExecutor.d.ts +12 -11
- package/lib/structures/IAgenticaProps.d.ts +2 -3
- package/lib/structures/IAgenticaSystemPrompt.d.ts +12 -11
- package/lib/transformers/AgenticaEventTransformer.d.ts +45 -0
- package/lib/transformers/AgenticaEventTransformer.js +127 -0
- package/lib/transformers/AgenticaEventTransformer.js.map +1 -0
- package/lib/transformers/AgenticaPromptTransformer.d.ts +34 -0
- package/lib/transformers/AgenticaPromptTransformer.js +90 -0
- package/lib/transformers/AgenticaPromptTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/Agentica.ts +93 -63
- package/src/chatgpt/ChatGptAgent.ts +8 -7
- package/src/chatgpt/ChatGptCallFunctionAgent.ts +90 -88
- package/src/chatgpt/ChatGptCancelFunctionAgent.ts +51 -58
- package/src/chatgpt/ChatGptCompletionMessageUtil.ts +166 -0
- package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +81 -12
- package/src/chatgpt/ChatGptHistoryDecoder.ts +14 -14
- package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +21 -13
- package/src/chatgpt/ChatGptSelectFunctionAgent.ts +66 -74
- package/src/chatgpt/ChatGptUsageAggregator.ts +62 -0
- package/src/context/AgenticaCancelPrompt.ts +32 -0
- package/src/context/AgenticaClassOperation.ts +23 -0
- package/src/{structures/IAgenticaContext.ts → context/AgenticaContext.ts} +17 -16
- package/src/context/AgenticaHttpOperation.ts +27 -0
- package/src/{structures/IAgenticaOperation.ts → context/AgenticaOperation.ts} +25 -22
- package/src/context/AgenticaOperationBase.ts +57 -0
- package/src/{structures/IAgenticaOperationCollection.ts → context/AgenticaOperationCollection.ts} +6 -6
- package/src/context/AgenticaOperationSelection.ts +27 -0
- package/src/context/AgenticaTokenUsage.ts +170 -0
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -0
- package/src/events/AgenticaCallEvent.ts +36 -0
- package/src/events/AgenticaCancelEvent.ts +28 -0
- package/src/events/AgenticaDescribeEvent.ts +61 -0
- package/src/events/AgenticaEvent.ts +36 -0
- package/src/events/AgenticaEventBase.ts +7 -0
- package/src/{typings/AgenticaSource.ts → events/AgenticaEventSource.ts} +1 -1
- package/src/events/AgenticaExecuteEvent.ts +50 -0
- package/src/events/AgenticaInitializeEvent.ts +14 -0
- package/src/events/AgenticaRequestEvent.ts +45 -0
- package/src/events/AgenticaResponseEvent.ts +48 -0
- package/src/events/AgenticaSelectEvent.ts +37 -0
- package/src/events/AgenticaTextEvent.ts +57 -0
- package/src/index.ts +33 -9
- package/src/internal/AgenticaOperationComposer.ts +24 -15
- package/src/internal/ByteArrayUtil.ts +5 -0
- package/src/internal/MPSCUtil.ts +75 -0
- package/src/internal/StreamUtil.ts +64 -0
- package/src/json/IAgenticaEventJson.ts +178 -0
- package/src/json/IAgenticaOperationJson.ts +36 -0
- package/src/json/IAgenticaOperationSelectionJson.ts +19 -0
- package/src/json/IAgenticaPromptJson.ts +130 -0
- package/src/{structures/IAgenticaTokenUsage.ts → json/IAgenticaTokenUsageJson.ts} +10 -10
- package/src/prompts/AgenticaCancelPrompt.ts +32 -0
- package/src/prompts/AgenticaDescribePrompt.ts +41 -0
- package/src/prompts/AgenticaExecutePrompt.ts +52 -0
- package/src/prompts/AgenticaPrompt.ts +14 -0
- package/src/prompts/AgenticaPromptBase.ts +27 -0
- package/src/prompts/AgenticaSelectPrompt.ts +32 -0
- package/src/prompts/AgenticaTextPrompt.ts +31 -0
- package/src/structures/IAgenticaConfig.ts +3 -3
- package/src/structures/IAgenticaExecutor.ts +14 -13
- package/src/structures/IAgenticaProps.ts +2 -3
- package/src/structures/IAgenticaSystemPrompt.ts +12 -11
- package/src/transformers/AgenticaEventTransformer.ts +165 -0
- package/src/transformers/AgenticaPromptTransformer.ts +134 -0
- package/lib/internal/AgenticaPromptFactory.d.ts +0 -7
- package/lib/internal/AgenticaPromptFactory.js +0 -9
- package/lib/internal/AgenticaPromptFactory.js.map +0 -1
- package/lib/internal/AgenticaPromptTransformer.d.ts +0 -10
- package/lib/internal/AgenticaPromptTransformer.js +0 -58
- package/lib/internal/AgenticaPromptTransformer.js.map +0 -1
- package/lib/internal/AgenticaTokenUsageAggregator.d.ts +0 -11
- package/lib/internal/AgenticaTokenUsageAggregator.js.map +0 -1
- package/lib/structures/IAgenticaContext.js.map +0 -1
- package/lib/structures/IAgenticaEvent.d.ts +0 -192
- package/lib/structures/IAgenticaEvent.js.map +0 -1
- package/lib/structures/IAgenticaOperation.d.ts +0 -47
- package/lib/structures/IAgenticaOperation.js.map +0 -1
- package/lib/structures/IAgenticaOperationCollection.js.map +0 -1
- package/lib/structures/IAgenticaOperationSelection.d.ts +0 -50
- package/lib/structures/IAgenticaOperationSelection.js.map +0 -1
- package/lib/structures/IAgenticaPrompt.d.ts +0 -138
- package/lib/structures/IAgenticaPrompt.js.map +0 -1
- package/lib/structures/IAgenticaTokenUsage.js +0 -3
- package/lib/structures/IAgenticaTokenUsage.js.map +0 -1
- package/lib/structures/internal/__IChatCancelFunctionsApplication.js.map +0 -1
- package/lib/structures/internal/__IChatFunctionReference.js.map +0 -1
- package/lib/structures/internal/__IChatInitialApplication.js.map +0 -1
- package/lib/structures/internal/__IChatSelectFunctionsApplication.js.map +0 -1
- package/lib/typings/AgenticaSource.d.ts +0 -1
- package/lib/typings/AgenticaSource.js.map +0 -1
- package/src/internal/AgenticaPromptFactory.ts +0 -32
- package/src/internal/AgenticaPromptTransformer.ts +0 -86
- package/src/internal/AgenticaTokenUsageAggregator.ts +0 -121
- package/src/structures/IAgenticaEvent.ts +0 -229
- package/src/structures/IAgenticaOperationSelection.ts +0 -68
- package/src/structures/IAgenticaPrompt.ts +0 -182
- /package/lib/{structures → context}/internal/__IChatCancelFunctionsApplication.d.ts +0 -0
- /package/lib/{structures → context}/internal/__IChatCancelFunctionsApplication.js +0 -0
- /package/lib/{structures → context}/internal/__IChatFunctionReference.d.ts +0 -0
- /package/lib/{structures → context}/internal/__IChatFunctionReference.js +0 -0
- /package/lib/{structures → context}/internal/__IChatInitialApplication.d.ts +0 -0
- /package/lib/{structures → context}/internal/__IChatInitialApplication.js +0 -0
- /package/lib/{structures → context}/internal/__IChatSelectFunctionsApplication.d.ts +0 -0
- /package/lib/{structures → context}/internal/__IChatSelectFunctionsApplication.js +0 -0
- /package/src/{structures → context}/internal/__IChatCancelFunctionsApplication.ts +0 -0
- /package/src/{structures → context}/internal/__IChatFunctionReference.ts +0 -0
- /package/src/{structures → context}/internal/__IChatInitialApplication.ts +0 -0
- /package/src/{structures → context}/internal/__IChatSelectFunctionsApplication.ts +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ILlmSchema } from "@samchon/openapi";
|
|
2
2
|
import OpenAI from "openai";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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";
|
|
9
10
|
/**
|
|
10
11
|
* Context of the Nestia A.I. agent.
|
|
11
12
|
*
|
|
@@ -37,7 +38,7 @@ import { IAgenticaPrompt } from "./IAgenticaPrompt";
|
|
|
37
38
|
*
|
|
38
39
|
* @author Samchon
|
|
39
40
|
*/
|
|
40
|
-
export interface
|
|
41
|
+
export interface AgenticaContext<Model extends ILlmSchema.Model> {
|
|
41
42
|
/**
|
|
42
43
|
* Collection of operations.
|
|
43
44
|
*
|
|
@@ -45,7 +46,7 @@ export interface IAgenticaContext<Model extends ILlmSchema.Model> {
|
|
|
45
46
|
* groups composed by the divide and conquer rule for the
|
|
46
47
|
* efficient operation selection if configured.
|
|
47
48
|
*/
|
|
48
|
-
operations:
|
|
49
|
+
operations: AgenticaOperationCollection<Model>;
|
|
49
50
|
/**
|
|
50
51
|
* Configuration of the agent.
|
|
51
52
|
*
|
|
@@ -58,27 +59,27 @@ export interface IAgenticaContext<Model extends ILlmSchema.Model> {
|
|
|
58
59
|
/**
|
|
59
60
|
* Prompt histories.
|
|
60
61
|
*/
|
|
61
|
-
histories:
|
|
62
|
+
histories: AgenticaPrompt<Model>[];
|
|
62
63
|
/**
|
|
63
64
|
* Stacked operations.
|
|
64
65
|
*
|
|
65
66
|
* In other words, list of candidate operations for the LLM function calling.
|
|
66
67
|
*/
|
|
67
|
-
stack:
|
|
68
|
+
stack: AgenticaOperationSelection<Model>[];
|
|
68
69
|
/**
|
|
69
70
|
* Text prompt of the user.
|
|
70
71
|
*
|
|
71
72
|
* Text conversation written the by user through the
|
|
72
73
|
* {@link Agentica.conversate} function.
|
|
73
74
|
*/
|
|
74
|
-
prompt:
|
|
75
|
+
prompt: AgenticaTextPrompt<"user">;
|
|
75
76
|
/**
|
|
76
77
|
* Whether the agent is ready.
|
|
77
78
|
*
|
|
78
79
|
* Returns a boolean value indicates whether the agent is ready to
|
|
79
80
|
* perform the function calling.
|
|
80
81
|
*
|
|
81
|
-
* If the agent has called the {@link
|
|
82
|
+
* If the agent has called the {@link AgenticaContext.initialize},
|
|
82
83
|
* it returns `true`. Otherwise the {@link initialize} has never been
|
|
83
84
|
* called, returns `false`.
|
|
84
85
|
*/
|
|
@@ -91,7 +92,7 @@ export interface IAgenticaContext<Model extends ILlmSchema.Model> {
|
|
|
91
92
|
*
|
|
92
93
|
* @param event Event to deliver
|
|
93
94
|
*/
|
|
94
|
-
dispatch: (event:
|
|
95
|
+
dispatch: (event: AgenticaEvent<Model>) => Promise<void>;
|
|
95
96
|
/**
|
|
96
97
|
* Request to the OpenAI server.
|
|
97
98
|
*
|
|
@@ -99,7 +100,7 @@ export interface IAgenticaContext<Model extends ILlmSchema.Model> {
|
|
|
99
100
|
* @param body The request body to the OpenAI server
|
|
100
101
|
* @returns Response from the OpenAI server
|
|
101
102
|
*/
|
|
102
|
-
request: (source:
|
|
103
|
+
request: (source: AgenticaEventSource, body: Omit<OpenAI.ChatCompletionCreateParamsStreaming, "model" | "stream">) => Promise<ReadableStream<OpenAI.Chat.Completions.ChatCompletionChunk>>;
|
|
103
104
|
/**
|
|
104
105
|
* Initialize the agent.
|
|
105
106
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaContext.js","sourceRoot":"","sources":["../../src/context/AgenticaContext.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IHttpLlmApplication, IHttpLlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import { AgenticaOperationBase } from "./AgenticaOperationBase";
|
|
3
|
+
export declare class AgenticaHttpOperation<Model extends ILlmSchema.Model> extends AgenticaOperationBase<"http", IHttpLlmApplication<Model>, IHttpLlmFunction<Model>> {
|
|
4
|
+
constructor(props: AgenticaHttpOperation.IProps<Model>);
|
|
5
|
+
}
|
|
6
|
+
export declare namespace AgenticaHttpOperation {
|
|
7
|
+
type IProps<Model extends ILlmSchema.Model> = AgenticaOperationBase.IProps<"http", IHttpLlmApplication<Model>, IHttpLlmFunction<Model>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgenticaHttpOperation = void 0;
|
|
4
|
+
const AgenticaOperationBase_1 = require("./AgenticaOperationBase");
|
|
5
|
+
class AgenticaHttpOperation extends AgenticaOperationBase_1.AgenticaOperationBase {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.AgenticaHttpOperation = AgenticaHttpOperation;
|
|
11
|
+
//# sourceMappingURL=AgenticaHttpOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaHttpOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaHttpOperation.ts"],"names":[],"mappings":";;;AAMA,mEAAgE;AAEhE,MAAa,qBAEX,SAAQ,6CAIT;IACC,YAAmB,KAA0C;QAC3D,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAVD,sDAUC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IHttpLlmFunction, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
3
|
+
import { IAgenticaController } from "../structures/IAgenticaController";
|
|
4
|
+
/**
|
|
5
|
+
* Operation information in the Agentica Agent.
|
|
6
|
+
*
|
|
7
|
+
* `AgenticaOperation` is a type represents an operation that would
|
|
8
|
+
* be selected by the A.I. chatbot of {@link Agentica} class to
|
|
9
|
+
* perform the LLM (Large Language Model) function calling.
|
|
10
|
+
*
|
|
11
|
+
* Also, it is an union type that is discriminated by the {@link protocol}
|
|
12
|
+
* property. If the protocol value is `http`, it means that the HTTP API
|
|
13
|
+
* operation would be called by the A.I. chatbot. Otherwise, if the protocol
|
|
14
|
+
* value is `class`, it means that the operation has come from a
|
|
15
|
+
* TypeScript class.
|
|
16
|
+
*
|
|
17
|
+
* @author Samchon
|
|
18
|
+
*/
|
|
19
|
+
export type AgenticaOperation<Model extends ILlmSchema.Model> = AgenticaOperation.Class<Model> | AgenticaOperation.Http<Model>;
|
|
20
|
+
export declare namespace AgenticaOperation {
|
|
21
|
+
export type Class<Model extends ILlmSchema.Model> = Base<"class", IAgenticaController.IClass<Model>, ILlmFunction<Model>>;
|
|
22
|
+
export type Http<Model extends ILlmSchema.Model> = Base<"http", IAgenticaController.IHttp<Model>, IHttpLlmFunction<Model>>;
|
|
23
|
+
interface Base<Protocol extends "http" | "class", Controller extends object, Function extends object> {
|
|
24
|
+
/**
|
|
25
|
+
* Protocol discriminator.
|
|
26
|
+
*/
|
|
27
|
+
protocol: Protocol;
|
|
28
|
+
/**
|
|
29
|
+
* Belonged controller of the target function.
|
|
30
|
+
*/
|
|
31
|
+
controller: Controller;
|
|
32
|
+
/**
|
|
33
|
+
* Target function to call.
|
|
34
|
+
*/
|
|
35
|
+
function: Function;
|
|
36
|
+
/**
|
|
37
|
+
* Identifier name.
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Convert to primitive JSON object.
|
|
42
|
+
*/
|
|
43
|
+
toJSON(): IAgenticaOperationJson;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaOperation.js","sourceRoot":"","sources":["../../src/context/AgenticaOperation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IAgenticaOperationJson } from "../json/IAgenticaOperationJson";
|
|
2
|
+
export declare abstract class AgenticaOperationBase<Protocol extends "http" | "class", Controller extends object, Function extends object> {
|
|
3
|
+
/**
|
|
4
|
+
* Protocol discriminator.
|
|
5
|
+
*/
|
|
6
|
+
readonly protocol: Protocol;
|
|
7
|
+
/**
|
|
8
|
+
* Belonged controller of the target function.
|
|
9
|
+
*/
|
|
10
|
+
readonly controller: Controller;
|
|
11
|
+
/**
|
|
12
|
+
* Target function to call.
|
|
13
|
+
*/
|
|
14
|
+
readonly function: Function;
|
|
15
|
+
/**
|
|
16
|
+
* Identifier name.
|
|
17
|
+
*/
|
|
18
|
+
readonly name: string;
|
|
19
|
+
protected constructor(props: AgenticaOperationBase.IProps<Protocol, Controller, Function>);
|
|
20
|
+
toJSON(): IAgenticaOperationJson;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace AgenticaOperationBase {
|
|
23
|
+
interface IProps<Protocol extends "http" | "class", Controller extends object, Function extends object> {
|
|
24
|
+
protocol: Protocol;
|
|
25
|
+
controller: Controller;
|
|
26
|
+
function: Function;
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgenticaOperationBase = void 0;
|
|
4
|
+
class AgenticaOperationBase {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
this.protocol = props.protocol;
|
|
7
|
+
this.controller = props.controller;
|
|
8
|
+
this.function = props.function;
|
|
9
|
+
this.name = props.name;
|
|
10
|
+
}
|
|
11
|
+
toJSON() {
|
|
12
|
+
return {
|
|
13
|
+
protocol: this.protocol,
|
|
14
|
+
controller: this.controller.constructor.name,
|
|
15
|
+
function: this.function.constructor.name,
|
|
16
|
+
name: this.name,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AgenticaOperationBase = AgenticaOperationBase;
|
|
21
|
+
//# sourceMappingURL=AgenticaOperationBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaOperationBase.js","sourceRoot":"","sources":["../../src/context/AgenticaOperationBase.ts"],"names":[],"mappings":";;;AAEA,MAAsB,qBAAqB;IAyBzC,YACE,KAAmE;QAEnE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAEM,MAAM;QACX,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI;YAC5C,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI;YACxC,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AA1CD,sDA0CC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import {
|
|
2
|
+
import { AgenticaOperation } from "./AgenticaOperation";
|
|
3
3
|
/**
|
|
4
4
|
* Collection of operations used in the Nestia Agent.
|
|
5
5
|
*
|
|
@@ -9,11 +9,11 @@ import { IAgenticaOperation } from "./IAgenticaOperation";
|
|
|
9
9
|
*
|
|
10
10
|
* @author Samchon
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface AgenticaOperationCollection<Model extends ILlmSchema.Model> {
|
|
13
13
|
/**
|
|
14
14
|
* List of every operations.
|
|
15
15
|
*/
|
|
16
|
-
array:
|
|
16
|
+
array: AgenticaOperation<Model>[];
|
|
17
17
|
/**
|
|
18
18
|
* Divided operations.
|
|
19
19
|
*
|
|
@@ -29,13 +29,13 @@ export interface IAgenticaOperationCollection<Model extends ILlmSchema.Model> {
|
|
|
29
29
|
* Otherwise, if the {@link IAgenticaConfig.capacity} has not been
|
|
30
30
|
* configured, this `divided` property would be the `undefined` value.
|
|
31
31
|
*/
|
|
32
|
-
divided?:
|
|
32
|
+
divided?: AgenticaOperation<Model>[][] | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* Flat dictionary of operations.
|
|
35
35
|
*
|
|
36
36
|
* Dictionary of operations with their {@link IAgenticaOperation.name}.
|
|
37
37
|
*/
|
|
38
|
-
flat: Map<string,
|
|
38
|
+
flat: Map<string, AgenticaOperation<Model>>;
|
|
39
39
|
/**
|
|
40
40
|
* Group dictionary of operations.
|
|
41
41
|
*
|
|
@@ -43,5 +43,5 @@ export interface IAgenticaOperationCollection<Model extends ILlmSchema.Model> {
|
|
|
43
43
|
* {@link IAgenticaOperation.controller.name} and
|
|
44
44
|
* {@link IAgenticaOperation.function.name}.
|
|
45
45
|
*/
|
|
46
|
-
group: Map<string, Map<string,
|
|
46
|
+
group: Map<string, Map<string, AgenticaOperation<Model>>>;
|
|
47
47
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaOperationCollection.js","sourceRoot":"","sources":["../../src/context/AgenticaOperationCollection.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import { IAgenticaOperationSelectionJson } from "../json/IAgenticaOperationSelectionJson";
|
|
3
|
+
import { AgenticaOperation } from "./AgenticaOperation";
|
|
4
|
+
export declare class AgenticaOperationSelection<Model extends ILlmSchema.Model> {
|
|
5
|
+
readonly operation: AgenticaOperation<Model>;
|
|
6
|
+
readonly reason: string;
|
|
7
|
+
constructor(props: AgenticaOperationSelection.IProps<Model>);
|
|
8
|
+
toJSON(): IAgenticaOperationSelectionJson;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace AgenticaOperationSelection {
|
|
11
|
+
interface IProps<Model extends ILlmSchema.Model> {
|
|
12
|
+
operation: AgenticaOperation<Model>;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgenticaOperationSelection = void 0;
|
|
4
|
+
class AgenticaOperationSelection {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
this.operation = props.operation;
|
|
7
|
+
this.reason = props.reason;
|
|
8
|
+
}
|
|
9
|
+
toJSON() {
|
|
10
|
+
return {
|
|
11
|
+
operation: this.operation.toJSON(),
|
|
12
|
+
reason: this.reason,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.AgenticaOperationSelection = AgenticaOperationSelection;
|
|
17
|
+
//# sourceMappingURL=AgenticaOperationSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaOperationSelection.js","sourceRoot":"","sources":["../../src/context/AgenticaOperationSelection.ts"],"names":[],"mappings":";;;AAKA,MAAa,0BAA0B;IAIrC,YAAmB,KAA+C;QAChE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAEM,MAAM;QACX,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YAClC,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AAfD,gEAeC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IAgenticaTokenUsageJson } from "../json/IAgenticaTokenUsageJson";
|
|
2
|
+
export declare class AgenticaTokenUsage implements IAgenticaTokenUsageJson {
|
|
3
|
+
/**
|
|
4
|
+
* Aggregated token usage.
|
|
5
|
+
*/
|
|
6
|
+
readonly aggregate: IAgenticaTokenUsageJson.IComponent;
|
|
7
|
+
/**
|
|
8
|
+
* Token uasge of initializer agent.
|
|
9
|
+
*/
|
|
10
|
+
readonly initialize: IAgenticaTokenUsageJson.IComponent;
|
|
11
|
+
/**
|
|
12
|
+
* Token usage of function selector agent.
|
|
13
|
+
*/
|
|
14
|
+
readonly select: IAgenticaTokenUsageJson.IComponent;
|
|
15
|
+
/**
|
|
16
|
+
* Token usage of function canceler agent.
|
|
17
|
+
*/
|
|
18
|
+
readonly cancel: IAgenticaTokenUsageJson.IComponent;
|
|
19
|
+
/**
|
|
20
|
+
* Token usage of function caller agent.
|
|
21
|
+
*/
|
|
22
|
+
readonly call: IAgenticaTokenUsageJson.IComponent;
|
|
23
|
+
/**
|
|
24
|
+
* Token usage of function calling describer agent.
|
|
25
|
+
*/
|
|
26
|
+
readonly describe: IAgenticaTokenUsageJson.IComponent;
|
|
27
|
+
constructor(props?: IAgenticaTokenUsageJson);
|
|
28
|
+
increment(y: IAgenticaTokenUsageJson): void;
|
|
29
|
+
toJSON(): IAgenticaTokenUsageJson;
|
|
30
|
+
static zero(): AgenticaTokenUsage;
|
|
31
|
+
static plus(x: AgenticaTokenUsage, y: AgenticaTokenUsage): AgenticaTokenUsage;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace AgenticaTokenUsage {
|
|
34
|
+
interface IComponent {
|
|
35
|
+
/**
|
|
36
|
+
* Total token usage.
|
|
37
|
+
*/
|
|
38
|
+
total: number;
|
|
39
|
+
/**
|
|
40
|
+
* Input token usage of detailed.
|
|
41
|
+
*/
|
|
42
|
+
input: IInput;
|
|
43
|
+
/**
|
|
44
|
+
* Output token usage of detailed.
|
|
45
|
+
*/
|
|
46
|
+
output: IOutput;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Input token usage of detailed.
|
|
50
|
+
*/
|
|
51
|
+
interface IInput {
|
|
52
|
+
/**
|
|
53
|
+
* Total amount of input token uasge.
|
|
54
|
+
*/
|
|
55
|
+
total: number;
|
|
56
|
+
/**
|
|
57
|
+
* Cached token usage.
|
|
58
|
+
*/
|
|
59
|
+
cached: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Output token usage of detailed.
|
|
63
|
+
*/
|
|
64
|
+
interface IOutput {
|
|
65
|
+
/**
|
|
66
|
+
* Total amount of output token usage.
|
|
67
|
+
*/
|
|
68
|
+
total: number;
|
|
69
|
+
/**
|
|
70
|
+
* Reasoning token usage.
|
|
71
|
+
*/
|
|
72
|
+
reasoning: number;
|
|
73
|
+
/**
|
|
74
|
+
* Prediction token usage.
|
|
75
|
+
*/
|
|
76
|
+
accepted_prediction: number;
|
|
77
|
+
/**
|
|
78
|
+
* Rejected prediction token usage.
|
|
79
|
+
*/
|
|
80
|
+
rejected_prediction: number;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AgenticaTokenUsage = void 0;
|
|
7
|
+
const typia_1 = __importDefault(require("typia"));
|
|
8
|
+
class AgenticaTokenUsage {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
if (props === undefined) {
|
|
11
|
+
const zero = AgenticaTokenUsage.zero();
|
|
12
|
+
this.aggregate = zero.aggregate;
|
|
13
|
+
this.initialize = zero.initialize;
|
|
14
|
+
this.select = zero.select;
|
|
15
|
+
this.cancel = zero.cancel;
|
|
16
|
+
this.call = zero.call;
|
|
17
|
+
this.describe = zero.describe;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.aggregate = props.aggregate;
|
|
21
|
+
this.initialize = props.initialize;
|
|
22
|
+
this.select = props.select;
|
|
23
|
+
this.cancel = props.cancel;
|
|
24
|
+
this.call = props.call;
|
|
25
|
+
this.describe = props.describe;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
increment(y) {
|
|
29
|
+
const increment = (x, y) => {
|
|
30
|
+
x.total += y.total;
|
|
31
|
+
x.input.total += y.input.total;
|
|
32
|
+
x.input.cached += y.input.cached;
|
|
33
|
+
x.output.total += y.output.total;
|
|
34
|
+
x.output.reasoning += y.output.reasoning;
|
|
35
|
+
x.output.accepted_prediction += y.output.accepted_prediction;
|
|
36
|
+
x.output.rejected_prediction += y.output.rejected_prediction;
|
|
37
|
+
};
|
|
38
|
+
increment(this.aggregate, y.aggregate);
|
|
39
|
+
increment(this.initialize, y.initialize);
|
|
40
|
+
increment(this.select, y.select);
|
|
41
|
+
increment(this.cancel, y.cancel);
|
|
42
|
+
increment(this.call, y.call);
|
|
43
|
+
increment(this.describe, y.describe);
|
|
44
|
+
}
|
|
45
|
+
toJSON() {
|
|
46
|
+
return (() => { const _co0 = input => ({
|
|
47
|
+
aggregate: _co1(input.aggregate),
|
|
48
|
+
initialize: _co1(input.initialize),
|
|
49
|
+
select: _co1(input.select),
|
|
50
|
+
cancel: _co1(input.cancel),
|
|
51
|
+
call: _co1(input.call),
|
|
52
|
+
describe: _co1(input.describe)
|
|
53
|
+
}); const _co1 = input => ({
|
|
54
|
+
total: input.total,
|
|
55
|
+
input: _co2(input.input),
|
|
56
|
+
output: _co3(input.output)
|
|
57
|
+
}); const _co2 = input => ({
|
|
58
|
+
total: input.total,
|
|
59
|
+
cached: input.cached
|
|
60
|
+
}); const _co3 = input => ({
|
|
61
|
+
total: input.total,
|
|
62
|
+
reasoning: input.reasoning,
|
|
63
|
+
accepted_prediction: input.accepted_prediction,
|
|
64
|
+
rejected_prediction: input.rejected_prediction
|
|
65
|
+
}); const _io1 = input => "number" === typeof input.total && ("object" === typeof input.input && null !== input.input && _io2(input.input)) && ("object" === typeof input.output && null !== input.output && _io3(input.output)); const _io2 = input => "number" === typeof input.total && "number" === typeof input.cached; const _io3 = input => "number" === typeof input.total && "number" === typeof input.reasoning && "number" === typeof input.accepted_prediction && "number" === typeof input.rejected_prediction; return input => _co0(input); })()(this);
|
|
66
|
+
}
|
|
67
|
+
static zero() {
|
|
68
|
+
const component = () => ({
|
|
69
|
+
total: 0,
|
|
70
|
+
input: {
|
|
71
|
+
total: 0,
|
|
72
|
+
cached: 0,
|
|
73
|
+
},
|
|
74
|
+
output: {
|
|
75
|
+
total: 0,
|
|
76
|
+
reasoning: 0,
|
|
77
|
+
accepted_prediction: 0,
|
|
78
|
+
rejected_prediction: 0,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return new AgenticaTokenUsage({
|
|
82
|
+
aggregate: component(),
|
|
83
|
+
initialize: component(),
|
|
84
|
+
select: component(),
|
|
85
|
+
cancel: component(),
|
|
86
|
+
call: component(),
|
|
87
|
+
describe: component(),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
static plus(x, y) {
|
|
91
|
+
const z = new AgenticaTokenUsage(x);
|
|
92
|
+
z.increment(y.toJSON());
|
|
93
|
+
return z;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.AgenticaTokenUsage = AgenticaTokenUsage;
|
|
97
|
+
//# sourceMappingURL=AgenticaTokenUsage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaTokenUsage.js","sourceRoot":"","sources":["../../src/context/AgenticaTokenUsage.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,MAAa,kBAAkB;IA+B7B,YAAmB,KAA+B;QAChD,IAAI,KAAK,KAAK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AAE;SACtB,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAI,CAChB,CAAqB,EACrB,CAAqB;QAErB,MAAM,CAAC,GAAuB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACxB,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AA3GD,gDA2GC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CompletionUsage } from "openai/resources";
|
|
2
|
+
import { Primitive } from "typia";
|
|
3
|
+
import { AgenticaTokenUsage } from "../AgenticaTokenUsage";
|
|
4
|
+
export declare namespace AgenticaTokenUsageAggregator {
|
|
5
|
+
const aggregate: (props: {
|
|
6
|
+
kind: Exclude<keyof Primitive<AgenticaTokenUsage>, "aggregate">;
|
|
7
|
+
completionUsage: CompletionUsage;
|
|
8
|
+
usage: AgenticaTokenUsage;
|
|
9
|
+
}) => void;
|
|
10
|
+
}
|
|
@@ -43,51 +43,5 @@ var AgenticaTokenUsageAggregator;
|
|
|
43
43
|
aggregate.output.accepted_prediction = sum((comp) => comp.output.accepted_prediction);
|
|
44
44
|
aggregate.output.rejected_prediction = sum((comp) => comp.output.rejected_prediction);
|
|
45
45
|
};
|
|
46
|
-
AgenticaTokenUsageAggregator.plus = (x, y) => {
|
|
47
|
-
const component = (a, b) => ({
|
|
48
|
-
total: a.total + b.total,
|
|
49
|
-
input: {
|
|
50
|
-
total: a.input.total + b.input.total,
|
|
51
|
-
cached: a.input.cached + b.input.cached,
|
|
52
|
-
},
|
|
53
|
-
output: {
|
|
54
|
-
total: a.output.total + b.output.total,
|
|
55
|
-
reasoning: a.output.reasoning + b.output.reasoning,
|
|
56
|
-
accepted_prediction: a.output.accepted_prediction + b.output.accepted_prediction,
|
|
57
|
-
rejected_prediction: a.output.rejected_prediction + b.output.rejected_prediction,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
aggregate: component(x.aggregate, y.aggregate),
|
|
62
|
-
initialize: component(x.initialize, y.initialize),
|
|
63
|
-
select: component(x.select, y.select),
|
|
64
|
-
cancel: component(x.cancel, y.cancel),
|
|
65
|
-
call: component(x.call, y.call),
|
|
66
|
-
describe: component(x.describe, y.describe),
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
AgenticaTokenUsageAggregator.zero = () => {
|
|
70
|
-
const component = () => ({
|
|
71
|
-
total: 0,
|
|
72
|
-
input: {
|
|
73
|
-
total: 0,
|
|
74
|
-
cached: 0,
|
|
75
|
-
},
|
|
76
|
-
output: {
|
|
77
|
-
total: 0,
|
|
78
|
-
reasoning: 0,
|
|
79
|
-
accepted_prediction: 0,
|
|
80
|
-
rejected_prediction: 0,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
aggregate: component(),
|
|
85
|
-
initialize: component(),
|
|
86
|
-
select: component(),
|
|
87
|
-
cancel: component(),
|
|
88
|
-
call: component(),
|
|
89
|
-
describe: component(),
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
46
|
})(AgenticaTokenUsageAggregator || (exports.AgenticaTokenUsageAggregator = AgenticaTokenUsageAggregator = {}));
|
|
93
47
|
//# sourceMappingURL=AgenticaTokenUsageAggregator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaTokenUsageAggregator.js","sourceRoot":"","sources":["../../../src/context/internal/AgenticaTokenUsageAggregator.ts"],"names":[],"mappings":";;;AAKA,IAAiB,4BAA4B,CA4D5C;AA5DD,WAAiB,4BAA4B;IAC9B,sCAAS,GAAG,CAAC,KAIzB,EAAQ,EAAE;;QACT,IAAI,CAAC,KAAK,CAAC,eAAe;YAAE,OAAO;QAEnC,MAAM;QACN,YAAY;QACZ,MAAM;QACN,MAAM,SAAS,GAAkC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzE,QAAQ;QACR,SA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AC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAChC,MAAM,SAAS,GAAkC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QACvE,SAAS,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxD,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1D,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1D,SAAS,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClE,SAAS,CAAC,MAAM,CAAC,mBAAmB,GAAG,GAAG,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC1C,CAAC;QACF,SAAS,CAAC,MAAM,CAAC,mBAAmB,GAAG,GAAG,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC1C,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA5DgB,4BAA4B,4CAA5B,4BAA4B,QA4D5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__IChatCancelFunctionsApplication.js","sourceRoot":"","sources":["../../../src/context/internal/__IChatCancelFunctionsApplication.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__IChatFunctionReference.js","sourceRoot":"","sources":["../../../src/context/internal/__IChatFunctionReference.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__IChatInitialApplication.js","sourceRoot":"","sources":["../../../src/context/internal/__IChatInitialApplication.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__IChatSelectFunctionsApplication.js","sourceRoot":"","sources":["../../../src/context/internal/__IChatSelectFunctionsApplication.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import { AgenticaOperation } from "../context/AgenticaOperation";
|
|
3
|
+
import { IAgenticaEventJson } from "../json/IAgenticaEventJson";
|
|
4
|
+
import { AgenticaEventBase } from "./AgenticaEventBase";
|
|
5
|
+
export declare class AgenticaCallEvent<Model extends ILlmSchema.Model> extends AgenticaEventBase<"call"> {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly operation: AgenticaOperation<Model>;
|
|
8
|
+
arguments: Record<string, any>;
|
|
9
|
+
constructor(props: AgenticaCallEvent.IProps<Model>);
|
|
10
|
+
toJSON(): IAgenticaEventJson.ICall;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace AgenticaCallEvent {
|
|
13
|
+
interface IProps<Model extends ILlmSchema.Model> {
|
|
14
|
+
id: string;
|
|
15
|
+
operation: AgenticaOperation<Model>;
|
|
16
|
+
arguments: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgenticaCallEvent = void 0;
|
|
4
|
+
const AgenticaEventBase_1 = require("./AgenticaEventBase");
|
|
5
|
+
class AgenticaCallEvent extends AgenticaEventBase_1.AgenticaEventBase {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super("call");
|
|
8
|
+
this.id = props.id;
|
|
9
|
+
this.operation = props.operation;
|
|
10
|
+
this.arguments = props.arguments;
|
|
11
|
+
}
|
|
12
|
+
toJSON() {
|
|
13
|
+
return {
|
|
14
|
+
type: "call",
|
|
15
|
+
id: this.id,
|
|
16
|
+
operation: this.operation.toJSON(),
|
|
17
|
+
arguments: this.arguments,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.AgenticaCallEvent = AgenticaCallEvent;
|
|
22
|
+
//# sourceMappingURL=AgenticaCallEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgenticaCallEvent.js","sourceRoot":"","sources":["../../src/events/AgenticaCallEvent.ts"],"names":[],"mappings":";;;AAIA,2DAAwD;AAExD,MAAa,iBAEX,SAAQ,qCAAyB;IAKjC,YAAmB,KAAsC;QACvD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACnC,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YAClC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF;AAtBD,8CAsBC"}
|