@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.
- package/lib/Agentica.d.ts +9 -10
- package/lib/Agentica.js.map +1 -1
- package/lib/MicroAgentica.d.ts +9 -10
- package/lib/MicroAgentica.js.map +1 -1
- package/lib/constants/AgenticaDefaultPrompt.d.ts +1 -2
- package/lib/constants/AgenticaDefaultPrompt.js.map +1 -1
- package/lib/context/AgenticaContext.d.ts +6 -7
- package/lib/context/AgenticaOperation.d.ts +5 -5
- package/lib/context/AgenticaOperationCollection.d.ts +5 -6
- package/lib/context/AgenticaOperationSelection.d.ts +2 -3
- package/lib/context/MicroAgenticaContext.d.ts +5 -6
- package/lib/context/internal/AgenticaOperationComposer.js.map +1 -1
- package/lib/context/internal/AgenticaOperationComposer.spec.js +41 -9
- package/lib/context/internal/AgenticaOperationComposer.spec.js.map +1 -1
- package/lib/context/internal/__IChatInitialApplication.d.ts +1 -1
- package/lib/context/internal/isAgenticaContext.js.map +1 -1
- package/lib/events/AgenticaCallEvent.d.ts +2 -3
- package/lib/events/AgenticaCancelEvent.d.ts +2 -3
- package/lib/events/AgenticaDescribeEvent.d.ts +3 -4
- package/lib/events/AgenticaEvent.d.ts +10 -11
- package/lib/events/AgenticaExecuteEvent.d.ts +5 -5
- package/lib/events/AgenticaJsonParseErrorEvent.d.ts +2 -3
- package/lib/events/AgenticaSelectEvent.d.ts +3 -4
- package/lib/events/AgenticaValidateEvent.d.ts +2 -3
- package/lib/events/MicroAgenticaEvent.d.ts +8 -9
- package/lib/factory/events.d.ts +22 -22
- package/lib/factory/events.js.map +1 -1
- package/lib/factory/histories.js.map +1 -1
- package/lib/factory/operations.d.ts +3 -4
- package/lib/factory/operations.js.map +1 -1
- package/lib/functional/assertHttpController.d.ts +6 -10
- package/lib/functional/assertHttpController.js +775 -91
- package/lib/functional/assertHttpController.js.map +1 -1
- package/lib/functional/assertHttpLlmApplication.d.ts +4 -8
- package/lib/functional/assertHttpLlmApplication.js +775 -91
- package/lib/functional/assertHttpLlmApplication.js.map +1 -1
- package/lib/functional/assertMcpController.d.ts +5 -6
- package/lib/functional/assertMcpController.js +201 -32
- package/lib/functional/assertMcpController.js.map +1 -1
- package/lib/functional/validateHttpController.d.ts +6 -10
- package/lib/functional/validateHttpController.js +636 -89
- package/lib/functional/validateHttpController.js.map +1 -1
- package/lib/functional/validateHttpLlmApplication.d.ts +4 -8
- package/lib/functional/validateHttpLlmApplication.js +636 -89
- package/lib/functional/validateHttpLlmApplication.js.map +1 -1
- package/lib/functional/validateMcpController.d.ts +5 -6
- package/lib/functional/validateMcpController.js +366 -61
- package/lib/functional/validateMcpController.js.map +1 -1
- package/lib/histories/AgenticaCancelHistory.d.ts +2 -3
- package/lib/histories/AgenticaDescribeHistory.d.ts +2 -3
- package/lib/histories/AgenticaExecuteHistory.d.ts +5 -5
- package/lib/histories/AgenticaHistory.d.ts +7 -8
- package/lib/histories/AgenticaSelectHistory.d.ts +2 -3
- package/lib/histories/MicroAgenticaHistory.d.ts +5 -6
- package/lib/index.mjs +3964 -849
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/call.d.ts +1 -2
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.d.ts +1 -2
- package/lib/orchestrate/cancel.js +4 -4
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/describe.d.ts +1 -2
- package/lib/orchestrate/describe.js.map +1 -1
- package/lib/orchestrate/execute.d.ts +1 -2
- package/lib/orchestrate/execute.js.map +1 -1
- package/lib/orchestrate/initialize.d.ts +1 -2
- package/lib/orchestrate/initialize.js +262 -83
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/internal/cancelFunctionFromContext.js.map +1 -1
- package/lib/orchestrate/internal/selectFunctionFromContext.js.map +1 -1
- package/lib/orchestrate/select.d.ts +1 -2
- package/lib/orchestrate/select.js +4 -4
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/structures/IAgenticaConfig.d.ts +3 -4
- package/lib/structures/IAgenticaController.d.ts +11 -14
- package/lib/structures/IAgenticaExecutor.d.ts +6 -7
- package/lib/structures/IAgenticaProps.d.ts +3 -8
- package/lib/structures/IAgenticaSystemPrompt.d.ts +9 -10
- package/lib/structures/IMicroAgenticaConfig.d.ts +3 -4
- package/lib/structures/IMicroAgenticaExecutor.d.ts +3 -4
- package/lib/structures/IMicroAgenticaProps.d.ts +3 -8
- package/lib/structures/IMicroAgenticaSystemPrompt.d.ts +6 -7
- package/lib/transformers/transformHistory.js.map +1 -1
- package/lib/utils/ChatGptCompletionStreamingUtil.spec.js +2 -2
- package/lib/utils/ChatGptCompletionStreamingUtil.spec.js.map +1 -1
- package/lib/utils/request.d.ts +2 -3
- package/lib/utils/request.js.map +1 -1
- package/package.json +8 -8
- package/src/Agentica.ts +24 -26
- package/src/MicroAgentica.ts +27 -29
- package/src/constants/AgenticaDefaultPrompt.ts +2 -4
- package/src/context/AgenticaContext.ts +6 -7
- package/src/context/AgenticaOperation.ts +14 -14
- package/src/context/AgenticaOperationCollection.ts +5 -8
- package/src/context/AgenticaOperationSelection.ts +2 -4
- package/src/context/MicroAgenticaContext.ts +5 -6
- package/src/context/internal/AgenticaOperationComposer.spec.ts +50 -18
- package/src/context/internal/AgenticaOperationComposer.ts +21 -23
- package/src/context/internal/__IChatInitialApplication.ts +1 -1
- package/src/context/internal/isAgenticaContext.ts +4 -6
- package/src/events/AgenticaCallEvent.ts +2 -5
- package/src/events/AgenticaCancelEvent.ts +2 -6
- package/src/events/AgenticaDescribeEvent.ts +3 -7
- package/src/events/AgenticaEvent.ts +17 -19
- package/src/events/AgenticaEvent.type.ts +1 -1
- package/src/events/AgenticaExecuteEvent.ts +12 -12
- package/src/events/AgenticaJsonParseErrorEvent.ts +2 -4
- package/src/events/AgenticaSelectEvent.ts +3 -7
- package/src/events/AgenticaValidateEvent.ts +2 -5
- package/src/events/MicroAgenticaEvent.ts +13 -15
- package/src/factory/events.ts +24 -24
- package/src/factory/histories.ts +15 -17
- package/src/factory/operations.ts +3 -5
- package/src/functional/assertHttpController.ts +7 -15
- package/src/functional/assertHttpLlmApplication.ts +4 -13
- package/src/functional/assertMcpController.ts +6 -8
- package/src/functional/validateHttpController.ts +7 -15
- package/src/functional/validateHttpLlmApplication.ts +4 -13
- package/src/functional/validateMcpController.ts +6 -11
- package/src/histories/AgenticaCancelHistory.ts +2 -6
- package/src/histories/AgenticaDescribeHistory.ts +2 -6
- package/src/histories/AgenticaExecuteHistory.ts +7 -9
- package/src/histories/AgenticaHistory.ts +11 -13
- package/src/histories/AgenticaSelectHistory.ts +2 -6
- package/src/histories/MicroAgenticaHistory.ts +7 -9
- package/src/orchestrate/call.ts +55 -56
- package/src/orchestrate/cancel.ts +11 -12
- package/src/orchestrate/describe.ts +4 -5
- package/src/orchestrate/execute.ts +3 -5
- package/src/orchestrate/initialize.ts +4 -5
- package/src/orchestrate/internal/cancelFunctionFromContext.ts +4 -6
- package/src/orchestrate/internal/selectFunctionFromContext.ts +5 -9
- package/src/orchestrate/select.ts +11 -12
- package/src/structures/IAgenticaConfig.ts +4 -6
- package/src/structures/IAgenticaController.ts +11 -14
- package/src/structures/IAgenticaExecutor.ts +9 -11
- package/src/structures/IAgenticaProps.ts +3 -10
- package/src/structures/IAgenticaSystemPrompt.ts +9 -11
- package/src/structures/IMicroAgenticaConfig.ts +3 -5
- package/src/structures/IMicroAgenticaExecutor.ts +4 -6
- package/src/structures/IMicroAgenticaProps.ts +3 -10
- package/src/structures/IMicroAgenticaSystemPrompt.ts +6 -8
- package/src/transformers/transformHistory.ts +19 -21
- package/src/utils/ChatGptCompletionStreamingUtil.spec.ts +4 -5
- package/src/utils/request.ts +2 -3
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
1
|
import type { AgenticaAssistantMessageEvent } from "./AgenticaAssistantMessageEvent";
|
|
4
2
|
import type { AgenticaCallEvent } from "./AgenticaCallEvent";
|
|
5
3
|
import type { AgenticaDescribeEvent } from "./AgenticaDescribeEvent";
|
|
@@ -20,28 +18,28 @@ import type { AgenticaValidateEvent } from "./AgenticaValidateEvent";
|
|
|
20
18
|
*
|
|
21
19
|
* @author Samchon
|
|
22
20
|
*/
|
|
23
|
-
export type MicroAgenticaEvent
|
|
21
|
+
export type MicroAgenticaEvent =
|
|
24
22
|
| AgenticaUserMessageEvent
|
|
25
23
|
| AgenticaAssistantMessageEvent
|
|
26
|
-
| AgenticaCallEvent
|
|
27
|
-
| AgenticaExecuteEvent
|
|
28
|
-
| AgenticaDescribeEvent
|
|
24
|
+
| AgenticaCallEvent
|
|
25
|
+
| AgenticaExecuteEvent
|
|
26
|
+
| AgenticaDescribeEvent
|
|
29
27
|
| AgenticaRequestEvent
|
|
30
28
|
| AgenticaResponseEvent
|
|
31
|
-
| AgenticaValidateEvent
|
|
32
|
-
| AgenticaJsonParseErrorEvent
|
|
29
|
+
| AgenticaValidateEvent
|
|
30
|
+
| AgenticaJsonParseErrorEvent;
|
|
33
31
|
export namespace MicroAgenticaEvent {
|
|
34
|
-
export type Type = MicroAgenticaEvent
|
|
35
|
-
export interface Mapper
|
|
32
|
+
export type Type = MicroAgenticaEvent["type"];
|
|
33
|
+
export interface Mapper {
|
|
36
34
|
userMessage: AgenticaUserMessageEvent;
|
|
37
35
|
assistantMessage: AgenticaAssistantMessageEvent;
|
|
38
|
-
call: AgenticaCallEvent
|
|
39
|
-
execute: AgenticaExecuteEvent
|
|
40
|
-
describe: AgenticaDescribeEvent
|
|
36
|
+
call: AgenticaCallEvent;
|
|
37
|
+
execute: AgenticaExecuteEvent;
|
|
38
|
+
describe: AgenticaDescribeEvent;
|
|
41
39
|
request: AgenticaRequestEvent;
|
|
42
40
|
response: AgenticaResponseEvent;
|
|
43
|
-
validate: AgenticaValidateEvent
|
|
44
|
-
jsonParseError: AgenticaJsonParseErrorEvent
|
|
41
|
+
validate: AgenticaValidateEvent;
|
|
42
|
+
jsonParseError: AgenticaJsonParseErrorEvent;
|
|
45
43
|
}
|
|
46
44
|
export type Source = "call" | "describe";
|
|
47
45
|
}
|
package/src/factory/events.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IValidation } from "@samchon/openapi";
|
|
2
2
|
import type OpenAI from "openai";
|
|
3
3
|
|
|
4
4
|
import { v4 } from "uuid";
|
|
@@ -45,9 +45,9 @@ export function createInitializeEvent(): AgenticaInitializeEvent {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export function createSelectEvent
|
|
49
|
-
selection: AgenticaOperationSelection
|
|
50
|
-
}): AgenticaSelectEvent
|
|
48
|
+
export function createSelectEvent(props: {
|
|
49
|
+
selection: AgenticaOperationSelection;
|
|
50
|
+
}): AgenticaSelectEvent {
|
|
51
51
|
const id: string = v4();
|
|
52
52
|
const created_at: string = new Date().toISOString();
|
|
53
53
|
return {
|
|
@@ -69,9 +69,9 @@ export function createSelectEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function createCancelEvent
|
|
73
|
-
selection: AgenticaOperationSelection
|
|
74
|
-
}): AgenticaCancelEvent
|
|
72
|
+
export function createCancelEvent(props: {
|
|
73
|
+
selection: AgenticaOperationSelection;
|
|
74
|
+
}): AgenticaCancelEvent {
|
|
75
75
|
const id: string = v4();
|
|
76
76
|
const created_at: string = new Date().toISOString();
|
|
77
77
|
return {
|
|
@@ -91,11 +91,11 @@ export function createCancelEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
91
91
|
/* -----------------------------------------------------------
|
|
92
92
|
FUNCTION CALLS
|
|
93
93
|
----------------------------------------------------------- */
|
|
94
|
-
export function createCallEvent
|
|
94
|
+
export function createCallEvent(props: {
|
|
95
95
|
id: string;
|
|
96
|
-
operation: AgenticaOperation
|
|
96
|
+
operation: AgenticaOperation;
|
|
97
97
|
arguments: Record<string, any>;
|
|
98
|
-
}): AgenticaCallEvent
|
|
98
|
+
}): AgenticaCallEvent {
|
|
99
99
|
const created_at: string = new Date().toISOString();
|
|
100
100
|
return {
|
|
101
101
|
type: "call",
|
|
@@ -113,13 +113,13 @@ export function createCallEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export function createJsonParseErrorEvent
|
|
116
|
+
export function createJsonParseErrorEvent(props: {
|
|
117
117
|
call_id: string;
|
|
118
|
-
operation: AgenticaOperation
|
|
118
|
+
operation: AgenticaOperation;
|
|
119
119
|
arguments: string;
|
|
120
120
|
errorMessage: string;
|
|
121
121
|
life: number;
|
|
122
|
-
}): AgenticaJsonParseErrorEvent
|
|
122
|
+
}): AgenticaJsonParseErrorEvent {
|
|
123
123
|
const id: string = v4();
|
|
124
124
|
const created_at: string = new Date().toISOString();
|
|
125
125
|
return {
|
|
@@ -134,12 +134,12 @@ export function createJsonParseErrorEvent<Model extends ILlmSchema.Model>(props:
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export function createValidateEvent
|
|
137
|
+
export function createValidateEvent(props: {
|
|
138
138
|
call_id: string;
|
|
139
|
-
operation: AgenticaOperation
|
|
139
|
+
operation: AgenticaOperation;
|
|
140
140
|
result: IValidation.IFailure;
|
|
141
141
|
life: number;
|
|
142
|
-
}): AgenticaValidateEvent
|
|
142
|
+
}): AgenticaValidateEvent {
|
|
143
143
|
const id: string = v4();
|
|
144
144
|
const created_at: string = new Date().toISOString();
|
|
145
145
|
return {
|
|
@@ -162,13 +162,13 @@ export function createValidateEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export function createExecuteEvent
|
|
165
|
+
export function createExecuteEvent(props: {
|
|
166
166
|
call_id: string;
|
|
167
|
-
operation: AgenticaOperation
|
|
167
|
+
operation: AgenticaOperation;
|
|
168
168
|
arguments: Record<string, unknown>;
|
|
169
169
|
value: unknown;
|
|
170
170
|
success: boolean;
|
|
171
|
-
}): AgenticaExecuteEvent
|
|
171
|
+
}): AgenticaExecuteEvent {
|
|
172
172
|
const id: string = v4();
|
|
173
173
|
const created_at: string = new Date().toISOString();
|
|
174
174
|
return {
|
|
@@ -177,7 +177,7 @@ export function createExecuteEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
177
177
|
created_at,
|
|
178
178
|
call_id: props.call_id,
|
|
179
179
|
protocol: props.operation.protocol as "class",
|
|
180
|
-
operation: props.operation as AgenticaOperation.Class
|
|
180
|
+
operation: props.operation as AgenticaOperation.Class,
|
|
181
181
|
arguments: props.arguments,
|
|
182
182
|
value: props.value as any,
|
|
183
183
|
success: props.success,
|
|
@@ -197,7 +197,7 @@ export function createExecuteEvent<Model extends ILlmSchema.Model>(props: {
|
|
|
197
197
|
id,
|
|
198
198
|
created_at,
|
|
199
199
|
...props,
|
|
200
|
-
}) as AgenticaExecuteHistory.Class
|
|
200
|
+
}) as AgenticaExecuteHistory.Class,
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -264,13 +264,13 @@ export function createAssistantMessageEvent(props: {
|
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
export function createDescribeEvent
|
|
268
|
-
executes: AgenticaExecuteHistory
|
|
267
|
+
export function createDescribeEvent(props: {
|
|
268
|
+
executes: AgenticaExecuteHistory[];
|
|
269
269
|
stream: AsyncGenerator<string, undefined, undefined>;
|
|
270
270
|
done: () => boolean;
|
|
271
271
|
get: () => string;
|
|
272
272
|
join: () => Promise<string>;
|
|
273
|
-
}): AgenticaDescribeEvent
|
|
273
|
+
}): AgenticaDescribeEvent {
|
|
274
274
|
const id: string = v4();
|
|
275
275
|
const created_at: string = new Date().toISOString();
|
|
276
276
|
return {
|
package/src/factory/histories.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IHttpResponse
|
|
1
|
+
import type { IHttpResponse } from "@samchon/openapi";
|
|
2
2
|
import type OpenAI from "openai";
|
|
3
3
|
import type { tags } from "typia";
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
|
|
|
18
18
|
/**
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
export function decodeHistory
|
|
21
|
+
export function decodeHistory(history: AgenticaHistory): OpenAI.ChatCompletionMessageParam[] {
|
|
22
22
|
// NO NEED TO DECODE DESCRIBE
|
|
23
23
|
if (history.type === "describe") {
|
|
24
24
|
return [];
|
|
@@ -245,12 +245,12 @@ export function createSystemMessageHistory(props: {
|
|
|
245
245
|
/**
|
|
246
246
|
* @internal
|
|
247
247
|
*/
|
|
248
|
-
export function createDescribeHistory
|
|
248
|
+
export function createDescribeHistory(props: {
|
|
249
249
|
id: string;
|
|
250
250
|
created_at: string & tags.Format<"date-time">;
|
|
251
|
-
executes: AgenticaExecuteHistory
|
|
251
|
+
executes: AgenticaExecuteHistory[];
|
|
252
252
|
text: string;
|
|
253
|
-
}): AgenticaDescribeHistory
|
|
253
|
+
}): AgenticaDescribeHistory {
|
|
254
254
|
return {
|
|
255
255
|
type: "describe",
|
|
256
256
|
id: props.id,
|
|
@@ -273,11 +273,11 @@ export function createDescribeHistory<Model extends ILlmSchema.Model>(props: {
|
|
|
273
273
|
/**
|
|
274
274
|
* @internal
|
|
275
275
|
*/
|
|
276
|
-
export function createSelectHistory
|
|
276
|
+
export function createSelectHistory(props: {
|
|
277
277
|
id: string;
|
|
278
278
|
created_at: string & tags.Format<"date-time">;
|
|
279
|
-
selection: AgenticaOperationSelection
|
|
280
|
-
}): AgenticaSelectHistory
|
|
279
|
+
selection: AgenticaOperationSelection;
|
|
280
|
+
}): AgenticaSelectHistory {
|
|
281
281
|
return {
|
|
282
282
|
type: "select",
|
|
283
283
|
id: props.id,
|
|
@@ -295,11 +295,11 @@ export function createSelectHistory<Model extends ILlmSchema.Model>(props: {
|
|
|
295
295
|
/**
|
|
296
296
|
* @internal
|
|
297
297
|
*/
|
|
298
|
-
export function createCancelHistory
|
|
298
|
+
export function createCancelHistory(props: {
|
|
299
299
|
id: string;
|
|
300
300
|
created_at: string & tags.Format<"date-time">;
|
|
301
|
-
selection: AgenticaOperationSelection
|
|
302
|
-
}): AgenticaCancelHistory
|
|
301
|
+
selection: AgenticaOperationSelection;
|
|
302
|
+
}): AgenticaCancelHistory {
|
|
303
303
|
return {
|
|
304
304
|
type: "cancel",
|
|
305
305
|
id: props.id,
|
|
@@ -317,22 +317,20 @@ export function createCancelHistory<Model extends ILlmSchema.Model>(props: {
|
|
|
317
317
|
/**
|
|
318
318
|
* @internal
|
|
319
319
|
*/
|
|
320
|
-
export function createExecuteHistory
|
|
321
|
-
Model extends ILlmSchema.Model,
|
|
322
|
-
>(props: {
|
|
320
|
+
export function createExecuteHistory(props: {
|
|
323
321
|
id: string;
|
|
324
322
|
created_at: string & tags.Format<"date-time">;
|
|
325
|
-
operation: AgenticaOperation
|
|
323
|
+
operation: AgenticaOperation;
|
|
326
324
|
arguments: Record<string, any>;
|
|
327
325
|
value: unknown;
|
|
328
326
|
success: boolean;
|
|
329
|
-
}): AgenticaExecuteHistory
|
|
327
|
+
}): AgenticaExecuteHistory {
|
|
330
328
|
return {
|
|
331
329
|
type: "execute",
|
|
332
330
|
protocol: props.operation.protocol as "class",
|
|
333
331
|
id: props.id,
|
|
334
332
|
created_at: props.created_at,
|
|
335
|
-
operation: props.operation as AgenticaOperation.Class
|
|
333
|
+
operation: props.operation as AgenticaOperation.Class,
|
|
336
334
|
arguments: props.arguments,
|
|
337
335
|
value: props.value,
|
|
338
336
|
success: props.success,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
1
|
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
4
2
|
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
5
3
|
|
|
6
|
-
export function createOperationSelection
|
|
7
|
-
operation: AgenticaOperation
|
|
4
|
+
export function createOperationSelection(props: {
|
|
5
|
+
operation: AgenticaOperation;
|
|
8
6
|
reason: string;
|
|
9
|
-
}): AgenticaOperationSelection
|
|
7
|
+
}): AgenticaOperationSelection {
|
|
10
8
|
return {
|
|
11
9
|
operation: props.operation,
|
|
12
10
|
reason: props.reason,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IHttpConnection, IHttpLlmApplication, IHttpLlmFunction, IHttpResponse,
|
|
1
|
+
import type { IHttpConnection, IHttpLlmApplication, IHttpLlmFunction, IHttpResponse, OpenApiV3, OpenApiV3_1, SwaggerV2 } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { HttpLlm, OpenApi } from "@samchon/openapi";
|
|
4
4
|
import typia from "typia";
|
|
@@ -22,19 +22,12 @@ import type { IAgenticaController } from "../structures/IAgenticaController";
|
|
|
22
22
|
* @throws {@link TypeGuardError} when the given document is invalid
|
|
23
23
|
* @author Samchon
|
|
24
24
|
*/
|
|
25
|
-
export function assertHttpController
|
|
26
|
-
Model extends ILlmSchema.Model,
|
|
27
|
-
>(props: {
|
|
25
|
+
export function assertHttpController(props: {
|
|
28
26
|
/**
|
|
29
27
|
* Name of the controller.
|
|
30
28
|
*/
|
|
31
29
|
name: string;
|
|
32
30
|
|
|
33
|
-
/**
|
|
34
|
-
* Target LLM model.
|
|
35
|
-
*/
|
|
36
|
-
model: Model;
|
|
37
|
-
|
|
38
31
|
/**
|
|
39
32
|
* Swagger/OpenAPI document.
|
|
40
33
|
*/
|
|
@@ -55,7 +48,7 @@ export function assertHttpController<
|
|
|
55
48
|
/**
|
|
56
49
|
* Options for the LLM function calling schema composition.
|
|
57
50
|
*/
|
|
58
|
-
|
|
51
|
+
config?: Partial<IHttpLlmApplication.IConfig>;
|
|
59
52
|
|
|
60
53
|
/**
|
|
61
54
|
* Executor of the API function.
|
|
@@ -72,12 +65,12 @@ export function assertHttpController<
|
|
|
72
65
|
/**
|
|
73
66
|
* Application schema.
|
|
74
67
|
*/
|
|
75
|
-
application: IHttpLlmApplication
|
|
68
|
+
application: IHttpLlmApplication;
|
|
76
69
|
|
|
77
70
|
/**
|
|
78
71
|
* Function schema.
|
|
79
72
|
*/
|
|
80
|
-
function: IHttpLlmFunction
|
|
73
|
+
function: IHttpLlmFunction;
|
|
81
74
|
|
|
82
75
|
/**
|
|
83
76
|
* Arguments of the function calling.
|
|
@@ -91,7 +84,7 @@ export function assertHttpController<
|
|
|
91
84
|
*/
|
|
92
85
|
arguments: object;
|
|
93
86
|
}) => Promise<IHttpResponse>;
|
|
94
|
-
}): IAgenticaController.IHttp
|
|
87
|
+
}): IAgenticaController.IHttp {
|
|
95
88
|
const document = OpenApi.convert(typia.assert<
|
|
96
89
|
| SwaggerV2.IDocument
|
|
97
90
|
| OpenApiV3.IDocument
|
|
@@ -102,9 +95,8 @@ export function assertHttpController<
|
|
|
102
95
|
protocol: "http",
|
|
103
96
|
name: props.name,
|
|
104
97
|
application: HttpLlm.application({
|
|
105
|
-
model: props.model,
|
|
106
98
|
document,
|
|
107
|
-
|
|
99
|
+
config: props.config,
|
|
108
100
|
}),
|
|
109
101
|
execute: props.execute,
|
|
110
102
|
connection: props.connection,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IHttpLlmApplication,
|
|
3
|
-
ILlmSchema,
|
|
4
3
|
OpenApiV3,
|
|
5
4
|
OpenApiV3_1,
|
|
6
5
|
SwaggerV2,
|
|
@@ -30,14 +29,7 @@ import typia from "typia";
|
|
|
30
29
|
* @author Samchon
|
|
31
30
|
* @deprecated Use {@link assertHttpController} instead.
|
|
32
31
|
*/
|
|
33
|
-
export function assertHttpLlmApplication
|
|
34
|
-
Model extends ILlmSchema.Model,
|
|
35
|
-
>(props: {
|
|
36
|
-
/**
|
|
37
|
-
* Target LLM model.
|
|
38
|
-
*/
|
|
39
|
-
model: Model;
|
|
40
|
-
|
|
32
|
+
export function assertHttpLlmApplication(props: {
|
|
41
33
|
/**
|
|
42
34
|
* Swagger/OpenAPI document.
|
|
43
35
|
*/
|
|
@@ -51,16 +43,15 @@ export function assertHttpLlmApplication<
|
|
|
51
43
|
/**
|
|
52
44
|
* Options for the LLM function calling schema composition.
|
|
53
45
|
*/
|
|
54
|
-
|
|
55
|
-
}): IHttpLlmApplication
|
|
46
|
+
config?: Partial<IHttpLlmApplication.IConfig>;
|
|
47
|
+
}): IHttpLlmApplication {
|
|
56
48
|
return HttpLlm.application({
|
|
57
|
-
model: props.model,
|
|
58
49
|
document: OpenApi.convert(typia.assert<
|
|
59
50
|
| SwaggerV2.IDocument
|
|
60
51
|
| OpenApiV3.IDocument
|
|
61
52
|
| OpenApiV3_1.IDocument
|
|
62
53
|
| OpenApi.IDocument
|
|
63
54
|
>(props.document)),
|
|
64
|
-
|
|
55
|
+
config: props.config,
|
|
65
56
|
});
|
|
66
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IMcpLlmApplication, IMcpTool } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { McpLlm } from "@samchon/openapi";
|
|
4
4
|
import typia from "typia";
|
|
@@ -20,20 +20,18 @@ import type { IAgenticaController } from "../structures/IAgenticaController";
|
|
|
20
20
|
* @returns MCP LLM application instance
|
|
21
21
|
* @author sunrabbit123
|
|
22
22
|
*/
|
|
23
|
-
export async function assertMcpController
|
|
23
|
+
export async function assertMcpController(props: {
|
|
24
24
|
name: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}): Promise<IAgenticaController.IMcp<Model>> {
|
|
25
|
+
client: IAgenticaController.IMcp["client"];
|
|
26
|
+
config?: Partial<IMcpLlmApplication.IConfig>;
|
|
27
|
+
}): Promise<IAgenticaController.IMcp> {
|
|
29
28
|
// for peerDependencies
|
|
30
29
|
const { ListToolsResultSchema } = await import("@modelcontextprotocol/sdk/types.js");
|
|
31
30
|
|
|
32
31
|
// get list of tools
|
|
33
32
|
const { tools } = await props.client.request({ method: "tools/list" }, ListToolsResultSchema);
|
|
34
33
|
|
|
35
|
-
const application: IMcpLlmApplication
|
|
36
|
-
model: props.model,
|
|
34
|
+
const application: IMcpLlmApplication = McpLlm.application({
|
|
37
35
|
tools: typia.assert<Array<IMcpTool>>(tools),
|
|
38
36
|
});
|
|
39
37
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IHttpConnection, IHttpLlmApplication, IHttpLlmFunction, IHttpResponse,
|
|
1
|
+
import type { IHttpConnection, IHttpLlmApplication, IHttpLlmFunction, IHttpResponse, IValidation, OpenApiV3, OpenApiV3_1, SwaggerV2 } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { HttpLlm, OpenApi } from "@samchon/openapi";
|
|
4
4
|
import typia from "typia";
|
|
@@ -22,19 +22,12 @@ import type { IAgenticaController } from "../structures/IAgenticaController";
|
|
|
22
22
|
* @returns Validation result of the HTTP controller composition
|
|
23
23
|
* @author Samchon
|
|
24
24
|
*/
|
|
25
|
-
export function validateHttpController
|
|
26
|
-
Model extends ILlmSchema.Model,
|
|
27
|
-
>(props: {
|
|
25
|
+
export function validateHttpController(props: {
|
|
28
26
|
/**
|
|
29
27
|
* Name of the controller.
|
|
30
28
|
*/
|
|
31
29
|
name: string;
|
|
32
30
|
|
|
33
|
-
/**
|
|
34
|
-
* Target LLM model.
|
|
35
|
-
*/
|
|
36
|
-
model: Model;
|
|
37
|
-
|
|
38
31
|
/**
|
|
39
32
|
* Swagger/OpenAPI document.
|
|
40
33
|
*/
|
|
@@ -55,7 +48,7 @@ export function validateHttpController<
|
|
|
55
48
|
/**
|
|
56
49
|
* Options for the LLM function calling schema composition.
|
|
57
50
|
*/
|
|
58
|
-
|
|
51
|
+
config?: Partial<IHttpLlmApplication.IConfig>;
|
|
59
52
|
|
|
60
53
|
/**
|
|
61
54
|
* Executor of the API function.
|
|
@@ -72,12 +65,12 @@ export function validateHttpController<
|
|
|
72
65
|
/**
|
|
73
66
|
* Application schema.
|
|
74
67
|
*/
|
|
75
|
-
application: IHttpLlmApplication
|
|
68
|
+
application: IHttpLlmApplication;
|
|
76
69
|
|
|
77
70
|
/**
|
|
78
71
|
* Function schema.
|
|
79
72
|
*/
|
|
80
|
-
function: IHttpLlmFunction
|
|
73
|
+
function: IHttpLlmFunction;
|
|
81
74
|
|
|
82
75
|
/**
|
|
83
76
|
* Arguments of the function calling.
|
|
@@ -91,7 +84,7 @@ export function validateHttpController<
|
|
|
91
84
|
*/
|
|
92
85
|
arguments: object;
|
|
93
86
|
}) => Promise<IHttpResponse>;
|
|
94
|
-
}): IValidation<IAgenticaController.IHttp
|
|
87
|
+
}): IValidation<IAgenticaController.IHttp> {
|
|
95
88
|
const inspect = typia.validate<
|
|
96
89
|
| SwaggerV2.IDocument
|
|
97
90
|
| OpenApiV3.IDocument
|
|
@@ -107,9 +100,8 @@ export function validateHttpController<
|
|
|
107
100
|
protocol: "http",
|
|
108
101
|
name: props.name,
|
|
109
102
|
application: HttpLlm.application({
|
|
110
|
-
model: props.model,
|
|
111
103
|
document: OpenApi.convert(inspect.data),
|
|
112
|
-
|
|
104
|
+
config: props.config,
|
|
113
105
|
}),
|
|
114
106
|
execute: props.execute,
|
|
115
107
|
connection: props.connection,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IHttpLlmApplication,
|
|
3
|
-
ILlmSchema,
|
|
4
3
|
OpenApiV3,
|
|
5
4
|
OpenApiV3_1,
|
|
6
5
|
SwaggerV2,
|
|
@@ -31,14 +30,7 @@ import typia from "typia";
|
|
|
31
30
|
* @author Samchon
|
|
32
31
|
* @deprecated Use {@link validateHttpController} instead.
|
|
33
32
|
*/
|
|
34
|
-
export function validateHttpLlmApplication
|
|
35
|
-
Model extends ILlmSchema.Model,
|
|
36
|
-
>(props: {
|
|
37
|
-
/**
|
|
38
|
-
* Target LLM model.
|
|
39
|
-
*/
|
|
40
|
-
model: Model;
|
|
41
|
-
|
|
33
|
+
export function validateHttpLlmApplication(props: {
|
|
42
34
|
/**
|
|
43
35
|
* Swagger/OpenAPI document.
|
|
44
36
|
*/
|
|
@@ -52,8 +44,8 @@ export function validateHttpLlmApplication<
|
|
|
52
44
|
/**
|
|
53
45
|
* Options for the LLM function calling schema composition.
|
|
54
46
|
*/
|
|
55
|
-
|
|
56
|
-
}): IValidation<IHttpLlmApplication
|
|
47
|
+
config?: Partial<IHttpLlmApplication.IConfig>;
|
|
48
|
+
}): IValidation<IHttpLlmApplication> {
|
|
57
49
|
const inspect: IValidation<
|
|
58
50
|
| SwaggerV2.IDocument
|
|
59
51
|
| OpenApiV3.IDocument
|
|
@@ -71,9 +63,8 @@ export function validateHttpLlmApplication<
|
|
|
71
63
|
return {
|
|
72
64
|
success: true,
|
|
73
65
|
data: HttpLlm.application({
|
|
74
|
-
model: props.model,
|
|
75
66
|
document: OpenApi.convert(inspect.data),
|
|
76
|
-
|
|
67
|
+
config: props.config,
|
|
77
68
|
}),
|
|
78
69
|
};
|
|
79
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IMcpLlmApplication, IMcpTool, IValidation } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { McpLlm } from "@samchon/openapi";
|
|
4
4
|
import typia from "typia";
|
|
@@ -20,14 +20,11 @@ import type { IAgenticaController } from "../structures/IAgenticaController";
|
|
|
20
20
|
* @returns MCP LLM application instance
|
|
21
21
|
* @author SunRabbit
|
|
22
22
|
*/
|
|
23
|
-
export async function validateMcpController
|
|
24
|
-
Model extends ILlmSchema.Model,
|
|
25
|
-
>(props: {
|
|
23
|
+
export async function validateMcpController(props: {
|
|
26
24
|
name: string;
|
|
27
|
-
client: IAgenticaController.IMcp
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}): Promise<IValidation<IAgenticaController.IMcp<Model>>> {
|
|
25
|
+
client: IAgenticaController.IMcp["client"];
|
|
26
|
+
config?: Partial<IMcpLlmApplication.IConfig>;
|
|
27
|
+
}): Promise<IValidation<IAgenticaController.IMcp>> {
|
|
31
28
|
// for peerDependencies
|
|
32
29
|
const { ListToolsResultSchema } = await import("@modelcontextprotocol/sdk/types.js");
|
|
33
30
|
|
|
@@ -38,11 +35,9 @@ export async function validateMcpController<
|
|
|
38
35
|
return inspect;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
const application: IMcpLlmApplication
|
|
42
|
-
model: props.model,
|
|
38
|
+
const application: IMcpLlmApplication = McpLlm.application({
|
|
43
39
|
tools: typia.assert<Array<IMcpTool>>(tools),
|
|
44
40
|
});
|
|
45
|
-
|
|
46
41
|
return {
|
|
47
42
|
success: true,
|
|
48
43
|
data: {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
1
|
import type { AgenticaOperationSelection } from "../context/AgenticaOperationSelection";
|
|
4
2
|
import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
|
|
5
3
|
|
|
6
4
|
import type { AgenticaHistoryBase } from "./AgenticaHistoryBase";
|
|
7
5
|
|
|
8
|
-
export interface AgenticaCancelHistory<
|
|
9
|
-
|
|
10
|
-
> extends AgenticaHistoryBase<"cancel", IAgenticaHistoryJson.ICancel> {
|
|
11
|
-
selection: AgenticaOperationSelection<Model>;
|
|
6
|
+
export interface AgenticaCancelHistory extends AgenticaHistoryBase<"cancel", IAgenticaHistoryJson.ICancel> {
|
|
7
|
+
selection: AgenticaOperationSelection;
|
|
12
8
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
|
-
|
|
3
1
|
import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
|
|
4
2
|
|
|
5
3
|
import type { AgenticaExecuteHistory } from "./AgenticaExecuteHistory";
|
|
6
4
|
import type { AgenticaHistoryBase } from "./AgenticaHistoryBase";
|
|
7
5
|
|
|
8
|
-
export interface AgenticaDescribeHistory<
|
|
9
|
-
Model extends ILlmSchema.Model,
|
|
10
|
-
> extends AgenticaHistoryBase<"describe", IAgenticaHistoryJson.IDescribe> {
|
|
6
|
+
export interface AgenticaDescribeHistory extends AgenticaHistoryBase<"describe", IAgenticaHistoryJson.IDescribe> {
|
|
11
7
|
/**
|
|
12
8
|
* Executions of the LLM function calling.
|
|
13
9
|
*
|
|
14
10
|
* This prompt describes the return value of them.
|
|
15
11
|
*/
|
|
16
|
-
executes: AgenticaExecuteHistory
|
|
12
|
+
executes: AgenticaExecuteHistory[];
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* Description text.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IHttpResponse
|
|
1
|
+
import type { IHttpResponse } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import type { AgenticaOperation } from "../context/AgenticaOperation";
|
|
4
4
|
import type { IAgenticaHistoryJson } from "../json/IAgenticaHistoryJson";
|
|
@@ -10,25 +10,23 @@ import type { AgenticaHistoryBase } from "./AgenticaHistoryBase";
|
|
|
10
10
|
*
|
|
11
11
|
* @author Samchon
|
|
12
12
|
*/
|
|
13
|
-
export type AgenticaExecuteHistory
|
|
14
|
-
| AgenticaExecuteHistory.Class
|
|
15
|
-
| AgenticaExecuteHistory.Http
|
|
13
|
+
export type AgenticaExecuteHistory =
|
|
14
|
+
| AgenticaExecuteHistory.Class
|
|
15
|
+
| AgenticaExecuteHistory.Http;
|
|
16
16
|
export namespace AgenticaExecuteHistory {
|
|
17
17
|
/**
|
|
18
18
|
* Class protocol case.
|
|
19
19
|
*/
|
|
20
|
-
export interface Class
|
|
21
|
-
extends Base<"class", AgenticaOperation.Class<Model>, unknown> {}
|
|
20
|
+
export interface Class extends Base<"class", AgenticaOperation.Class, unknown> {}
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* HTTP protocol case.
|
|
25
24
|
*/
|
|
26
|
-
export interface Http
|
|
27
|
-
extends Base<"http", AgenticaOperation.Http<Model>, IHttpResponse> {}
|
|
25
|
+
export interface Http extends Base<"http", AgenticaOperation.Http, IHttpResponse> {}
|
|
28
26
|
|
|
29
27
|
interface Base<
|
|
30
28
|
Protocol extends "http" | "class",
|
|
31
|
-
Operation extends AgenticaOperation
|
|
29
|
+
Operation extends AgenticaOperation,
|
|
32
30
|
Value,
|
|
33
31
|
> extends AgenticaHistoryBase<"execute", IAgenticaHistoryJson.IExecute> {
|
|
34
32
|
/**
|