@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.
Files changed (68) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +419 -419
  3. package/lib/Agentica.d.ts +4 -4
  4. package/lib/Agentica.js +7 -7
  5. package/lib/Agentica.js.map +1 -1
  6. package/lib/chatgpt/ChatGptCallFunctionAgent.js +14 -6
  7. package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
  8. package/lib/index.d.ts +1 -1
  9. package/lib/index.js +1 -1
  10. package/lib/index.js.map +1 -1
  11. package/lib/index.mjs +10 -5
  12. package/lib/index.mjs.map +1 -1
  13. package/lib/structures/IAgenticaContext.d.ts +1 -1
  14. package/lib/structures/IAgenticaController.d.ts +4 -5
  15. package/lib/structures/IAgenticaEvent.d.ts +3 -3
  16. package/lib/structures/IAgenticaOperation.d.ts +2 -3
  17. package/lib/structures/IAgenticaOperationSelection.d.ts +2 -3
  18. package/lib/structures/IAgenticaPrompt.d.ts +2 -3
  19. package/lib/structures/IAgenticaProps.d.ts +4 -4
  20. package/lib/structures/IAgenticaTokenUsage.d.ts +3 -3
  21. package/lib/structures/{IAgenticaProvider.d.ts → IAgenticaVendor.d.ts} +6 -6
  22. package/lib/structures/{IAgenticaProvider.js → IAgenticaVendor.js} +1 -1
  23. package/lib/structures/IAgenticaVendor.js.map +1 -0
  24. package/package.json +1 -1
  25. package/prompts/cancel.md +4 -4
  26. package/prompts/common.md +2 -2
  27. package/prompts/describe.md +6 -6
  28. package/prompts/execute.md +6 -6
  29. package/prompts/initialize.md +2 -2
  30. package/prompts/select.md +6 -6
  31. package/src/Agentica.ts +323 -323
  32. package/src/chatgpt/ChatGptAgent.ts +75 -75
  33. package/src/chatgpt/ChatGptCallFunctionAgent.ts +464 -448
  34. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +287 -287
  35. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +52 -52
  36. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
  37. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +88 -88
  38. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +319 -319
  39. package/src/functional/createHttpLlmApplication.ts +63 -63
  40. package/src/index.ts +19 -19
  41. package/src/internal/AgenticaConstant.ts +4 -4
  42. package/src/internal/AgenticaDefaultPrompt.ts +43 -43
  43. package/src/internal/AgenticaOperationComposer.ts +87 -87
  44. package/src/internal/AgenticaPromptFactory.ts +32 -32
  45. package/src/internal/AgenticaPromptTransformer.ts +86 -86
  46. package/src/internal/AgenticaTokenUsageAggregator.ts +115 -115
  47. package/src/internal/MathUtil.ts +3 -3
  48. package/src/internal/Singleton.ts +22 -22
  49. package/src/internal/__map_take.ts +15 -15
  50. package/src/structures/IAgenticaConfig.ts +123 -123
  51. package/src/structures/IAgenticaContext.ts +129 -129
  52. package/src/structures/IAgenticaController.ts +133 -132
  53. package/src/structures/IAgenticaEvent.ts +229 -229
  54. package/src/structures/IAgenticaExecutor.ts +156 -156
  55. package/src/structures/IAgenticaOperation.ts +63 -64
  56. package/src/structures/IAgenticaOperationCollection.ts +52 -52
  57. package/src/structures/IAgenticaOperationSelection.ts +68 -69
  58. package/src/structures/IAgenticaPrompt.ts +182 -178
  59. package/src/structures/IAgenticaProps.ts +70 -70
  60. package/src/structures/IAgenticaSystemPrompt.ts +124 -124
  61. package/src/structures/IAgenticaTokenUsage.ts +107 -107
  62. package/src/structures/{IAgenticaProvider.ts → IAgenticaVendor.ts} +39 -39
  63. package/src/structures/internal/__IChatCancelFunctionsApplication.ts +23 -23
  64. package/src/structures/internal/__IChatFunctionReference.ts +21 -21
  65. package/src/structures/internal/__IChatInitialApplication.ts +15 -15
  66. package/src/structures/internal/__IChatSelectFunctionsApplication.ts +24 -24
  67. package/src/typings/AgenticaSource.ts +6 -6
  68. package/lib/structures/IAgenticaProvider.js.map +0 -1
@@ -1,132 +1,133 @@
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
+ 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
+ }