@agentica/core 0.8.3 → 0.9.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 (91) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +419 -404
  3. package/lib/Agentica.d.ts +10 -9
  4. package/lib/Agentica.js.map +1 -1
  5. package/lib/chatgpt/ChatGptAgent.d.ts +2 -1
  6. package/lib/chatgpt/ChatGptAgent.js.map +1 -1
  7. package/lib/chatgpt/ChatGptCallFunctionAgent.d.ts +2 -1
  8. package/lib/chatgpt/ChatGptCallFunctionAgent.js +3 -1
  9. package/lib/chatgpt/ChatGptCallFunctionAgent.js.map +1 -1
  10. package/lib/chatgpt/ChatGptCancelFunctionAgent.d.ts +3 -2
  11. package/lib/chatgpt/ChatGptCancelFunctionAgent.js +55 -2
  12. package/lib/chatgpt/ChatGptCancelFunctionAgent.js.map +1 -1
  13. package/lib/chatgpt/ChatGptDescribeFunctionAgent.d.ts +2 -1
  14. package/lib/chatgpt/ChatGptDescribeFunctionAgent.js.map +1 -1
  15. package/lib/chatgpt/ChatGptHistoryDecoder.d.ts +2 -1
  16. package/lib/chatgpt/ChatGptHistoryDecoder.js.map +1 -1
  17. package/lib/chatgpt/ChatGptInitializeFunctionAgent.d.ts +2 -1
  18. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js +63 -1
  19. package/lib/chatgpt/ChatGptInitializeFunctionAgent.js.map +1 -1
  20. package/lib/chatgpt/ChatGptSelectFunctionAgent.d.ts +2 -1
  21. package/lib/chatgpt/ChatGptSelectFunctionAgent.js +55 -2
  22. package/lib/chatgpt/ChatGptSelectFunctionAgent.js.map +1 -1
  23. package/lib/functional/createHttpLlmApplication.js +826 -798
  24. package/lib/functional/createHttpLlmApplication.js.map +1 -1
  25. package/lib/index.mjs +987 -804
  26. package/lib/index.mjs.map +1 -1
  27. package/lib/internal/AgenticaDefaultPrompt.d.ts +2 -1
  28. package/lib/internal/AgenticaDefaultPrompt.js.map +1 -1
  29. package/lib/internal/AgenticaOperationComposer.d.ts +5 -4
  30. package/lib/internal/AgenticaOperationComposer.js +1 -1
  31. package/lib/internal/AgenticaOperationComposer.js.map +1 -1
  32. package/lib/internal/AgenticaPromptFactory.d.ts +3 -2
  33. package/lib/internal/AgenticaPromptFactory.js.map +1 -1
  34. package/lib/internal/AgenticaPromptTransformer.d.ts +5 -4
  35. package/lib/internal/AgenticaPromptTransformer.js.map +1 -1
  36. package/lib/structures/IAgenticaConfig.d.ts +4 -3
  37. package/lib/structures/IAgenticaContext.d.ts +7 -6
  38. package/lib/structures/IAgenticaController.d.ts +8 -8
  39. package/lib/structures/IAgenticaEvent.d.ts +19 -18
  40. package/lib/structures/IAgenticaExecutor.d.ts +7 -6
  41. package/lib/structures/IAgenticaOperation.d.ts +4 -4
  42. package/lib/structures/IAgenticaOperationCollection.d.ts +6 -5
  43. package/lib/structures/IAgenticaOperationSelection.d.ts +4 -4
  44. package/lib/structures/IAgenticaPrompt.d.ts +11 -11
  45. package/lib/structures/IAgenticaProps.d.ts +9 -4
  46. package/lib/structures/IAgenticaProvider.d.ts +22 -27
  47. package/lib/structures/IAgenticaSystemPrompt.d.ts +8 -7
  48. package/package.json +6 -9
  49. package/prompts/cancel.md +4 -4
  50. package/prompts/common.md +2 -2
  51. package/prompts/describe.md +6 -6
  52. package/prompts/execute.md +6 -6
  53. package/prompts/initialize.md +2 -2
  54. package/prompts/select.md +6 -6
  55. package/src/Agentica.ts +323 -318
  56. package/src/chatgpt/ChatGptAgent.ts +75 -71
  57. package/src/chatgpt/ChatGptCallFunctionAgent.ts +448 -445
  58. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +287 -283
  59. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +52 -51
  60. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -87
  61. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +88 -88
  62. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +319 -318
  63. package/src/functional/createHttpLlmApplication.ts +63 -63
  64. package/src/index.ts +19 -19
  65. package/src/internal/AgenticaConstant.ts +4 -4
  66. package/src/internal/AgenticaDefaultPrompt.ts +43 -39
  67. package/src/internal/AgenticaOperationComposer.ts +87 -82
  68. package/src/internal/AgenticaPromptFactory.ts +32 -30
  69. package/src/internal/AgenticaPromptTransformer.ts +86 -83
  70. package/src/internal/AgenticaTokenUsageAggregator.ts +115 -115
  71. package/src/internal/MathUtil.ts +3 -3
  72. package/src/internal/Singleton.ts +22 -22
  73. package/src/internal/__map_take.ts +15 -15
  74. package/src/structures/IAgenticaConfig.ts +123 -121
  75. package/src/structures/IAgenticaContext.ts +129 -128
  76. package/src/structures/IAgenticaController.ts +132 -130
  77. package/src/structures/IAgenticaEvent.ts +229 -224
  78. package/src/structures/IAgenticaExecutor.ts +156 -152
  79. package/src/structures/IAgenticaOperation.ts +64 -64
  80. package/src/structures/IAgenticaOperationCollection.ts +52 -50
  81. package/src/structures/IAgenticaOperationSelection.ts +69 -69
  82. package/src/structures/IAgenticaPrompt.ts +178 -173
  83. package/src/structures/IAgenticaProps.ts +70 -64
  84. package/src/structures/IAgenticaProvider.ts +39 -45
  85. package/src/structures/IAgenticaSystemPrompt.ts +124 -122
  86. package/src/structures/IAgenticaTokenUsage.ts +107 -107
  87. package/src/structures/internal/__IChatCancelFunctionsApplication.ts +23 -23
  88. package/src/structures/internal/__IChatFunctionReference.ts +21 -21
  89. package/src/structures/internal/__IChatInitialApplication.ts +15 -15
  90. package/src/structures/internal/__IChatSelectFunctionsApplication.ts +24 -24
  91. package/src/typings/AgenticaSource.ts +6 -6
@@ -1,63 +1,63 @@
1
- import {
2
- HttpLlm,
3
- IHttpLlmApplication,
4
- OpenApi,
5
- OpenApiV3,
6
- OpenApiV3_1,
7
- SwaggerV2,
8
- } from "@samchon/openapi";
9
- import typia, { IValidation } from "typia";
10
-
11
- /**
12
- * Create an HTTP LLM application instance.
13
- *
14
- * Create an {@link IHttpLlmApplication} instance which represents
15
- * the LLM (Large Language Model) function calling application schema
16
- * from the given Swagger/OpenAPI document and the target LLM model.
17
- *
18
- * By the way, even though this `createHttpLlmApplication` function
19
- * supports every version of Swagger/OpenAPI specification, there can
20
- * be a type error in the given document. In that case, the function
21
- * will return {@link IValidation.IFailure} instance with detailed
22
- * type error tracing information.
23
- *
24
- * @param props Properties to create the HTTP LLM application instance
25
- * @returns Validation result of the HTTP LLM application composition
26
- * @author Samchon
27
- */
28
- export const createHttpLlmApplication = (props: {
29
- /**
30
- * Target LLM model.
31
- */
32
- model: "chatgpt";
33
-
34
- /**
35
- * Swagger/OpenAPI document.
36
- */
37
- document:
38
- | SwaggerV2.IDocument
39
- | OpenApiV3.IDocument
40
- | OpenApiV3_1.IDocument
41
- | OpenApi.IDocument;
42
-
43
- /**
44
- * Options for the LLM function calling schema composition.
45
- */
46
- options?: Partial<IHttpLlmApplication.IOptions<"chatgpt">>;
47
- }): IValidation<IHttpLlmApplication<"chatgpt">> => {
48
- const inspect: IValidation<
49
- | SwaggerV2.IDocument
50
- | OpenApiV3.IDocument
51
- | OpenApiV3_1.IDocument
52
- | OpenApi.IDocument
53
- > = typia.validate(props.document);
54
- if (inspect.success === false) return inspect;
55
- return {
56
- success: true,
57
- data: HttpLlm.application({
58
- model: props.model,
59
- document: OpenApi.convert(props.document),
60
- options: props.options,
61
- }),
62
- };
63
- };
1
+ import {
2
+ HttpLlm,
3
+ IHttpLlmApplication,
4
+ OpenApi,
5
+ OpenApiV3,
6
+ OpenApiV3_1,
7
+ SwaggerV2,
8
+ } from "@samchon/openapi";
9
+ import typia, { IValidation } from "typia";
10
+
11
+ /**
12
+ * Create an HTTP LLM application instance.
13
+ *
14
+ * Create an {@link IHttpLlmApplication} instance which represents
15
+ * the LLM (Large Language Model) function calling application schema
16
+ * from the given Swagger/OpenAPI document and the target LLM model.
17
+ *
18
+ * By the way, even though this `createHttpLlmApplication` function
19
+ * supports every version of Swagger/OpenAPI specification, there can
20
+ * be a type error in the given document. In that case, the function
21
+ * will return {@link IValidation.IFailure} instance with detailed
22
+ * type error tracing information.
23
+ *
24
+ * @param props Properties to create the HTTP LLM application instance
25
+ * @returns Validation result of the HTTP LLM application composition
26
+ * @author Samchon
27
+ */
28
+ export const createHttpLlmApplication = (props: {
29
+ /**
30
+ * Target LLM model.
31
+ */
32
+ model: "chatgpt";
33
+
34
+ /**
35
+ * Swagger/OpenAPI document.
36
+ */
37
+ document:
38
+ | SwaggerV2.IDocument
39
+ | OpenApiV3.IDocument
40
+ | OpenApiV3_1.IDocument
41
+ | OpenApi.IDocument;
42
+
43
+ /**
44
+ * Options for the LLM function calling schema composition.
45
+ */
46
+ options?: Partial<IHttpLlmApplication.IOptions<"chatgpt">>;
47
+ }): IValidation<IHttpLlmApplication<"chatgpt">> => {
48
+ const inspect: IValidation<
49
+ | SwaggerV2.IDocument
50
+ | OpenApiV3.IDocument
51
+ | OpenApiV3_1.IDocument
52
+ | OpenApi.IDocument
53
+ > = typia.validate(props.document);
54
+ if (inspect.success === false) return inspect;
55
+ return {
56
+ success: true,
57
+ data: HttpLlm.application({
58
+ model: props.model,
59
+ document: OpenApi.convert(props.document),
60
+ options: props.options,
61
+ }),
62
+ };
63
+ };
package/src/index.ts CHANGED
@@ -1,19 +1,19 @@
1
- // TYPES
2
- export * from "./structures/IAgenticaConfig";
3
- export * from "./structures/IAgenticaContext";
4
- export * from "./structures/IAgenticaController";
5
- export * from "./structures/IAgenticaEvent";
6
- export * from "./structures/IAgenticaExecutor";
7
- export * from "./structures/IAgenticaOperation";
8
- export * from "./structures/IAgenticaOperationCollection";
9
- export * from "./structures/IAgenticaOperationSelection";
10
- export * from "./structures/IAgenticaPrompt";
11
- export * from "./structures/IAgenticaProps";
12
- export * from "./structures/IAgenticaProvider";
13
- export * from "./structures/IAgenticaSystemPrompt";
14
- export * from "./structures/IAgenticaTokenUsage";
15
- export * from "./typings/AgenticaSource";
16
-
17
- // FACADE CLASS
18
- export * from "./functional/createHttpLlmApplication";
19
- export * from "./Agentica";
1
+ // TYPES
2
+ export * from "./structures/IAgenticaConfig";
3
+ export * from "./structures/IAgenticaContext";
4
+ export * from "./structures/IAgenticaController";
5
+ export * from "./structures/IAgenticaEvent";
6
+ export * from "./structures/IAgenticaExecutor";
7
+ export * from "./structures/IAgenticaOperation";
8
+ export * from "./structures/IAgenticaOperationCollection";
9
+ export * from "./structures/IAgenticaOperationSelection";
10
+ export * from "./structures/IAgenticaPrompt";
11
+ export * from "./structures/IAgenticaProps";
12
+ export * from "./structures/IAgenticaProvider";
13
+ export * from "./structures/IAgenticaSystemPrompt";
14
+ export * from "./structures/IAgenticaTokenUsage";
15
+ export * from "./typings/AgenticaSource";
16
+
17
+ // FACADE CLASS
18
+ export * from "./functional/createHttpLlmApplication";
19
+ export * from "./Agentica";
@@ -1,4 +1,4 @@
1
- export namespace AgenticaConstant {
2
- export const RETRY = 3;
3
- export const ELITICISM = true;
4
- }
1
+ export namespace AgenticaConstant {
2
+ export const RETRY = 3;
3
+ export const ELITICISM = true;
4
+ }
@@ -1,39 +1,43 @@
1
- import { IAgenticaConfig } from "../structures/IAgenticaConfig";
2
- import { AgenticaSystemPrompt } from "./AgenticaSystemPrompt";
3
- import { Singleton } from "./Singleton";
4
-
5
- export namespace AgenticaDefaultPrompt {
6
- export const write = (config?: IAgenticaConfig): string => {
7
- if (config?.systemPrompt?.common)
8
- return config?.systemPrompt?.common(config);
9
-
10
- const locale: string = config?.locale ?? getLocale.get();
11
- const timezone: string = config?.timezone ?? getTimezone.get();
12
-
13
- return AgenticaSystemPrompt.COMMON.replace("${locale}", locale).replace(
14
- "${timezone}",
15
- timezone,
16
- );
17
- };
18
- }
19
-
20
- const getLocale = new Singleton(() =>
21
- isNode.get()
22
- ? (process.env.LANG?.split(".")[0] ?? "en-US")
23
- : navigator.language,
24
- );
25
-
26
- const getTimezone = new Singleton(
27
- () => Intl.DateTimeFormat().resolvedOptions().timeZone,
28
- );
29
-
30
- const isNode = new Singleton(() => {
31
- const isObject = (obj: any) => typeof obj === "object" && obj !== null;
32
- return (
33
- typeof global === "object" &&
34
- isObject(global) &&
35
- isObject(global.process) &&
36
- isObject(global.process.versions) &&
37
- typeof global.process.versions.node !== "undefined"
38
- );
39
- });
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaConfig } from "../structures/IAgenticaConfig";
4
+ import { AgenticaSystemPrompt } from "./AgenticaSystemPrompt";
5
+ import { Singleton } from "./Singleton";
6
+
7
+ export namespace AgenticaDefaultPrompt {
8
+ export const write = <Model extends ILlmSchema.Model>(
9
+ config?: IAgenticaConfig<Model>,
10
+ ): string => {
11
+ if (config?.systemPrompt?.common)
12
+ return config?.systemPrompt?.common(config);
13
+
14
+ const locale: string = config?.locale ?? getLocale.get();
15
+ const timezone: string = config?.timezone ?? getTimezone.get();
16
+
17
+ return AgenticaSystemPrompt.COMMON.replace("${locale}", locale).replace(
18
+ "${timezone}",
19
+ timezone,
20
+ );
21
+ };
22
+ }
23
+
24
+ const getLocale = new Singleton(() =>
25
+ isNode.get()
26
+ ? (process.env.LANG?.split(".")[0] ?? "en-US")
27
+ : navigator.language,
28
+ );
29
+
30
+ const getTimezone = new Singleton(
31
+ () => Intl.DateTimeFormat().resolvedOptions().timeZone,
32
+ );
33
+
34
+ const isNode = new Singleton(() => {
35
+ const isObject = (obj: any) => typeof obj === "object" && obj !== null;
36
+ return (
37
+ typeof global === "object" &&
38
+ isObject(global) &&
39
+ isObject(global.process) &&
40
+ isObject(global.process.versions) &&
41
+ typeof global.process.versions.node !== "undefined"
42
+ );
43
+ });
@@ -1,82 +1,87 @@
1
- import { IAgenticaConfig } from "../structures/IAgenticaConfig";
2
- import { IAgenticaController } from "../structures/IAgenticaController";
3
- import { IAgenticaOperation } from "../structures/IAgenticaOperation";
4
- import { IAgenticaOperationCollection } from "../structures/IAgenticaOperationCollection";
5
- import { __map_take } from "./__map_take";
6
-
7
- export namespace AgenticaOperationComposer {
8
- export const compose = (props: {
9
- controllers: IAgenticaController[];
10
- config?: IAgenticaConfig | undefined;
11
- }): IAgenticaOperationCollection => {
12
- const unique: boolean =
13
- props.controllers.length === 1 ||
14
- (() => {
15
- const names: string[] = props.controllers
16
- .map((controller) =>
17
- controller.application.functions.map((func) => func.name),
18
- )
19
- .flat();
20
- return new Set(names).size === names.length;
21
- })();
22
- const naming = (func: string, ci: number) =>
23
- unique ? func : `_${ci}_${func}`;
24
-
25
- const array: IAgenticaOperation[] = props.controllers
26
- .map((controller, ci) =>
27
- controller.protocol === "http"
28
- ? controller.application.functions.map(
29
- (func) =>
30
- ({
31
- protocol: "http",
32
- controller,
33
- function: func,
34
- name: naming(func.name, ci),
35
- }) satisfies IAgenticaOperation.IHttp,
36
- )
37
- : controller.application.functions.map(
38
- (func) =>
39
- ({
40
- protocol: "class",
41
- controller,
42
- function: func,
43
- name: naming(func.name, ci),
44
- }) satisfies IAgenticaOperation.IClass,
45
- ),
46
- )
47
- .flat();
48
- const divided: IAgenticaOperation[][] | undefined =
49
- !!props.config?.capacity && array.length > props.config.capacity
50
- ? divideOperations({
51
- array,
52
- capacity: props.config.capacity,
53
- })
54
- : undefined;
55
-
56
- const flat: Map<string, IAgenticaOperation> = new Map();
57
- const group: Map<string, Map<string, IAgenticaOperation>> = new Map();
58
- for (const item of array) {
59
- flat.set(item.name, item);
60
- __map_take(group, item.controller.name, () => new Map()).set(
61
- item.name,
62
- item,
63
- );
64
- }
65
- return {
66
- array,
67
- divided,
68
- flat,
69
- group,
70
- };
71
- };
72
-
73
- const divideOperations = (props: {
74
- array: IAgenticaOperation[];
75
- capacity: number;
76
- }): IAgenticaOperation[][] => {
77
- const size: number = Math.ceil(props.array.length / props.capacity);
78
- const capacity: number = Math.ceil(props.array.length / size);
79
- const replica: IAgenticaOperation[] = props.array.slice();
80
- return new Array(size).fill(0).map(() => replica.splice(0, capacity));
81
- };
82
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaConfig } from "../structures/IAgenticaConfig";
4
+ import { IAgenticaController } from "../structures/IAgenticaController";
5
+ import { IAgenticaOperation } from "../structures/IAgenticaOperation";
6
+ import { IAgenticaOperationCollection } from "../structures/IAgenticaOperationCollection";
7
+ import { __map_take } from "./__map_take";
8
+
9
+ export namespace AgenticaOperationComposer {
10
+ export const compose = <Model extends ILlmSchema.Model>(props: {
11
+ controllers: IAgenticaController<Model>[];
12
+ config?: IAgenticaConfig<Model> | undefined;
13
+ }): IAgenticaOperationCollection<Model> => {
14
+ const unique: boolean =
15
+ props.controllers.length === 1 ||
16
+ (() => {
17
+ const names: string[] = props.controllers
18
+ .map((controller) =>
19
+ controller.application.functions.map((func) => func.name),
20
+ )
21
+ .flat();
22
+ return new Set(names).size === names.length;
23
+ })();
24
+ const naming = (func: string, ci: number) =>
25
+ unique ? func : `_${ci}_${func}`;
26
+
27
+ const array: IAgenticaOperation<Model>[] = props.controllers
28
+ .map((controller, ci) =>
29
+ controller.protocol === "http"
30
+ ? controller.application.functions.map(
31
+ (func) =>
32
+ ({
33
+ protocol: "http",
34
+ controller: controller,
35
+ function: func,
36
+ name: naming(func.name, ci),
37
+ }) satisfies IAgenticaOperation.IHttp<Model>,
38
+ )
39
+ : controller.application.functions.map(
40
+ (func) =>
41
+ ({
42
+ protocol: "class",
43
+ controller,
44
+ function: func,
45
+ name: naming(func.name, ci),
46
+ }) satisfies IAgenticaOperation.IClass<Model>,
47
+ ),
48
+ )
49
+ .flat();
50
+ const divided: IAgenticaOperation<Model>[][] | undefined =
51
+ !!props.config?.capacity && array.length > props.config.capacity
52
+ ? divideOperations({
53
+ array,
54
+ capacity: props.config.capacity,
55
+ })
56
+ : undefined;
57
+
58
+ const flat: Map<string, IAgenticaOperation<Model>> = new Map();
59
+ const group: Map<
60
+ string,
61
+ Map<string, IAgenticaOperation<Model>>
62
+ > = new Map();
63
+ for (const item of array) {
64
+ flat.set(item.name, item);
65
+ __map_take(group, item.controller.name, () => new Map()).set(
66
+ item.name,
67
+ item,
68
+ );
69
+ }
70
+ return {
71
+ array,
72
+ divided,
73
+ flat,
74
+ group,
75
+ };
76
+ };
77
+
78
+ const divideOperations = <Model extends ILlmSchema.Model>(props: {
79
+ array: IAgenticaOperation<Model>[];
80
+ capacity: number;
81
+ }): IAgenticaOperation<Model>[][] => {
82
+ const size: number = Math.ceil(props.array.length / props.capacity);
83
+ const capacity: number = Math.ceil(props.array.length / size);
84
+ const replica: IAgenticaOperation<Model>[] = props.array.slice();
85
+ return new Array(size).fill(0).map(() => replica.splice(0, capacity));
86
+ };
87
+ }
@@ -1,30 +1,32 @@
1
- import { IAgenticaOperationSelection } from "../structures/IAgenticaOperationSelection";
2
- import { IAgenticaPrompt } from "../structures/IAgenticaPrompt";
3
-
4
- export namespace AgenticaPromptFactory {
5
- export const execute = (
6
- props: Omit<IAgenticaPrompt.IExecute, "toJSON">,
7
- ): IAgenticaPrompt.IExecute =>
8
- ({
9
- ...props,
10
- toJSON: () =>
11
- ({
12
- ...props,
13
- controller: props.controller.name,
14
- function: props.function.name,
15
- }) as any,
16
- }) as IAgenticaPrompt.IExecute;
17
-
18
- export const selection = (
19
- props: Omit<IAgenticaOperationSelection, "toJSON">,
20
- ): IAgenticaOperationSelection =>
21
- ({
22
- ...props,
23
- toJSON: () =>
24
- ({
25
- ...props,
26
- controller: props.controller.name,
27
- function: props.function.name,
28
- }) as any,
29
- }) as IAgenticaOperationSelection;
30
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaOperationSelection } from "../structures/IAgenticaOperationSelection";
4
+ import { IAgenticaPrompt } from "../structures/IAgenticaPrompt";
5
+
6
+ export namespace AgenticaPromptFactory {
7
+ export const execute = <Model extends ILlmSchema.Model>(
8
+ props: Omit<IAgenticaPrompt.IExecute<Model>, "toJSON">,
9
+ ): IAgenticaPrompt.IExecute<Model> =>
10
+ ({
11
+ ...props,
12
+ toJSON: () =>
13
+ ({
14
+ ...props,
15
+ controller: props.controller.name,
16
+ function: props.function.name,
17
+ }) as any,
18
+ }) as IAgenticaPrompt.IExecute<Model>;
19
+
20
+ export const selection = <Model extends ILlmSchema.Model>(
21
+ props: Omit<IAgenticaOperationSelection<Model>, "toJSON">,
22
+ ): IAgenticaOperationSelection<Model> =>
23
+ ({
24
+ ...props,
25
+ toJSON: () =>
26
+ ({
27
+ ...props,
28
+ controller: props.controller.name,
29
+ function: props.function.name,
30
+ }) as any,
31
+ }) as IAgenticaOperationSelection<Model>;
32
+ }