@agentica/core 0.12.0 → 0.12.2-dev.20250314
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/LICENSE +21 -21
- package/README.md +461 -461
- package/lib/Agentica.js +3 -1
- package/lib/Agentica.js.map +1 -1
- package/lib/context/internal/AgenticaTokenUsageAggregator.js +1 -1
- package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
- package/lib/index.mjs +5 -2
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
- package/prompts/cancel.md +4 -4
- package/prompts/common.md +2 -2
- package/prompts/describe.md +6 -6
- package/prompts/execute.md +6 -6
- package/prompts/initialize.md +2 -2
- package/prompts/select.md +6 -6
- package/src/Agentica.ts +359 -356
- package/src/chatgpt/ChatGptAgent.ts +76 -76
- package/src/chatgpt/ChatGptCallFunctionAgent.ts +466 -466
- package/src/chatgpt/ChatGptCancelFunctionAgent.ts +280 -280
- package/src/chatgpt/ChatGptCompletionMessageUtil.ts +166 -166
- package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +122 -122
- package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
- package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +96 -96
- package/src/chatgpt/ChatGptSelectFunctionAgent.ts +311 -311
- package/src/chatgpt/ChatGptUsageAggregator.ts +62 -62
- package/src/context/AgenticaCancelPrompt.ts +32 -32
- package/src/context/AgenticaClassOperation.ts +23 -23
- package/src/context/AgenticaContext.ts +130 -130
- package/src/context/AgenticaHttpOperation.ts +27 -27
- package/src/context/AgenticaOperation.ts +66 -66
- package/src/context/AgenticaOperationBase.ts +57 -57
- package/src/context/AgenticaOperationCollection.ts +52 -52
- package/src/context/AgenticaOperationSelection.ts +27 -27
- package/src/context/AgenticaTokenUsage.ts +170 -170
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
- package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
- package/src/context/internal/__IChatFunctionReference.ts +21 -21
- package/src/context/internal/__IChatInitialApplication.ts +15 -15
- package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
- package/src/events/AgenticaCallEvent.ts +36 -36
- package/src/events/AgenticaCancelEvent.ts +28 -28
- package/src/events/AgenticaDescribeEvent.ts +66 -66
- package/src/events/AgenticaEvent.ts +36 -36
- package/src/events/AgenticaEventBase.ts +7 -7
- package/src/events/AgenticaEventSource.ts +6 -6
- package/src/events/AgenticaExecuteEvent.ts +50 -50
- package/src/events/AgenticaInitializeEvent.ts +14 -14
- package/src/events/AgenticaRequestEvent.ts +45 -45
- package/src/events/AgenticaResponseEvent.ts +48 -48
- package/src/events/AgenticaSelectEvent.ts +37 -37
- package/src/events/AgenticaTextEvent.ts +62 -62
- package/src/functional/assertHttpLlmApplication.ts +55 -55
- package/src/functional/validateHttpLlmApplication.ts +66 -66
- package/src/index.ts +44 -44
- package/src/internal/AgenticaConstant.ts +4 -4
- package/src/internal/AgenticaDefaultPrompt.ts +43 -43
- package/src/internal/AgenticaOperationComposer.ts +96 -96
- package/src/internal/ByteArrayUtil.ts +5 -5
- package/src/internal/MPSCUtil.ts +111 -111
- package/src/internal/MathUtil.ts +3 -3
- package/src/internal/Singleton.ts +22 -22
- package/src/internal/StreamUtil.ts +64 -64
- package/src/internal/__map_take.ts +15 -15
- package/src/json/IAgenticaEventJson.ts +178 -178
- package/src/json/IAgenticaOperationJson.ts +36 -36
- package/src/json/IAgenticaOperationSelectionJson.ts +19 -19
- package/src/json/IAgenticaPromptJson.ts +130 -130
- package/src/json/IAgenticaTokenUsageJson.ts +107 -107
- package/src/prompts/AgenticaCancelPrompt.ts +32 -32
- package/src/prompts/AgenticaDescribePrompt.ts +41 -41
- package/src/prompts/AgenticaExecutePrompt.ts +52 -52
- package/src/prompts/AgenticaPrompt.ts +14 -14
- package/src/prompts/AgenticaPromptBase.ts +27 -27
- package/src/prompts/AgenticaSelectPrompt.ts +32 -32
- package/src/prompts/AgenticaTextPrompt.ts +31 -31
- package/src/structures/IAgenticaConfig.ts +123 -123
- package/src/structures/IAgenticaController.ts +133 -133
- package/src/structures/IAgenticaExecutor.ts +157 -157
- package/src/structures/IAgenticaProps.ts +69 -69
- package/src/structures/IAgenticaSystemPrompt.ts +125 -125
- package/src/structures/IAgenticaVendor.ts +39 -39
- package/src/transformers/AgenticaEventTransformer.ts +165 -165
- package/src/transformers/AgenticaPromptTransformer.ts +134 -134
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import { IAgenticaOperationJson } from "./IAgenticaOperationJson";
|
|
2
|
-
import { IAgenticaOperationSelectionJson } from "./IAgenticaOperationSelectionJson";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Nestia A.I. chatbot prompt.
|
|
6
|
-
*
|
|
7
|
-
* `IWrtnChatPrompt` is an union type of all possible prompts that can
|
|
8
|
-
* be generated by the A.I. chatbot of the {@link Agentica} class.
|
|
9
|
-
*
|
|
10
|
-
* In other words, `IWrtnChatPrompt` is a type of chat history that
|
|
11
|
-
* is occurred during the conversation between the user and the A.I. chatbot
|
|
12
|
-
* in the {@link Agentica} class.
|
|
13
|
-
*
|
|
14
|
-
* If you want to continue the previous A.I. chatbot session, you can
|
|
15
|
-
* accomplish it by assigning the {@link IAgenticaProps.histories}
|
|
16
|
-
* property when creating a new {@link Agentica} instance.
|
|
17
|
-
*
|
|
18
|
-
* @author Samchon
|
|
19
|
-
*/
|
|
20
|
-
export type IAgenticaPromptJson =
|
|
21
|
-
| IAgenticaPromptJson.IText
|
|
22
|
-
| IAgenticaPromptJson.ISelect
|
|
23
|
-
| IAgenticaPromptJson.ICancel
|
|
24
|
-
| IAgenticaPromptJson.IExecute
|
|
25
|
-
| IAgenticaPromptJson.IDescribe;
|
|
26
|
-
export namespace IAgenticaPromptJson {
|
|
27
|
-
/**
|
|
28
|
-
* Select prompt.
|
|
29
|
-
*
|
|
30
|
-
* Selection prompt about candidate functions to call.
|
|
31
|
-
*/
|
|
32
|
-
export interface ISelect extends IBase<"select"> {
|
|
33
|
-
/**
|
|
34
|
-
* ID of the LLM tool call result.
|
|
35
|
-
*/
|
|
36
|
-
id: string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Operations that have been selected.
|
|
40
|
-
*/
|
|
41
|
-
selections: IAgenticaOperationSelectionJson[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Cancel prompt.
|
|
46
|
-
*
|
|
47
|
-
* Cancellation prompt about the candidate functions to be discarded.
|
|
48
|
-
*/
|
|
49
|
-
export interface ICancel extends IBase<"cancel"> {
|
|
50
|
-
/**
|
|
51
|
-
* ID of the LLM tool call result.
|
|
52
|
-
*/
|
|
53
|
-
id: string;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Operations that have been cancelled.
|
|
57
|
-
*/
|
|
58
|
-
selections: IAgenticaOperationSelectionJson[];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Execute prompt.
|
|
63
|
-
*
|
|
64
|
-
* Execution prompt about the LLM function calling.
|
|
65
|
-
*/
|
|
66
|
-
export interface IExecute extends IBase<"execute"> {
|
|
67
|
-
/**
|
|
68
|
-
* ID of the LLM tool call result.
|
|
69
|
-
*/
|
|
70
|
-
id: string;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Target operation to call.
|
|
74
|
-
*/
|
|
75
|
-
operation: IAgenticaOperationJson;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Arguments of the LLM function calling.
|
|
79
|
-
*/
|
|
80
|
-
arguments: Record<string, any>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Return value.
|
|
84
|
-
*/
|
|
85
|
-
value: any;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Description prompt.
|
|
90
|
-
*
|
|
91
|
-
* Description prompt about the return value of the LLM function calling.
|
|
92
|
-
*/
|
|
93
|
-
export interface IDescribe extends IBase<"describe"> {
|
|
94
|
-
/**
|
|
95
|
-
* Executions of the LLM function calling.
|
|
96
|
-
*
|
|
97
|
-
* This prompt describes the return value of them.
|
|
98
|
-
*/
|
|
99
|
-
executes: IExecute[];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Description text.
|
|
103
|
-
*/
|
|
104
|
-
text: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Text prompt.
|
|
109
|
-
*/
|
|
110
|
-
export interface IText<
|
|
111
|
-
Role extends "assistant" | "user" = "assistant" | "user",
|
|
112
|
-
> extends IBase<"text"> {
|
|
113
|
-
/**
|
|
114
|
-
* Role of the orator.
|
|
115
|
-
*/
|
|
116
|
-
role: Role;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The text content.
|
|
120
|
-
*/
|
|
121
|
-
text: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface IBase<Type extends string> {
|
|
125
|
-
/**
|
|
126
|
-
* Discriminator type.
|
|
127
|
-
*/
|
|
128
|
-
type: Type;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
1
|
+
import { IAgenticaOperationJson } from "./IAgenticaOperationJson";
|
|
2
|
+
import { IAgenticaOperationSelectionJson } from "./IAgenticaOperationSelectionJson";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Nestia A.I. chatbot prompt.
|
|
6
|
+
*
|
|
7
|
+
* `IWrtnChatPrompt` is an union type of all possible prompts that can
|
|
8
|
+
* be generated by the A.I. chatbot of the {@link Agentica} class.
|
|
9
|
+
*
|
|
10
|
+
* In other words, `IWrtnChatPrompt` is a type of chat history that
|
|
11
|
+
* is occurred during the conversation between the user and the A.I. chatbot
|
|
12
|
+
* in the {@link Agentica} class.
|
|
13
|
+
*
|
|
14
|
+
* If you want to continue the previous A.I. chatbot session, you can
|
|
15
|
+
* accomplish it by assigning the {@link IAgenticaProps.histories}
|
|
16
|
+
* property when creating a new {@link Agentica} instance.
|
|
17
|
+
*
|
|
18
|
+
* @author Samchon
|
|
19
|
+
*/
|
|
20
|
+
export type IAgenticaPromptJson =
|
|
21
|
+
| IAgenticaPromptJson.IText
|
|
22
|
+
| IAgenticaPromptJson.ISelect
|
|
23
|
+
| IAgenticaPromptJson.ICancel
|
|
24
|
+
| IAgenticaPromptJson.IExecute
|
|
25
|
+
| IAgenticaPromptJson.IDescribe;
|
|
26
|
+
export namespace IAgenticaPromptJson {
|
|
27
|
+
/**
|
|
28
|
+
* Select prompt.
|
|
29
|
+
*
|
|
30
|
+
* Selection prompt about candidate functions to call.
|
|
31
|
+
*/
|
|
32
|
+
export interface ISelect extends IBase<"select"> {
|
|
33
|
+
/**
|
|
34
|
+
* ID of the LLM tool call result.
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Operations that have been selected.
|
|
40
|
+
*/
|
|
41
|
+
selections: IAgenticaOperationSelectionJson[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Cancel prompt.
|
|
46
|
+
*
|
|
47
|
+
* Cancellation prompt about the candidate functions to be discarded.
|
|
48
|
+
*/
|
|
49
|
+
export interface ICancel extends IBase<"cancel"> {
|
|
50
|
+
/**
|
|
51
|
+
* ID of the LLM tool call result.
|
|
52
|
+
*/
|
|
53
|
+
id: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Operations that have been cancelled.
|
|
57
|
+
*/
|
|
58
|
+
selections: IAgenticaOperationSelectionJson[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Execute prompt.
|
|
63
|
+
*
|
|
64
|
+
* Execution prompt about the LLM function calling.
|
|
65
|
+
*/
|
|
66
|
+
export interface IExecute extends IBase<"execute"> {
|
|
67
|
+
/**
|
|
68
|
+
* ID of the LLM tool call result.
|
|
69
|
+
*/
|
|
70
|
+
id: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Target operation to call.
|
|
74
|
+
*/
|
|
75
|
+
operation: IAgenticaOperationJson;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Arguments of the LLM function calling.
|
|
79
|
+
*/
|
|
80
|
+
arguments: Record<string, any>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Return value.
|
|
84
|
+
*/
|
|
85
|
+
value: any;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Description prompt.
|
|
90
|
+
*
|
|
91
|
+
* Description prompt about the return value of the LLM function calling.
|
|
92
|
+
*/
|
|
93
|
+
export interface IDescribe extends IBase<"describe"> {
|
|
94
|
+
/**
|
|
95
|
+
* Executions of the LLM function calling.
|
|
96
|
+
*
|
|
97
|
+
* This prompt describes the return value of them.
|
|
98
|
+
*/
|
|
99
|
+
executes: IExecute[];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Description text.
|
|
103
|
+
*/
|
|
104
|
+
text: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Text prompt.
|
|
109
|
+
*/
|
|
110
|
+
export interface IText<
|
|
111
|
+
Role extends "assistant" | "user" = "assistant" | "user",
|
|
112
|
+
> extends IBase<"text"> {
|
|
113
|
+
/**
|
|
114
|
+
* Role of the orator.
|
|
115
|
+
*/
|
|
116
|
+
role: Role;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The text content.
|
|
120
|
+
*/
|
|
121
|
+
text: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface IBase<Type extends string> {
|
|
125
|
+
/**
|
|
126
|
+
* Discriminator type.
|
|
127
|
+
*/
|
|
128
|
+
type: Type;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token usage information from the A.I. chatbot.
|
|
3
|
-
*
|
|
4
|
-
* `IAgenticaTokenUsageJson` is a structure representing the token usage
|
|
5
|
-
* information from the {@link Agentica} class. And you can get the
|
|
6
|
-
* token usage information by calling the {@link Agentica.getTokenUsage}
|
|
7
|
-
* method.
|
|
8
|
-
*
|
|
9
|
-
* For reference, `IAgenticaTokenUsageJson` provides only the token usage
|
|
10
|
-
* information, and does not contain any price or cost information. It is
|
|
11
|
-
* because the price or cost can be changed by below reasons.
|
|
12
|
-
*
|
|
13
|
-
* - Type of {@link IAgenticaProps.vendor LLM vendor}
|
|
14
|
-
* - {@link IAgenticaVendor.model} in the LLM vendor.
|
|
15
|
-
* - Just by a policy change of the LLM vendor company.
|
|
16
|
-
*
|
|
17
|
-
* @author Samchon
|
|
18
|
-
*/
|
|
19
|
-
export interface IAgenticaTokenUsageJson {
|
|
20
|
-
/**
|
|
21
|
-
* Aggregated token usage.
|
|
22
|
-
*/
|
|
23
|
-
aggregate: IAgenticaTokenUsageJson.IComponent;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Token uasge of initializer agent.
|
|
27
|
-
*/
|
|
28
|
-
initialize: IAgenticaTokenUsageJson.IComponent;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Token usage of function selector agent.
|
|
32
|
-
*/
|
|
33
|
-
select: IAgenticaTokenUsageJson.IComponent;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Token usage of function canceler agent.
|
|
37
|
-
*/
|
|
38
|
-
cancel: IAgenticaTokenUsageJson.IComponent;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Token usage of function caller agent.
|
|
42
|
-
*/
|
|
43
|
-
call: IAgenticaTokenUsageJson.IComponent;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Token usage of function calling describer agent.
|
|
47
|
-
*/
|
|
48
|
-
describe: IAgenticaTokenUsageJson.IComponent;
|
|
49
|
-
}
|
|
50
|
-
export namespace IAgenticaTokenUsageJson {
|
|
51
|
-
export interface IComponent {
|
|
52
|
-
/**
|
|
53
|
-
* Total token usage.
|
|
54
|
-
*/
|
|
55
|
-
total: number;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Input token usage of detailed.
|
|
59
|
-
*/
|
|
60
|
-
input: IInput;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Output token usage of detailed.
|
|
64
|
-
*/
|
|
65
|
-
output: IOutput;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Input token usage of detailed.
|
|
70
|
-
*/
|
|
71
|
-
export interface IInput {
|
|
72
|
-
/**
|
|
73
|
-
* Total amount of input token uasge.
|
|
74
|
-
*/
|
|
75
|
-
total: number;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Cached token usage.
|
|
79
|
-
*/
|
|
80
|
-
cached: number;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Output token usage of detailed.
|
|
85
|
-
*/
|
|
86
|
-
export interface IOutput {
|
|
87
|
-
/**
|
|
88
|
-
* Total amount of output token usage.
|
|
89
|
-
*/
|
|
90
|
-
total: number;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Reasoning token usage.
|
|
94
|
-
*/
|
|
95
|
-
reasoning: number;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Prediction token usage.
|
|
99
|
-
*/
|
|
100
|
-
accepted_prediction: number;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Rejected prediction token usage.
|
|
104
|
-
*/
|
|
105
|
-
rejected_prediction: number;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Token usage information from the A.I. chatbot.
|
|
3
|
+
*
|
|
4
|
+
* `IAgenticaTokenUsageJson` is a structure representing the token usage
|
|
5
|
+
* information from the {@link Agentica} class. And you can get the
|
|
6
|
+
* token usage information by calling the {@link Agentica.getTokenUsage}
|
|
7
|
+
* method.
|
|
8
|
+
*
|
|
9
|
+
* For reference, `IAgenticaTokenUsageJson` provides only the token usage
|
|
10
|
+
* information, and does not contain any price or cost information. It is
|
|
11
|
+
* because the price or cost can be changed by below reasons.
|
|
12
|
+
*
|
|
13
|
+
* - Type of {@link IAgenticaProps.vendor LLM vendor}
|
|
14
|
+
* - {@link IAgenticaVendor.model} in the LLM vendor.
|
|
15
|
+
* - Just by a policy change of the LLM vendor company.
|
|
16
|
+
*
|
|
17
|
+
* @author Samchon
|
|
18
|
+
*/
|
|
19
|
+
export interface IAgenticaTokenUsageJson {
|
|
20
|
+
/**
|
|
21
|
+
* Aggregated token usage.
|
|
22
|
+
*/
|
|
23
|
+
aggregate: IAgenticaTokenUsageJson.IComponent;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Token uasge of initializer agent.
|
|
27
|
+
*/
|
|
28
|
+
initialize: IAgenticaTokenUsageJson.IComponent;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Token usage of function selector agent.
|
|
32
|
+
*/
|
|
33
|
+
select: IAgenticaTokenUsageJson.IComponent;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Token usage of function canceler agent.
|
|
37
|
+
*/
|
|
38
|
+
cancel: IAgenticaTokenUsageJson.IComponent;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Token usage of function caller agent.
|
|
42
|
+
*/
|
|
43
|
+
call: IAgenticaTokenUsageJson.IComponent;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Token usage of function calling describer agent.
|
|
47
|
+
*/
|
|
48
|
+
describe: IAgenticaTokenUsageJson.IComponent;
|
|
49
|
+
}
|
|
50
|
+
export namespace IAgenticaTokenUsageJson {
|
|
51
|
+
export interface IComponent {
|
|
52
|
+
/**
|
|
53
|
+
* Total token usage.
|
|
54
|
+
*/
|
|
55
|
+
total: number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Input token usage of detailed.
|
|
59
|
+
*/
|
|
60
|
+
input: IInput;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Output token usage of detailed.
|
|
64
|
+
*/
|
|
65
|
+
output: IOutput;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Input token usage of detailed.
|
|
70
|
+
*/
|
|
71
|
+
export interface IInput {
|
|
72
|
+
/**
|
|
73
|
+
* Total amount of input token uasge.
|
|
74
|
+
*/
|
|
75
|
+
total: number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Cached token usage.
|
|
79
|
+
*/
|
|
80
|
+
cached: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Output token usage of detailed.
|
|
85
|
+
*/
|
|
86
|
+
export interface IOutput {
|
|
87
|
+
/**
|
|
88
|
+
* Total amount of output token usage.
|
|
89
|
+
*/
|
|
90
|
+
total: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Reasoning token usage.
|
|
94
|
+
*/
|
|
95
|
+
reasoning: number;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Prediction token usage.
|
|
99
|
+
*/
|
|
100
|
+
accepted_prediction: number;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Rejected prediction token usage.
|
|
104
|
+
*/
|
|
105
|
+
rejected_prediction: number;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
4
|
-
import { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
5
|
-
import { AgenticaPromptBase } from "./AgenticaPromptBase";
|
|
6
|
-
|
|
7
|
-
export class AgenticaCancelPrompt<
|
|
8
|
-
Model extends ILlmSchema.Model,
|
|
9
|
-
> extends AgenticaPromptBase<"cancel", IAgenticaPromptJson.ICancel> {
|
|
10
|
-
public readonly id: string;
|
|
11
|
-
public readonly selections: AgenticaOperationSelection<Model>[];
|
|
12
|
-
|
|
13
|
-
public constructor(props: AgenticaCancelPrompt.IProps<Model>) {
|
|
14
|
-
super("cancel");
|
|
15
|
-
this.id = props.id;
|
|
16
|
-
this.selections = props.selections;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public toJSON(): IAgenticaPromptJson.ICancel {
|
|
20
|
-
return {
|
|
21
|
-
type: this.type,
|
|
22
|
-
id: this.id,
|
|
23
|
-
selections: this.selections.map((s) => s.toJSON()),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export namespace AgenticaCancelPrompt {
|
|
28
|
-
export interface IProps<Model extends ILlmSchema.Model> {
|
|
29
|
-
id: string;
|
|
30
|
-
selections: AgenticaOperationSelection<Model>[];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
4
|
+
import { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
5
|
+
import { AgenticaPromptBase } from "./AgenticaPromptBase";
|
|
6
|
+
|
|
7
|
+
export class AgenticaCancelPrompt<
|
|
8
|
+
Model extends ILlmSchema.Model,
|
|
9
|
+
> extends AgenticaPromptBase<"cancel", IAgenticaPromptJson.ICancel> {
|
|
10
|
+
public readonly id: string;
|
|
11
|
+
public readonly selections: AgenticaOperationSelection<Model>[];
|
|
12
|
+
|
|
13
|
+
public constructor(props: AgenticaCancelPrompt.IProps<Model>) {
|
|
14
|
+
super("cancel");
|
|
15
|
+
this.id = props.id;
|
|
16
|
+
this.selections = props.selections;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public toJSON(): IAgenticaPromptJson.ICancel {
|
|
20
|
+
return {
|
|
21
|
+
type: this.type,
|
|
22
|
+
id: this.id,
|
|
23
|
+
selections: this.selections.map((s) => s.toJSON()),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export namespace AgenticaCancelPrompt {
|
|
28
|
+
export interface IProps<Model extends ILlmSchema.Model> {
|
|
29
|
+
id: string;
|
|
30
|
+
selections: AgenticaOperationSelection<Model>[];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
import { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
4
|
-
import { AgenticaExecutePrompt } from "./AgenticaExecutePrompt";
|
|
5
|
-
import { AgenticaPromptBase } from "./AgenticaPromptBase";
|
|
6
|
-
|
|
7
|
-
export class AgenticaDescribePrompt<
|
|
8
|
-
Model extends ILlmSchema.Model,
|
|
9
|
-
> extends AgenticaPromptBase<"describe", IAgenticaPromptJson.IDescribe> {
|
|
10
|
-
/**
|
|
11
|
-
* Executions of the LLM function calling.
|
|
12
|
-
*
|
|
13
|
-
* This prompt describes the return value of them.
|
|
14
|
-
*/
|
|
15
|
-
public readonly executes: AgenticaExecutePrompt<Model>[];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Description text.
|
|
19
|
-
*/
|
|
20
|
-
public readonly text: string;
|
|
21
|
-
|
|
22
|
-
public constructor(props: AgenticaDescribePrompt.IProps<Model>) {
|
|
23
|
-
super("describe");
|
|
24
|
-
this.executes = props.executes;
|
|
25
|
-
this.text = props.text;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public toJSON(): IAgenticaPromptJson.IDescribe {
|
|
29
|
-
return {
|
|
30
|
-
type: this.type,
|
|
31
|
-
executes: this.executes.map((e) => e.toJSON()),
|
|
32
|
-
text: this.text,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export namespace AgenticaDescribePrompt {
|
|
37
|
-
export interface IProps<Model extends ILlmSchema.Model> {
|
|
38
|
-
executes: AgenticaExecutePrompt<Model>[];
|
|
39
|
-
text: string;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { IAgenticaPromptJson } from "../json/IAgenticaPromptJson";
|
|
4
|
+
import { AgenticaExecutePrompt } from "./AgenticaExecutePrompt";
|
|
5
|
+
import { AgenticaPromptBase } from "./AgenticaPromptBase";
|
|
6
|
+
|
|
7
|
+
export class AgenticaDescribePrompt<
|
|
8
|
+
Model extends ILlmSchema.Model,
|
|
9
|
+
> extends AgenticaPromptBase<"describe", IAgenticaPromptJson.IDescribe> {
|
|
10
|
+
/**
|
|
11
|
+
* Executions of the LLM function calling.
|
|
12
|
+
*
|
|
13
|
+
* This prompt describes the return value of them.
|
|
14
|
+
*/
|
|
15
|
+
public readonly executes: AgenticaExecutePrompt<Model>[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Description text.
|
|
19
|
+
*/
|
|
20
|
+
public readonly text: string;
|
|
21
|
+
|
|
22
|
+
public constructor(props: AgenticaDescribePrompt.IProps<Model>) {
|
|
23
|
+
super("describe");
|
|
24
|
+
this.executes = props.executes;
|
|
25
|
+
this.text = props.text;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public toJSON(): IAgenticaPromptJson.IDescribe {
|
|
29
|
+
return {
|
|
30
|
+
type: this.type,
|
|
31
|
+
executes: this.executes.map((e) => e.toJSON()),
|
|
32
|
+
text: this.text,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export namespace AgenticaDescribePrompt {
|
|
37
|
+
export interface IProps<Model extends ILlmSchema.Model> {
|
|
38
|
+
executes: AgenticaExecutePrompt<Model>[];
|
|
39
|
+
text: string;
|
|
40
|
+
}
|
|
41
|
+
}
|