@agentica/core 0.9.0 → 0.10.0-dev.20250302
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 +419 -419
- package/lib/Agentica.d.ts +4 -4
- package/lib/Agentica.js +7 -7
- package/lib/Agentica.js.map +1 -1
- package/lib/chatgpt/ChatGptCallFunctionAgent.js +14 -6
- package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +10 -5
- package/lib/index.mjs.map +1 -1
- package/lib/structures/IAgenticaContext.d.ts +1 -1
- package/lib/structures/IAgenticaController.d.ts +4 -5
- package/lib/structures/IAgenticaEvent.d.ts +3 -3
- package/lib/structures/IAgenticaOperation.d.ts +2 -3
- package/lib/structures/IAgenticaOperationSelection.d.ts +2 -3
- package/lib/structures/IAgenticaPrompt.d.ts +2 -3
- package/lib/structures/IAgenticaProps.d.ts +4 -4
- package/lib/structures/IAgenticaTokenUsage.d.ts +3 -3
- package/lib/structures/{IAgenticaProvider.d.ts → IAgenticaVendor.d.ts} +6 -6
- package/lib/structures/{IAgenticaProvider.js → IAgenticaVendor.js} +1 -1
- package/lib/structures/IAgenticaVendor.js.map +1 -0
- 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 +323 -323
- package/src/chatgpt/ChatGptAgent.ts +75 -75
- package/src/chatgpt/ChatGptCallFunctionAgent.ts +464 -448
- package/src/chatgpt/ChatGptCancelFunctionAgent.ts +287 -287
- package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +52 -52
- package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
- package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +88 -88
- package/src/chatgpt/ChatGptSelectFunctionAgent.ts +319 -319
- package/src/functional/createHttpLlmApplication.ts +63 -63
- package/src/index.ts +19 -19
- package/src/internal/AgenticaConstant.ts +4 -4
- package/src/internal/AgenticaDefaultPrompt.ts +43 -43
- package/src/internal/AgenticaOperationComposer.ts +87 -87
- package/src/internal/AgenticaPromptFactory.ts +32 -32
- package/src/internal/AgenticaPromptTransformer.ts +86 -86
- package/src/internal/AgenticaTokenUsageAggregator.ts +115 -115
- package/src/internal/MathUtil.ts +3 -3
- package/src/internal/Singleton.ts +22 -22
- package/src/internal/__map_take.ts +15 -15
- package/src/structures/IAgenticaConfig.ts +123 -123
- package/src/structures/IAgenticaContext.ts +129 -129
- package/src/structures/IAgenticaController.ts +133 -132
- package/src/structures/IAgenticaEvent.ts +229 -229
- package/src/structures/IAgenticaExecutor.ts +156 -156
- package/src/structures/IAgenticaOperation.ts +63 -64
- package/src/structures/IAgenticaOperationCollection.ts +52 -52
- package/src/structures/IAgenticaOperationSelection.ts +68 -69
- package/src/structures/IAgenticaPrompt.ts +182 -178
- package/src/structures/IAgenticaProps.ts +70 -70
- package/src/structures/IAgenticaSystemPrompt.ts +124 -124
- package/src/structures/IAgenticaTokenUsage.ts +107 -107
- package/src/structures/{IAgenticaProvider.ts → IAgenticaVendor.ts} +39 -39
- package/src/structures/internal/__IChatCancelFunctionsApplication.ts +23 -23
- package/src/structures/internal/__IChatFunctionReference.ts +21 -21
- package/src/structures/internal/__IChatInitialApplication.ts +15 -15
- package/src/structures/internal/__IChatSelectFunctionsApplication.ts +24 -24
- package/src/typings/AgenticaSource.ts +6 -6
- package/lib/structures/IAgenticaProvider.js.map +0 -1
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
import { IHttpLlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| IAgenticaOperationSelection.
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
1
|
+
import { IHttpLlmFunction, ILlmFunction, ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
|
|
3
|
+
import { IAgenticaController } from "./IAgenticaController";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nestia agent operation selection.
|
|
7
|
+
*
|
|
8
|
+
* `IAgenticaOperationSelection` is a type represents an operation
|
|
9
|
+
* which has been selected by the A.I. chatbot of {@link Agentica}
|
|
10
|
+
* class for the LLM (Large Language Model) function calling with
|
|
11
|
+
* detailed {@link reason} of the selection (or cancellation).
|
|
12
|
+
*
|
|
13
|
+
* Also, `IAgenticaOperationSelection` is an union type that can
|
|
14
|
+
* specify a subtype by checking the {@link protocol} property.
|
|
15
|
+
*
|
|
16
|
+
* @author Samchon
|
|
17
|
+
*/
|
|
18
|
+
export type IAgenticaOperationSelection<Model extends ILlmSchema.Model> =
|
|
19
|
+
| IAgenticaOperationSelection.IHttp<Model>
|
|
20
|
+
| IAgenticaOperationSelection.IClass<Model>;
|
|
21
|
+
export namespace IAgenticaOperationSelection {
|
|
22
|
+
export type IHttp<Model extends ILlmSchema.Model> = IBase<
|
|
23
|
+
"http",
|
|
24
|
+
IAgenticaController.IHttp<Model>,
|
|
25
|
+
IHttpLlmFunction<Model>
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export type IClass<Model extends ILlmSchema.Model> = IBase<
|
|
29
|
+
"class",
|
|
30
|
+
IAgenticaController.IClass<Model>,
|
|
31
|
+
ILlmFunction<Model>
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
interface IBase<Protocol, Controller, Function> {
|
|
35
|
+
/**
|
|
36
|
+
* Discriminator protocol.
|
|
37
|
+
*/
|
|
38
|
+
protocol: Protocol;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Belonged controller of the target function.
|
|
42
|
+
*/
|
|
43
|
+
controller: Controller;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Target function.
|
|
47
|
+
*
|
|
48
|
+
* Function that has been selected to prepare LLM function calling,
|
|
49
|
+
* or canceled due to no more required.
|
|
50
|
+
*/
|
|
51
|
+
function: Function;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Identifier name of the target function.
|
|
55
|
+
*
|
|
56
|
+
* If {@link Agentica} has multiple {@link IAgenticaController}s,
|
|
57
|
+
* the `name` can be different from target function's name.
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The reason of the function selection or cancellation.
|
|
63
|
+
*/
|
|
64
|
+
reason: string;
|
|
65
|
+
|
|
66
|
+
toJSON(): Omit<IBase<Protocol, string, string>, "toJSON">;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,178 +1,182 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| IAgenticaPrompt.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
import {
|
|
2
|
+
IHttpLlmFunction,
|
|
3
|
+
IHttpResponse,
|
|
4
|
+
ILlmFunction,
|
|
5
|
+
ILlmSchema,
|
|
6
|
+
} from "@samchon/openapi";
|
|
7
|
+
|
|
8
|
+
import { IAgenticaController } from "./IAgenticaController";
|
|
9
|
+
import { IAgenticaOperationSelection } from "./IAgenticaOperationSelection";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Nestia A.I. chatbot prompt.
|
|
13
|
+
*
|
|
14
|
+
* `IWrtnChatPrompt` is an union type of all possible prompts that can
|
|
15
|
+
* be generated by the A.I. chatbot of the {@link Agentica} class.
|
|
16
|
+
*
|
|
17
|
+
* In other words, `IWrtnChatPrompt` is a type of chat history that
|
|
18
|
+
* is occurred during the conversation between the user and the A.I. chatbot
|
|
19
|
+
* in the {@link Agentica} class.
|
|
20
|
+
*
|
|
21
|
+
* If you want to continue the previous A.I. chatbot session, you can
|
|
22
|
+
* accomplish it by assigning the {@link IAgenticaProps.histories}
|
|
23
|
+
* property when creating a new {@link Agentica} instance.
|
|
24
|
+
*
|
|
25
|
+
* @author Samchon
|
|
26
|
+
*/
|
|
27
|
+
export type IAgenticaPrompt<Model extends ILlmSchema.Model> =
|
|
28
|
+
| IAgenticaPrompt.IText
|
|
29
|
+
| IAgenticaPrompt.ISelect<Model>
|
|
30
|
+
| IAgenticaPrompt.ICancel<Model>
|
|
31
|
+
| IAgenticaPrompt.IExecute<Model>
|
|
32
|
+
| IAgenticaPrompt.IDescribe<Model>;
|
|
33
|
+
export namespace IAgenticaPrompt {
|
|
34
|
+
/**
|
|
35
|
+
* Select prompt.
|
|
36
|
+
*
|
|
37
|
+
* Selection prompt about candidate functions to call.
|
|
38
|
+
*/
|
|
39
|
+
export interface ISelect<Model extends ILlmSchema.Model>
|
|
40
|
+
extends IBase<"select"> {
|
|
41
|
+
/**
|
|
42
|
+
* ID of the LLM tool call result.
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Operations that have been selected.
|
|
48
|
+
*/
|
|
49
|
+
operations: IAgenticaOperationSelection<Model>[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Cancel prompt.
|
|
54
|
+
*
|
|
55
|
+
* Cancellation prompt about the candidate functions to be discarded.
|
|
56
|
+
*/
|
|
57
|
+
export interface ICancel<Model extends ILlmSchema.Model>
|
|
58
|
+
extends IBase<"cancel"> {
|
|
59
|
+
/**
|
|
60
|
+
* ID of the LLM tool call result.
|
|
61
|
+
*/
|
|
62
|
+
id: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Operations that have been cancelled.
|
|
66
|
+
*/
|
|
67
|
+
operations: IAgenticaOperationSelection<Model>[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Execute prompt.
|
|
72
|
+
*
|
|
73
|
+
* Execution prompt about the LLM function calling.
|
|
74
|
+
*/
|
|
75
|
+
export type IExecute<Model extends ILlmSchema.Model> =
|
|
76
|
+
| IExecute.IHttp<Model>
|
|
77
|
+
| IExecute.IClass<Model>;
|
|
78
|
+
export namespace IExecute {
|
|
79
|
+
export type IHttp<Model extends ILlmSchema.Model> = IBase<
|
|
80
|
+
"http",
|
|
81
|
+
IAgenticaController.IHttp<Model>,
|
|
82
|
+
IHttpLlmFunction<Model>,
|
|
83
|
+
IHttpResponse
|
|
84
|
+
>;
|
|
85
|
+
export type IClass<Model extends ILlmSchema.Model> = IBase<
|
|
86
|
+
"class",
|
|
87
|
+
IAgenticaController.IClass<Model>,
|
|
88
|
+
ILlmFunction<Model>,
|
|
89
|
+
any
|
|
90
|
+
>;
|
|
91
|
+
interface IBase<Protocol, Controller, Function, Value> {
|
|
92
|
+
/**
|
|
93
|
+
* Discriminator type.
|
|
94
|
+
*/
|
|
95
|
+
type: "execute";
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Protocol discriminator.
|
|
99
|
+
*/
|
|
100
|
+
protocol: Protocol;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Belonged controller of the target function.
|
|
104
|
+
*/
|
|
105
|
+
controller: Controller;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Target function to call.
|
|
109
|
+
*/
|
|
110
|
+
function: Function;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* ID of the LLM tool call result.
|
|
114
|
+
*/
|
|
115
|
+
id: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Identifier name of the function.
|
|
119
|
+
*
|
|
120
|
+
* If {@link Agentica} has multiple {@link IAgenticaController}s,
|
|
121
|
+
* the `name` can be different from target function's name.
|
|
122
|
+
*/
|
|
123
|
+
name: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Arguments of the LLM function calling.
|
|
127
|
+
*/
|
|
128
|
+
arguments: object;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Return value.
|
|
132
|
+
*/
|
|
133
|
+
value: Value;
|
|
134
|
+
|
|
135
|
+
toJSON(): Omit<IBase<Protocol, string, string, Value>, "toJSON">;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Description prompt.
|
|
141
|
+
*
|
|
142
|
+
* Description prompt about the return value of the LLM function calling.
|
|
143
|
+
*/
|
|
144
|
+
export interface IDescribe<Model extends ILlmSchema.Model>
|
|
145
|
+
extends IBase<"describe"> {
|
|
146
|
+
/**
|
|
147
|
+
* Executions of the LLM function calling.
|
|
148
|
+
*
|
|
149
|
+
* This prompt describes the return value of them.
|
|
150
|
+
*/
|
|
151
|
+
executions: IExecute<Model>[];
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Description text.
|
|
155
|
+
*/
|
|
156
|
+
text: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Text prompt.
|
|
161
|
+
*/
|
|
162
|
+
export interface IText<
|
|
163
|
+
Role extends "assistant" | "user" = "assistant" | "user",
|
|
164
|
+
> extends IBase<"text"> {
|
|
165
|
+
/**
|
|
166
|
+
* Role of the orator.
|
|
167
|
+
*/
|
|
168
|
+
role: Role;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The text content.
|
|
172
|
+
*/
|
|
173
|
+
text: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface IBase<Type extends string> {
|
|
177
|
+
/**
|
|
178
|
+
* Discriminator type.
|
|
179
|
+
*/
|
|
180
|
+
type: Type;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
import { Primitive } from "typia";
|
|
3
|
-
|
|
4
|
-
import { IAgenticaConfig } from "./IAgenticaConfig";
|
|
5
|
-
import { IAgenticaController } from "./IAgenticaController";
|
|
6
|
-
import { IAgenticaPrompt } from "./IAgenticaPrompt";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Properties of the Nestia Agent.
|
|
11
|
-
*
|
|
12
|
-
* `IAgenticaProps` is an interface that defines the properties
|
|
13
|
-
* of the {@link Agentica.constructor}. In the `IAgenticaProps`,
|
|
14
|
-
* there're everything to prepare to create a Super A.I. chatbot
|
|
15
|
-
* performing the LLM (Large Language Model) function calling.
|
|
16
|
-
*
|
|
17
|
-
* At first, you have to specify the LLM service {@link
|
|
18
|
-
* OpenAI with its API key and client API. And then, you have to define
|
|
19
|
-
* the {@link controllers} serving the functions to call. The controllers
|
|
20
|
-
* are separated by two protocols; HTTP API and TypeScript class. At last,
|
|
21
|
-
* you can {@link config configure} the agent by setting the locale, timezone,
|
|
22
|
-
* and some of system prompts.
|
|
23
|
-
*
|
|
24
|
-
* Additionally, if you want to start from the previous A.I. chatbot
|
|
25
|
-
* session, you can accomplish it by assigning the previous prompt
|
|
26
|
-
* histories to the {@link histories} property.
|
|
27
|
-
*
|
|
28
|
-
* @author Samchon
|
|
29
|
-
*/
|
|
30
|
-
export interface IAgenticaProps<Model extends ILlmSchema.Model> {
|
|
31
|
-
/**
|
|
32
|
-
* LLM schema model.
|
|
33
|
-
*/
|
|
34
|
-
model: Model;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* LLM service
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Controllers serving functions to call.
|
|
43
|
-
*/
|
|
44
|
-
controllers: IAgenticaController<Model>[];
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Configuration of agent.
|
|
48
|
-
*
|
|
49
|
-
* Configuration of A.I. chatbot agent including the user's locale,
|
|
50
|
-
* timezone, and some of system prompts. Also, you can affect to the
|
|
51
|
-
* LLM function selecting/calling logic by configuring additional
|
|
52
|
-
* properties.
|
|
53
|
-
*
|
|
54
|
-
* If you don't configure this property, these values would be default.
|
|
55
|
-
*
|
|
56
|
-
* - `locale`: your system's locale and timezone
|
|
57
|
-
* - `timezone`: your system's timezone
|
|
58
|
-
* - `systemPrompt`: default prompts written in markdown
|
|
59
|
-
* - https://github.com/samchon/nestia/tree/master/packages/agent/prompts
|
|
60
|
-
*/
|
|
61
|
-
config?: IAgenticaConfig<Model>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Prompt histories.
|
|
65
|
-
*
|
|
66
|
-
* If you're starting the conversation from an existing session,
|
|
67
|
-
* assign the previouis prompt histories to this property.
|
|
68
|
-
*/
|
|
69
|
-
histories?: Primitive<IAgenticaPrompt<Model>>[];
|
|
70
|
-
}
|
|
1
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
2
|
+
import { Primitive } from "typia";
|
|
3
|
+
|
|
4
|
+
import { IAgenticaConfig } from "./IAgenticaConfig";
|
|
5
|
+
import { IAgenticaController } from "./IAgenticaController";
|
|
6
|
+
import { IAgenticaPrompt } from "./IAgenticaPrompt";
|
|
7
|
+
import { IAgenticaVendor } from "./IAgenticaVendor";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Properties of the Nestia Agent.
|
|
11
|
+
*
|
|
12
|
+
* `IAgenticaProps` is an interface that defines the properties
|
|
13
|
+
* of the {@link Agentica.constructor}. In the `IAgenticaProps`,
|
|
14
|
+
* there're everything to prepare to create a Super A.I. chatbot
|
|
15
|
+
* performing the LLM (Large Language Model) function calling.
|
|
16
|
+
*
|
|
17
|
+
* At first, you have to specify the LLM service {@link vendor} like
|
|
18
|
+
* OpenAI with its API key and client API. And then, you have to define
|
|
19
|
+
* the {@link controllers} serving the functions to call. The controllers
|
|
20
|
+
* are separated by two protocols; HTTP API and TypeScript class. At last,
|
|
21
|
+
* you can {@link config configure} the agent by setting the locale, timezone,
|
|
22
|
+
* and some of system prompts.
|
|
23
|
+
*
|
|
24
|
+
* Additionally, if you want to start from the previous A.I. chatbot
|
|
25
|
+
* session, you can accomplish it by assigning the previous prompt
|
|
26
|
+
* histories to the {@link histories} property.
|
|
27
|
+
*
|
|
28
|
+
* @author Samchon
|
|
29
|
+
*/
|
|
30
|
+
export interface IAgenticaProps<Model extends ILlmSchema.Model> {
|
|
31
|
+
/**
|
|
32
|
+
* LLM schema model.
|
|
33
|
+
*/
|
|
34
|
+
model: Model;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* LLM service vendor.
|
|
38
|
+
*/
|
|
39
|
+
vendor: IAgenticaVendor;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Controllers serving functions to call.
|
|
43
|
+
*/
|
|
44
|
+
controllers: IAgenticaController<Model>[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration of agent.
|
|
48
|
+
*
|
|
49
|
+
* Configuration of A.I. chatbot agent including the user's locale,
|
|
50
|
+
* timezone, and some of system prompts. Also, you can affect to the
|
|
51
|
+
* LLM function selecting/calling logic by configuring additional
|
|
52
|
+
* properties.
|
|
53
|
+
*
|
|
54
|
+
* If you don't configure this property, these values would be default.
|
|
55
|
+
*
|
|
56
|
+
* - `locale`: your system's locale and timezone
|
|
57
|
+
* - `timezone`: your system's timezone
|
|
58
|
+
* - `systemPrompt`: default prompts written in markdown
|
|
59
|
+
* - https://github.com/samchon/nestia/tree/master/packages/agent/prompts
|
|
60
|
+
*/
|
|
61
|
+
config?: IAgenticaConfig<Model>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Prompt histories.
|
|
65
|
+
*
|
|
66
|
+
* If you're starting the conversation from an existing session,
|
|
67
|
+
* assign the previouis prompt histories to this property.
|
|
68
|
+
*/
|
|
69
|
+
histories?: Primitive<IAgenticaPrompt<Model>>[];
|
|
70
|
+
}
|