@agentica/core 0.10.1-dev.20250302 → 0.10.3
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 -419
- 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 -464
- 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 -133
- package/src/structures/IAgenticaEvent.ts +229 -229
- package/src/structures/IAgenticaExecutor.ts +156 -156
- package/src/structures/IAgenticaOperation.ts +63 -63
- package/src/structures/IAgenticaOperationCollection.ts +52 -52
- package/src/structures/IAgenticaOperationSelection.ts +68 -68
- package/src/structures/IAgenticaPrompt.ts +182 -182
- package/src/structures/IAgenticaProps.ts +70 -70
- package/src/structures/IAgenticaSystemPrompt.ts +124 -124
- package/src/structures/IAgenticaTokenUsage.ts +107 -107
- package/src/structures/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
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IHttpConnection,
|
|
3
|
-
IHttpLlmApplication,
|
|
4
|
-
IHttpLlmFunction,
|
|
5
|
-
IHttpResponse,
|
|
6
|
-
ILlmApplication,
|
|
7
|
-
ILlmFunction,
|
|
8
|
-
ILlmSchema,
|
|
9
|
-
} from "@samchon/openapi";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Controller of the Nestia Agent.
|
|
13
|
-
*
|
|
14
|
-
* `IAgenticaController` is a type represents a controller of the
|
|
15
|
-
* {@link Agentica}, which serves a set of functions to be called
|
|
16
|
-
* by A.I. chatbot from LLM function calling.
|
|
17
|
-
*
|
|
18
|
-
* Also, `IAgenticaController` is an union type which can specify
|
|
19
|
-
* a subtype by checking the {@link protocol} property.
|
|
20
|
-
*
|
|
21
|
-
* - HTTP server: {@link IAgenticaController..IHttp}
|
|
22
|
-
* - TypeScript class: {@link IAgenticaController.IClass}
|
|
23
|
-
*
|
|
24
|
-
* @author Samchon
|
|
25
|
-
*/
|
|
26
|
-
export type IAgenticaController<Model extends ILlmSchema.Model> =
|
|
27
|
-
| IAgenticaController.IHttp<Model>
|
|
28
|
-
| IAgenticaController.IClass<Model>;
|
|
29
|
-
export namespace IAgenticaController {
|
|
30
|
-
/**
|
|
31
|
-
* HTTP controller.
|
|
32
|
-
*
|
|
33
|
-
* You can make it by {@link createHttpLlmApplication} function with
|
|
34
|
-
* the Swagger or OpenAPI document.
|
|
35
|
-
*/
|
|
36
|
-
export interface IHttp<Model extends ILlmSchema.Model>
|
|
37
|
-
extends IBase<"http", IHttpLlmApplication<Model>> {
|
|
38
|
-
/**
|
|
39
|
-
* Connection to the server.
|
|
40
|
-
*
|
|
41
|
-
* Connection to the API server including the URL and headers.
|
|
42
|
-
*/
|
|
43
|
-
connection: IHttpConnection;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Executor of the API function.
|
|
47
|
-
*
|
|
48
|
-
* @param props Properties of the API function call
|
|
49
|
-
* @returns HTTP response of the API function call
|
|
50
|
-
*/
|
|
51
|
-
execute?: (props: {
|
|
52
|
-
/**
|
|
53
|
-
* Connection to the server.
|
|
54
|
-
*/
|
|
55
|
-
connection: IHttpConnection;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Application schema.
|
|
59
|
-
*/
|
|
60
|
-
application: IHttpLlmApplication<Model>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Function schema.
|
|
64
|
-
*/
|
|
65
|
-
function: IHttpLlmFunction<Model>;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Arguments of the function calling.
|
|
69
|
-
*
|
|
70
|
-
* It is an object of key-value pairs of the API function's parameters.
|
|
71
|
-
* The property keys are composed by below rules:
|
|
72
|
-
*
|
|
73
|
-
* - parameter names
|
|
74
|
-
* - query parameter as an object type if exists
|
|
75
|
-
* - body parameter if exists
|
|
76
|
-
*/
|
|
77
|
-
arguments: object;
|
|
78
|
-
}) => Promise<IHttpResponse>;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* TypeScript class controller.
|
|
83
|
-
*
|
|
84
|
-
* You can make it by `typia.llm.application<App, Model>()` function.
|
|
85
|
-
*
|
|
86
|
-
* - https://typia.io/docs/llm/application
|
|
87
|
-
*/
|
|
88
|
-
export interface IClass<Model extends ILlmSchema.Model>
|
|
89
|
-
extends IBase<"class", ILlmApplication<Model>> {
|
|
90
|
-
/**
|
|
91
|
-
* Executor of the class function.
|
|
92
|
-
*
|
|
93
|
-
* Executor of the class function, by target class instance
|
|
94
|
-
* or callback function with given schema and arguments
|
|
95
|
-
* information.
|
|
96
|
-
*/
|
|
97
|
-
execute:
|
|
98
|
-
| object
|
|
99
|
-
| ((props: {
|
|
100
|
-
/**
|
|
101
|
-
* Target application schema.
|
|
102
|
-
*/
|
|
103
|
-
application: ILlmApplication<Model>;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Target function schema.
|
|
107
|
-
*/
|
|
108
|
-
function: ILlmFunction<Model>;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Arguments of the function calling.
|
|
112
|
-
*/
|
|
113
|
-
arguments: object;
|
|
114
|
-
}) => Promise<unknown>);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface IBase<Protocol, Application> {
|
|
118
|
-
/**
|
|
119
|
-
* Protocol discrminator.
|
|
120
|
-
*/
|
|
121
|
-
protocol: Protocol;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Name of the controller.
|
|
125
|
-
*/
|
|
126
|
-
name: string;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Application schema of function calling.
|
|
130
|
-
*/
|
|
131
|
-
application: Application;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
IHttpConnection,
|
|
3
|
+
IHttpLlmApplication,
|
|
4
|
+
IHttpLlmFunction,
|
|
5
|
+
IHttpResponse,
|
|
6
|
+
ILlmApplication,
|
|
7
|
+
ILlmFunction,
|
|
8
|
+
ILlmSchema,
|
|
9
|
+
} from "@samchon/openapi";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Controller of the Nestia Agent.
|
|
13
|
+
*
|
|
14
|
+
* `IAgenticaController` is a type represents a controller of the
|
|
15
|
+
* {@link Agentica}, which serves a set of functions to be called
|
|
16
|
+
* by A.I. chatbot from LLM function calling.
|
|
17
|
+
*
|
|
18
|
+
* Also, `IAgenticaController` is an union type which can specify
|
|
19
|
+
* a subtype by checking the {@link protocol} property.
|
|
20
|
+
*
|
|
21
|
+
* - HTTP server: {@link IAgenticaController..IHttp}
|
|
22
|
+
* - TypeScript class: {@link IAgenticaController.IClass}
|
|
23
|
+
*
|
|
24
|
+
* @author Samchon
|
|
25
|
+
*/
|
|
26
|
+
export type IAgenticaController<Model extends ILlmSchema.Model> =
|
|
27
|
+
| IAgenticaController.IHttp<Model>
|
|
28
|
+
| IAgenticaController.IClass<Model>;
|
|
29
|
+
export namespace IAgenticaController {
|
|
30
|
+
/**
|
|
31
|
+
* HTTP controller.
|
|
32
|
+
*
|
|
33
|
+
* You can make it by {@link createHttpLlmApplication} function with
|
|
34
|
+
* the Swagger or OpenAPI document.
|
|
35
|
+
*/
|
|
36
|
+
export interface IHttp<Model extends ILlmSchema.Model>
|
|
37
|
+
extends IBase<"http", IHttpLlmApplication<Model>> {
|
|
38
|
+
/**
|
|
39
|
+
* Connection to the server.
|
|
40
|
+
*
|
|
41
|
+
* Connection to the API server including the URL and headers.
|
|
42
|
+
*/
|
|
43
|
+
connection: IHttpConnection;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Executor of the API function.
|
|
47
|
+
*
|
|
48
|
+
* @param props Properties of the API function call
|
|
49
|
+
* @returns HTTP response of the API function call
|
|
50
|
+
*/
|
|
51
|
+
execute?: (props: {
|
|
52
|
+
/**
|
|
53
|
+
* Connection to the server.
|
|
54
|
+
*/
|
|
55
|
+
connection: IHttpConnection;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Application schema.
|
|
59
|
+
*/
|
|
60
|
+
application: IHttpLlmApplication<Model>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Function schema.
|
|
64
|
+
*/
|
|
65
|
+
function: IHttpLlmFunction<Model>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Arguments of the function calling.
|
|
69
|
+
*
|
|
70
|
+
* It is an object of key-value pairs of the API function's parameters.
|
|
71
|
+
* The property keys are composed by below rules:
|
|
72
|
+
*
|
|
73
|
+
* - parameter names
|
|
74
|
+
* - query parameter as an object type if exists
|
|
75
|
+
* - body parameter if exists
|
|
76
|
+
*/
|
|
77
|
+
arguments: object;
|
|
78
|
+
}) => Promise<IHttpResponse>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* TypeScript class controller.
|
|
83
|
+
*
|
|
84
|
+
* You can make it by `typia.llm.application<App, Model>()` function.
|
|
85
|
+
*
|
|
86
|
+
* - https://typia.io/docs/llm/application
|
|
87
|
+
*/
|
|
88
|
+
export interface IClass<Model extends ILlmSchema.Model>
|
|
89
|
+
extends IBase<"class", ILlmApplication<Model>> {
|
|
90
|
+
/**
|
|
91
|
+
* Executor of the class function.
|
|
92
|
+
*
|
|
93
|
+
* Executor of the class function, by target class instance
|
|
94
|
+
* or callback function with given schema and arguments
|
|
95
|
+
* information.
|
|
96
|
+
*/
|
|
97
|
+
execute:
|
|
98
|
+
| object
|
|
99
|
+
| ((props: {
|
|
100
|
+
/**
|
|
101
|
+
* Target application schema.
|
|
102
|
+
*/
|
|
103
|
+
application: ILlmApplication<Model>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Target function schema.
|
|
107
|
+
*/
|
|
108
|
+
function: ILlmFunction<Model>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Arguments of the function calling.
|
|
112
|
+
*/
|
|
113
|
+
arguments: object;
|
|
114
|
+
}) => Promise<unknown>);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface IBase<Protocol, Application> {
|
|
118
|
+
/**
|
|
119
|
+
* Protocol discrminator.
|
|
120
|
+
*/
|
|
121
|
+
protocol: Protocol;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Name of the controller.
|
|
125
|
+
*/
|
|
126
|
+
name: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Application schema of function calling.
|
|
130
|
+
*/
|
|
131
|
+
application: Application;
|
|
132
|
+
}
|
|
133
|
+
}
|