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