@agentica/core 0.34.2 → 0.35.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 (145) hide show
  1. package/lib/Agentica.d.ts +9 -10
  2. package/lib/Agentica.js.map +1 -1
  3. package/lib/MicroAgentica.d.ts +9 -10
  4. package/lib/MicroAgentica.js.map +1 -1
  5. package/lib/constants/AgenticaDefaultPrompt.d.ts +1 -2
  6. package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
  7. package/lib/context/AgenticaContext.d.ts +6 -7
  8. package/lib/context/AgenticaOperation.d.ts +5 -5
  9. package/lib/context/AgenticaOperationCollection.d.ts +5 -6
  10. package/lib/context/AgenticaOperationSelection.d.ts +2 -3
  11. package/lib/context/MicroAgenticaContext.d.ts +5 -6
  12. package/lib/context/internal/AgenticaOperationComposer.js.map +1 -1
  13. package/lib/context/internal/AgenticaOperationComposer.spec.js +41 -9
  14. package/lib/context/internal/AgenticaOperationComposer.spec.js.map +1 -1
  15. package/lib/context/internal/__IChatInitialApplication.d.ts +1 -1
  16. package/lib/context/internal/isAgenticaContext.js.map +1 -1
  17. package/lib/events/AgenticaCallEvent.d.ts +2 -3
  18. package/lib/events/AgenticaCancelEvent.d.ts +2 -3
  19. package/lib/events/AgenticaDescribeEvent.d.ts +3 -4
  20. package/lib/events/AgenticaEvent.d.ts +10 -11
  21. package/lib/events/AgenticaExecuteEvent.d.ts +5 -5
  22. package/lib/events/AgenticaJsonParseErrorEvent.d.ts +2 -3
  23. package/lib/events/AgenticaSelectEvent.d.ts +3 -4
  24. package/lib/events/AgenticaValidateEvent.d.ts +2 -3
  25. package/lib/events/MicroAgenticaEvent.d.ts +8 -9
  26. package/lib/factory/events.d.ts +22 -22
  27. package/lib/factory/events.js.map +1 -1
  28. package/lib/factory/histories.js.map +1 -1
  29. package/lib/factory/operations.d.ts +3 -4
  30. package/lib/factory/operations.js.map +1 -1
  31. package/lib/functional/assertHttpController.d.ts +6 -10
  32. package/lib/functional/assertHttpController.js +775 -91
  33. package/lib/functional/assertHttpController.js.map +1 -1
  34. package/lib/functional/assertHttpLlmApplication.d.ts +4 -8
  35. package/lib/functional/assertHttpLlmApplication.js +775 -91
  36. package/lib/functional/assertHttpLlmApplication.js.map +1 -1
  37. package/lib/functional/assertMcpController.d.ts +5 -6
  38. package/lib/functional/assertMcpController.js +201 -32
  39. package/lib/functional/assertMcpController.js.map +1 -1
  40. package/lib/functional/validateHttpController.d.ts +6 -10
  41. package/lib/functional/validateHttpController.js +636 -89
  42. package/lib/functional/validateHttpController.js.map +1 -1
  43. package/lib/functional/validateHttpLlmApplication.d.ts +4 -8
  44. package/lib/functional/validateHttpLlmApplication.js +636 -89
  45. package/lib/functional/validateHttpLlmApplication.js.map +1 -1
  46. package/lib/functional/validateMcpController.d.ts +5 -6
  47. package/lib/functional/validateMcpController.js +366 -61
  48. package/lib/functional/validateMcpController.js.map +1 -1
  49. package/lib/histories/AgenticaCancelHistory.d.ts +2 -3
  50. package/lib/histories/AgenticaDescribeHistory.d.ts +2 -3
  51. package/lib/histories/AgenticaExecuteHistory.d.ts +5 -5
  52. package/lib/histories/AgenticaHistory.d.ts +7 -8
  53. package/lib/histories/AgenticaSelectHistory.d.ts +2 -3
  54. package/lib/histories/MicroAgenticaHistory.d.ts +5 -6
  55. package/lib/index.mjs +3964 -849
  56. package/lib/index.mjs.map +1 -1
  57. package/lib/orchestrate/call.d.ts +1 -2
  58. package/lib/orchestrate/call.js.map +1 -1
  59. package/lib/orchestrate/cancel.d.ts +1 -2
  60. package/lib/orchestrate/cancel.js +4 -4
  61. package/lib/orchestrate/cancel.js.map +1 -1
  62. package/lib/orchestrate/describe.d.ts +1 -2
  63. package/lib/orchestrate/describe.js.map +1 -1
  64. package/lib/orchestrate/execute.d.ts +1 -2
  65. package/lib/orchestrate/execute.js.map +1 -1
  66. package/lib/orchestrate/initialize.d.ts +1 -2
  67. package/lib/orchestrate/initialize.js +262 -83
  68. package/lib/orchestrate/initialize.js.map +1 -1
  69. package/lib/orchestrate/internal/cancelFunctionFromContext.js.map +1 -1
  70. package/lib/orchestrate/internal/selectFunctionFromContext.js.map +1 -1
  71. package/lib/orchestrate/select.d.ts +1 -2
  72. package/lib/orchestrate/select.js +4 -4
  73. package/lib/orchestrate/select.js.map +1 -1
  74. package/lib/structures/IAgenticaConfig.d.ts +3 -4
  75. package/lib/structures/IAgenticaController.d.ts +11 -14
  76. package/lib/structures/IAgenticaExecutor.d.ts +6 -7
  77. package/lib/structures/IAgenticaProps.d.ts +3 -8
  78. package/lib/structures/IAgenticaSystemPrompt.d.ts +9 -10
  79. package/lib/structures/IMicroAgenticaConfig.d.ts +3 -4
  80. package/lib/structures/IMicroAgenticaExecutor.d.ts +3 -4
  81. package/lib/structures/IMicroAgenticaProps.d.ts +3 -8
  82. package/lib/structures/IMicroAgenticaSystemPrompt.d.ts +6 -7
  83. package/lib/transformers/transformHistory.js.map +1 -1
  84. package/lib/utils/ChatGptCompletionStreamingUtil.spec.js +2 -2
  85. package/lib/utils/ChatGptCompletionStreamingUtil.spec.js.map +1 -1
  86. package/lib/utils/request.d.ts +2 -3
  87. package/lib/utils/request.js.map +1 -1
  88. package/package.json +8 -8
  89. package/src/Agentica.ts +24 -26
  90. package/src/MicroAgentica.ts +27 -29
  91. package/src/constants/AgenticaDefaultPrompt.ts +2 -4
  92. package/src/context/AgenticaContext.ts +6 -7
  93. package/src/context/AgenticaOperation.ts +14 -14
  94. package/src/context/AgenticaOperationCollection.ts +5 -8
  95. package/src/context/AgenticaOperationSelection.ts +2 -4
  96. package/src/context/MicroAgenticaContext.ts +5 -6
  97. package/src/context/internal/AgenticaOperationComposer.spec.ts +50 -18
  98. package/src/context/internal/AgenticaOperationComposer.ts +21 -23
  99. package/src/context/internal/__IChatInitialApplication.ts +1 -1
  100. package/src/context/internal/isAgenticaContext.ts +4 -6
  101. package/src/events/AgenticaCallEvent.ts +2 -5
  102. package/src/events/AgenticaCancelEvent.ts +2 -6
  103. package/src/events/AgenticaDescribeEvent.ts +3 -7
  104. package/src/events/AgenticaEvent.ts +17 -19
  105. package/src/events/AgenticaEvent.type.ts +1 -1
  106. package/src/events/AgenticaExecuteEvent.ts +12 -12
  107. package/src/events/AgenticaJsonParseErrorEvent.ts +2 -4
  108. package/src/events/AgenticaSelectEvent.ts +3 -7
  109. package/src/events/AgenticaValidateEvent.ts +2 -5
  110. package/src/events/MicroAgenticaEvent.ts +13 -15
  111. package/src/factory/events.ts +24 -24
  112. package/src/factory/histories.ts +15 -17
  113. package/src/factory/operations.ts +3 -5
  114. package/src/functional/assertHttpController.ts +7 -15
  115. package/src/functional/assertHttpLlmApplication.ts +4 -13
  116. package/src/functional/assertMcpController.ts +6 -8
  117. package/src/functional/validateHttpController.ts +7 -15
  118. package/src/functional/validateHttpLlmApplication.ts +4 -13
  119. package/src/functional/validateMcpController.ts +6 -11
  120. package/src/histories/AgenticaCancelHistory.ts +2 -6
  121. package/src/histories/AgenticaDescribeHistory.ts +2 -6
  122. package/src/histories/AgenticaExecuteHistory.ts +7 -9
  123. package/src/histories/AgenticaHistory.ts +11 -13
  124. package/src/histories/AgenticaSelectHistory.ts +2 -6
  125. package/src/histories/MicroAgenticaHistory.ts +7 -9
  126. package/src/orchestrate/call.ts +55 -56
  127. package/src/orchestrate/cancel.ts +11 -12
  128. package/src/orchestrate/describe.ts +4 -5
  129. package/src/orchestrate/execute.ts +3 -5
  130. package/src/orchestrate/initialize.ts +4 -5
  131. package/src/orchestrate/internal/cancelFunctionFromContext.ts +4 -6
  132. package/src/orchestrate/internal/selectFunctionFromContext.ts +5 -9
  133. package/src/orchestrate/select.ts +11 -12
  134. package/src/structures/IAgenticaConfig.ts +4 -6
  135. package/src/structures/IAgenticaController.ts +11 -14
  136. package/src/structures/IAgenticaExecutor.ts +9 -11
  137. package/src/structures/IAgenticaProps.ts +3 -10
  138. package/src/structures/IAgenticaSystemPrompt.ts +9 -11
  139. package/src/structures/IMicroAgenticaConfig.ts +3 -5
  140. package/src/structures/IMicroAgenticaExecutor.ts +4 -6
  141. package/src/structures/IMicroAgenticaProps.ts +3 -10
  142. package/src/structures/IMicroAgenticaSystemPrompt.ts +6 -8
  143. package/src/transformers/transformHistory.ts +19 -21
  144. package/src/utils/ChatGptCompletionStreamingUtil.spec.ts +4 -5
  145. package/src/utils/request.ts +2 -3
@@ -5,7 +5,6 @@ import type {
5
5
  IHttpResponse,
6
6
  ILlmApplication,
7
7
  ILlmFunction,
8
- ILlmSchema,
9
8
  IMcpLlmApplication,
10
9
  } from "@samchon/openapi";
11
10
 
@@ -25,10 +24,10 @@ import type {
25
24
  *
26
25
  * @author Samchon
27
26
  */
28
- export type IAgenticaController<Model extends ILlmSchema.Model> =
29
- | IAgenticaController.IHttp<Model>
30
- | IAgenticaController.IClass<Model>
31
- | IAgenticaController.IMcp<Model>;
27
+ export type IAgenticaController =
28
+ | IAgenticaController.IHttp
29
+ | IAgenticaController.IClass
30
+ | IAgenticaController.IMcp;
32
31
 
33
32
  export namespace IAgenticaController {
34
33
  /**
@@ -37,8 +36,7 @@ export namespace IAgenticaController {
37
36
  * You can make it by {@link validateHttpLlmApplication} function with
38
37
  * the Swagger or OpenAPI document.
39
38
  */
40
- export interface IHttp<Model extends ILlmSchema.Model>
41
- extends IBase<"http", IHttpLlmApplication<Model>> {
39
+ export interface IHttp extends IBase<"http", IHttpLlmApplication> {
42
40
  /**
43
41
  * Connection to the server.
44
42
  *
@@ -61,12 +59,12 @@ export namespace IAgenticaController {
61
59
  /**
62
60
  * Application schema.
63
61
  */
64
- application: IHttpLlmApplication<Model>;
62
+ application: IHttpLlmApplication;
65
63
 
66
64
  /**
67
65
  * Function schema.
68
66
  */
69
- function: IHttpLlmFunction<Model>;
67
+ function: IHttpLlmFunction;
70
68
 
71
69
  /**
72
70
  * Arguments of the function calling.
@@ -89,8 +87,7 @@ export namespace IAgenticaController {
89
87
  *
90
88
  * - https://typia.io/docs/llm/application
91
89
  */
92
- export interface IClass<Model extends ILlmSchema.Model>
93
- extends IBase<"class", ILlmApplication<Model>> {
90
+ export interface IClass extends IBase<"class", ILlmApplication> {
94
91
  /**
95
92
  * Executor of the class function.
96
93
  *
@@ -104,12 +101,12 @@ export namespace IAgenticaController {
104
101
  /**
105
102
  * Target application schema.
106
103
  */
107
- application: ILlmApplication<Model>;
104
+ application: ILlmApplication;
108
105
 
109
106
  /**
110
107
  * Target function schema.
111
108
  */
112
- function: ILlmFunction<Model>;
109
+ function: ILlmFunction;
113
110
 
114
111
  /**
115
112
  * Arguments of the function calling.
@@ -121,7 +118,7 @@ export namespace IAgenticaController {
121
118
  /**
122
119
  * MCP Server controller.
123
120
  */
124
- export interface IMcp<Model extends ILlmSchema.Model> extends IBase<"mcp", IMcpLlmApplication<Model>> {
121
+ export interface IMcp extends IBase<"mcp", IMcpLlmApplication> {
125
122
  /**
126
123
  * MCP client for connection.
127
124
  *
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaContext } from "../context/AgenticaContext";
4
2
  import type { AgenticaOperation } from "../context/AgenticaOperation";
5
3
  import type { AgenticaExecuteEvent } from "../events/AgenticaExecuteEvent";
@@ -27,7 +25,7 @@ import type { AgenticaExecuteEvent } from "../events/AgenticaExecuteEvent";
27
25
  * @reference https://github.com/wrtnlabs/agentica/blob/main/packages/core/src/orchestrate/execute.ts
28
26
  * @author Samchon
29
27
  */
30
- export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
28
+ export interface IAgenticaExecutor {
31
29
  /**
32
30
  * Initializer agent listing up functions.
33
31
  *
@@ -60,7 +58,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
60
58
  initialize:
61
59
  | boolean
62
60
  | null
63
- | ((ctx: AgenticaContext<Model>) => Promise<void>);
61
+ | ((ctx: AgenticaContext) => Promise<void>);
64
62
 
65
63
  /**
66
64
  * Function selector agent.
@@ -89,7 +87,7 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
89
87
  * @param ctx Context of the agent
90
88
  * @returns List of prompts generated by the selector
91
89
  */
92
- select: (ctx: AgenticaContext<Model>) => Promise<void>;
90
+ select: (ctx: AgenticaContext) => Promise<void>;
93
91
 
94
92
  /**
95
93
  * Function caller agent.
@@ -118,9 +116,9 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
118
116
  * applied to all domain fields.
119
117
  */
120
118
  call: (
121
- ctx: AgenticaContext<Model>,
122
- operations: AgenticaOperation<Model>[],
123
- ) => Promise<AgenticaExecuteEvent<Model>[]>;
119
+ ctx: AgenticaContext,
120
+ operations: AgenticaOperation[],
121
+ ) => Promise<AgenticaExecuteEvent[]>;
124
122
 
125
123
  /**
126
124
  * Describer agent of the function calling result.
@@ -139,8 +137,8 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
139
137
  | boolean
140
138
  | null
141
139
  | ((
142
- ctx: AgenticaContext<Model>,
143
- executes: AgenticaExecuteEvent<Model>[],
140
+ ctx: AgenticaContext,
141
+ executes: AgenticaExecuteEvent[],
144
142
  ) => Promise<void>);
145
143
 
146
144
  /**
@@ -165,5 +163,5 @@ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
165
163
  * @param ctx Context of the agent
166
164
  * @returns List of prompts generated by the canceler
167
165
  */
168
- cancel: (ctx: AgenticaContext<Model>) => Promise<void>;
166
+ cancel: (ctx: AgenticaContext) => Promise<void>;
169
167
  }
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaTokenUsage } from "../context/AgenticaTokenUsage";
4
2
  import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
5
3
  import type { IAgenticaTokenUsageJson } from "../json/IAgenticaTokenUsageJson";
@@ -29,12 +27,7 @@ import type { IAgenticaVendor } from "./IAgenticaVendor";
29
27
  *
30
28
  * @author Samchon
31
29
  */
32
- export interface IAgenticaProps<Model extends ILlmSchema.Model> {
33
- /**
34
- * LLM schema model.
35
- */
36
- model: Model;
37
-
30
+ export interface IAgenticaProps {
38
31
  /**
39
32
  * LLM service vendor.
40
33
  */
@@ -43,7 +36,7 @@ export interface IAgenticaProps<Model extends ILlmSchema.Model> {
43
36
  /**
44
37
  * Controllers serving functions to call.
45
38
  */
46
- controllers: IAgenticaController<Model>[];
39
+ controllers: IAgenticaController[];
47
40
 
48
41
  /**
49
42
  * Configuration of agent.
@@ -60,7 +53,7 @@ export interface IAgenticaProps<Model extends ILlmSchema.Model> {
60
53
  * - `systemPrompt`: default prompts written in markdown
61
54
  * - https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts
62
55
  */
63
- config?: IAgenticaConfig<Model>;
56
+ config?: IAgenticaConfig;
64
57
 
65
58
  /**
66
59
  * Prompt histories.
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaJsonParseErrorEvent } from "../events";
4
2
  import type { AgenticaValidateEvent } from "../events/AgenticaValidateEvent";
5
3
  import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
@@ -25,7 +23,7 @@ import type { IAgenticaConfig } from "./IAgenticaConfig";
25
23
  *
26
24
  * @author Samchon
27
25
  */
28
- export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
26
+ export interface IAgenticaSystemPrompt {
29
27
  /**
30
28
  * Common system prompt that would be used in every situation.
31
29
  *
@@ -38,7 +36,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
38
36
  * @returns The common system prompt
39
37
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/common.md
40
38
  */
41
- common?: (config?: IAgenticaConfig<Model> | undefined) => string;
39
+ common?: (config?: IAgenticaConfig | undefined) => string;
42
40
 
43
41
  /**
44
42
  * Initialize system prompt.
@@ -63,7 +61,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
63
61
  * @returns initialize system prompt
64
62
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/initialize.md
65
63
  */
66
- initialize?: (histories: AgenticaHistory<Model>[]) => string;
64
+ initialize?: (histories: AgenticaHistory[]) => string;
67
65
 
68
66
  /**
69
67
  * Select system prompt.
@@ -91,7 +89,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
91
89
  * @returns select system prompt
92
90
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/select.md
93
91
  */
94
- select?: (histories: AgenticaHistory<Model>[]) => string;
92
+ select?: (histories: AgenticaHistory[]) => string;
95
93
 
96
94
  /**
97
95
  * Cancel system prompt.
@@ -113,7 +111,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
113
111
  * @returns cancel system prompt
114
112
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/cancel.md
115
113
  */
116
- cancel?: (histories: AgenticaHistory<Model>[]) => string;
114
+ cancel?: (histories: AgenticaHistory[]) => string;
117
115
 
118
116
  /**
119
117
  * Execute system prompt.
@@ -140,7 +138,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
140
138
  * @returns execute system prompt
141
139
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/execute.md
142
140
  */
143
- execute?: (histories: AgenticaHistory<Model>[]) => string;
141
+ execute?: (histories: AgenticaHistory[]) => string;
144
142
 
145
143
  /**
146
144
  * Validation feedback system prompt.
@@ -173,7 +171,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
173
171
  * @returns validation feedback system prompt
174
172
  * @default Built-in validation feedback prompt optimized for typia IValidation.IFailure processing
175
173
  */
176
- validate?: (events: AgenticaValidateEvent<Model>[]) => string;
174
+ validate?: (events: AgenticaValidateEvent[]) => string;
177
175
 
178
176
  /**
179
177
  * JSON parsing error system prompt.
@@ -204,7 +202,7 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
204
202
  * @returns JSON parse error system prompt
205
203
  * @default Built-in JSON parse error prompt optimized for syntax correction
206
204
  */
207
- jsonParseError?: (event: AgenticaJsonParseErrorEvent<Model>) => string;
205
+ jsonParseError?: (event: AgenticaJsonParseErrorEvent) => string;
208
206
 
209
207
  /**
210
208
  * Describe system prompt.
@@ -234,5 +232,5 @@ export interface IAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
234
232
  * @returns describe system prompt
235
233
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/describe.md
236
234
  */
237
- describe?: (histories: AgenticaExecuteHistory<Model>[]) => string;
235
+ describe?: (histories: AgenticaExecuteHistory[]) => string;
238
236
  }
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { IMicroAgenticaExecutor } from "./IMicroAgenticaExecutor";
4
2
  import type { IMicroAgenticaSystemPrompt } from "./IMicroAgenticaSystemPrompt";
5
3
 
@@ -13,7 +11,7 @@ import type { IMicroAgenticaSystemPrompt } from "./IMicroAgenticaSystemPrompt";
13
11
  *
14
12
  * @author Samchon
15
13
  */
16
- export interface IMicroAgenticaConfig<Model extends ILlmSchema.Model> {
14
+ export interface IMicroAgenticaConfig {
17
15
  /**
18
16
  * Agent executor.
19
17
  *
@@ -31,7 +29,7 @@ export interface IMicroAgenticaConfig<Model extends ILlmSchema.Model> {
31
29
  */
32
30
  executor?:
33
31
  | undefined
34
- | Partial<IMicroAgenticaExecutor<Model>>;
32
+ | Partial<IMicroAgenticaExecutor>;
35
33
 
36
34
  /**
37
35
  * System prompt messages.
@@ -39,7 +37,7 @@ export interface IMicroAgenticaConfig<Model extends ILlmSchema.Model> {
39
37
  * System prompt messages if you want to customize the system prompt
40
38
  * messages for each situation.
41
39
  */
42
- systemPrompt?: IMicroAgenticaSystemPrompt<Model>;
40
+ systemPrompt?: IMicroAgenticaSystemPrompt;
43
41
 
44
42
  /**
45
43
  * Locale of the A.I. chatbot.
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { MicroAgenticaContext } from "../context/MicroAgenticaContext";
4
2
  import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
5
3
 
@@ -17,7 +15,7 @@ import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory
17
15
  *
18
16
  * @author Samchon
19
17
  */
20
- export interface IMicroAgenticaExecutor<Model extends ILlmSchema.Model> {
18
+ export interface IMicroAgenticaExecutor {
21
19
  /**
22
20
  * Function caller agent.
23
21
  *
@@ -43,7 +41,7 @@ export interface IMicroAgenticaExecutor<Model extends ILlmSchema.Model> {
43
41
  * agent is the most general topic which can be universally
44
42
  * applied to all domain fields.
45
43
  */
46
- call: (ctx: MicroAgenticaContext<Model>) => Promise<AgenticaExecuteHistory<Model>[]>;
44
+ call: (ctx: MicroAgenticaContext) => Promise<AgenticaExecuteHistory[]>;
47
45
 
48
46
  /**
49
47
  * Describer agent of the function calling result.
@@ -62,7 +60,7 @@ export interface IMicroAgenticaExecutor<Model extends ILlmSchema.Model> {
62
60
  | boolean
63
61
  | null
64
62
  | ((
65
- ctx: MicroAgenticaContext<Model>,
66
- executes: AgenticaExecuteHistory<Model>[],
63
+ ctx: MicroAgenticaContext,
64
+ executes: AgenticaExecuteHistory[],
67
65
  ) => Promise<void>);
68
66
  }
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaTokenUsage } from "../context/AgenticaTokenUsage";
4
2
  import type { IAgenticaTokenUsageJson } from "../json/IAgenticaTokenUsageJson";
5
3
  import type { IMicroAgenticaHistoryJson } from "../json/IMicroAgenticaHistoryJson";
@@ -29,12 +27,7 @@ import type { IMicroAgenticaConfig } from "./IMicroAgenticaConfig";
29
27
  *
30
28
  * @author Samchon
31
29
  */
32
- export interface IMicroAgenticaProps<Model extends ILlmSchema.Model> {
33
- /**
34
- * LLM schema model.
35
- */
36
- model: Model;
37
-
30
+ export interface IMicroAgenticaProps {
38
31
  /**
39
32
  * LLM service vendor.
40
33
  */
@@ -43,7 +36,7 @@ export interface IMicroAgenticaProps<Model extends ILlmSchema.Model> {
43
36
  /**
44
37
  * Controllers serving functions to call.
45
38
  */
46
- controllers: IAgenticaController<Model>[];
39
+ controllers: IAgenticaController[];
47
40
 
48
41
  /**
49
42
  * Configuration of agent.
@@ -60,7 +53,7 @@ export interface IMicroAgenticaProps<Model extends ILlmSchema.Model> {
60
53
  * - `systemPrompt`: default prompts written in markdown
61
54
  * - https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts
62
55
  */
63
- config?: IMicroAgenticaConfig<Model>;
56
+ config?: IMicroAgenticaConfig;
64
57
 
65
58
  /**
66
59
  * Prompt histories.
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaJsonParseErrorEvent } from "../events/AgenticaJsonParseErrorEvent";
4
2
  import type { AgenticaValidateEvent } from "../events/AgenticaValidateEvent";
5
3
  import type { AgenticaExecuteHistory } from "../histories/AgenticaExecuteHistory";
@@ -26,7 +24,7 @@ import type { IMicroAgenticaConfig } from "./IMicroAgenticaConfig";
26
24
  *
27
25
  * @author Samchon
28
26
  */
29
- export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
27
+ export interface IMicroAgenticaSystemPrompt {
30
28
  /**
31
29
  * Common system prompt that would be used in every situation.
32
30
  *
@@ -41,7 +39,7 @@ export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
41
39
  * @returns The common system prompt
42
40
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/common.md
43
41
  */
44
- common?: (config?: IMicroAgenticaConfig<Model> | undefined) => string;
42
+ common?: (config?: IMicroAgenticaConfig | undefined) => string;
45
43
 
46
44
  /**
47
45
  * Execute system prompt.
@@ -72,7 +70,7 @@ export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
72
70
  * @returns execute system prompt
73
71
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/execute.md
74
72
  */
75
- execute?: null | ((histories: MicroAgenticaHistory<Model>[]) => string);
73
+ execute?: null | ((histories: MicroAgenticaHistory[]) => string);
76
74
 
77
75
  /**
78
76
  * Validation feedback system prompt.
@@ -106,7 +104,7 @@ export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
106
104
  * @returns validation feedback system prompt
107
105
  * @default Built-in validation feedback prompt optimized for typia IValidation.IFailure processing
108
106
  */
109
- validate?: (events: AgenticaValidateEvent<Model>[]) => string;
107
+ validate?: (events: AgenticaValidateEvent[]) => string;
110
108
 
111
109
  /**
112
110
  * JSON parsing error system prompt.
@@ -137,7 +135,7 @@ export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
137
135
  * @returns JSON parse error system prompt
138
136
  * @default Built-in JSON parse error prompt optimized for syntax correction
139
137
  */
140
- jsonParseError?: (event: AgenticaJsonParseErrorEvent<Model>) => string;
138
+ jsonParseError?: (event: AgenticaJsonParseErrorEvent) => string;
141
139
 
142
140
  /**
143
141
  * Describe system prompt.
@@ -167,5 +165,5 @@ export interface IMicroAgenticaSystemPrompt<Model extends ILlmSchema.Model> {
167
165
  * @returns describe system prompt
168
166
  * @default https://github.com/wrtnlabs/agentica/tree/main/packages/core/prompts/describe.md
169
167
  */
170
- describe?: (histories: AgenticaExecuteHistory<Model>[]) => string;
168
+ describe?: (histories: AgenticaExecuteHistory[]) => string;
171
169
  }
@@ -1,5 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
-
3
1
  import type { AgenticaOperation } from "../context/AgenticaOperation";
4
2
  import type { AgenticaUserMessageHistory } from "../histories";
5
3
  import type { AgenticaAssistantMessageHistory } from "../histories/AgenticaAssistantMessageHistory";
@@ -17,10 +15,10 @@ import { createOperationSelection } from "../factory/operations";
17
15
  /**
18
16
  * @internal
19
17
  */
20
- export function transformHistory<Model extends ILlmSchema.Model>(props: {
21
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
18
+ export function transformHistory(props: {
19
+ operations: Map<string, Map<string, AgenticaOperation>>;
22
20
  history: IAgenticaHistoryJson;
23
- }): AgenticaHistory<Model> {
21
+ }): AgenticaHistory {
24
22
  // USER
25
23
  if (props.history.type === "userMessage") {
26
24
  return transformUserMessage({
@@ -83,10 +81,10 @@ function transformUserMessage(props: {
83
81
  return createUserMessageHistory(props.history);
84
82
  }
85
83
 
86
- function transformSelect<Model extends ILlmSchema.Model>(props: {
87
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
84
+ function transformSelect(props: {
85
+ operations: Map<string, Map<string, AgenticaOperation>>;
88
86
  history: IAgenticaHistoryJson.ISelect;
89
- }): AgenticaSelectHistory<Model> {
87
+ }): AgenticaSelectHistory {
90
88
  return createSelectHistory({
91
89
  id: props.history.id,
92
90
  created_at: props.history.created_at,
@@ -100,10 +98,10 @@ function transformSelect<Model extends ILlmSchema.Model>(props: {
100
98
  });
101
99
  }
102
100
 
103
- function transformCancel<Model extends ILlmSchema.Model>(props: {
104
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
101
+ function transformCancel(props: {
102
+ operations: Map<string, Map<string, AgenticaOperation>>;
105
103
  history: IAgenticaHistoryJson.ICancel;
106
- }): AgenticaCancelHistory<Model> {
104
+ }): AgenticaCancelHistory {
107
105
  return createCancelHistory({
108
106
  id: props.history.id,
109
107
  created_at: props.history.created_at,
@@ -117,10 +115,10 @@ function transformCancel<Model extends ILlmSchema.Model>(props: {
117
115
  });
118
116
  }
119
117
 
120
- function transformExecute<Model extends ILlmSchema.Model>(props: {
121
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
118
+ function transformExecute(props: {
119
+ operations: Map<string, Map<string, AgenticaOperation>>;
122
120
  history: IAgenticaHistoryJson.IExecute;
123
- }): AgenticaExecuteHistory<Model> {
121
+ }): AgenticaExecuteHistory {
124
122
  return createExecuteHistory({
125
123
  id: props.history.id,
126
124
  created_at: props.history.created_at,
@@ -138,10 +136,10 @@ function transformExecute<Model extends ILlmSchema.Model>(props: {
138
136
  });
139
137
  }
140
138
 
141
- function transformDescribe<Model extends ILlmSchema.Model>(props: {
142
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
139
+ function transformDescribe(props: {
140
+ operations: Map<string, Map<string, AgenticaOperation>>;
143
141
  history: IAgenticaHistoryJson.IDescribe;
144
- }): AgenticaDescribeHistory<Model> {
142
+ }): AgenticaDescribeHistory {
145
143
  return createDescribeHistory({
146
144
  id: props.history.id,
147
145
  created_at: props.history.created_at,
@@ -155,14 +153,14 @@ function transformDescribe<Model extends ILlmSchema.Model>(props: {
155
153
  });
156
154
  }
157
155
 
158
- function findOperation<Model extends ILlmSchema.Model>(props: {
159
- operations: Map<string, Map<string, AgenticaOperation<Model>>>;
156
+ function findOperation(props: {
157
+ operations: Map<string, Map<string, AgenticaOperation>>;
160
158
  input: {
161
159
  controller: string;
162
160
  function: string;
163
161
  };
164
- }): AgenticaOperation<Model> {
165
- const found: AgenticaOperation<Model> | undefined = props.operations
162
+ }): AgenticaOperation {
163
+ const found: AgenticaOperation | undefined = props.operations
166
164
  .get(props.input.controller)
167
165
  ?.get(props.input.function);
168
166
  if (found === undefined) {
@@ -301,14 +301,13 @@ describe("reduceStreamingWithDispatch", () => {
301
301
  const streamedContent: string[] = [];
302
302
  await new Promise(async (resolve) => {
303
303
  const eventProcessor = vi.fn(({ stream: contentStream }) => {
304
- (async () => {
304
+ void (async () => {
305
305
  for await (const content of contentStream) {
306
- streamedContent.push(content);
306
+ streamedContent.push(content as string);
307
307
  }
308
308
  resolve(true);
309
- })();
309
+ })().catch(() => {});
310
310
  });
311
-
312
311
  await reduceStreamingWithDispatch(stream, eventProcessor);
313
312
  });
314
313
  expect(streamedContent).toEqual(["Hello", " World"]);
@@ -895,7 +894,7 @@ describe("reduceStreamingWithDispatch", () => {
895
894
 
896
895
  const stream = new ReadableStream<ChatCompletionChunk>({
897
896
  start(controller) {
898
- controller.enqueue(malformedChunk);
897
+ controller.enqueue(malformedChunk as ChatCompletionChunk);
899
898
  controller.close();
900
899
  },
901
900
  });
@@ -1,4 +1,3 @@
1
- import type { ILlmSchema } from "@samchon/openapi";
2
1
  import type OpenAI from "openai";
3
2
 
4
3
  import { v4 } from "uuid";
@@ -13,9 +12,9 @@ import { createRequestEvent } from "../factory";
13
12
  import { ChatGptCompletionMessageUtil } from "./ChatGptCompletionMessageUtil";
14
13
  import { streamDefaultReaderToAsyncGenerator, StreamUtil } from "./StreamUtil";
15
14
 
16
- export function getChatCompletionWithStreamingFunction<Model extends ILlmSchema.Model>(props: {
15
+ export function getChatCompletionWithStreamingFunction(props: {
17
16
  vendor: IAgenticaVendor;
18
- config?: IAgenticaConfig<Model> | IMicroAgenticaConfig<Model>;
17
+ config?: IAgenticaConfig | IMicroAgenticaConfig;
19
18
  dispatch: (event: AgenticaRequestEvent | AgenticaResponseEvent) => Promise<void>;
20
19
  abortSignal?: AbortSignal;
21
20
  usage: AgenticaTokenUsage;