@agentica/core 0.12.0 → 0.12.2-dev.20250314

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 (83) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +461 -461
  3. package/lib/Agentica.js +3 -1
  4. package/lib/Agentica.js.map +1 -1
  5. package/lib/context/internal/AgenticaTokenUsageAggregator.js +1 -1
  6. package/lib/context/internal/AgenticaTokenUsageAggregator.js.map +1 -1
  7. package/lib/index.mjs +5 -2
  8. package/lib/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/prompts/cancel.md +4 -4
  11. package/prompts/common.md +2 -2
  12. package/prompts/describe.md +6 -6
  13. package/prompts/execute.md +6 -6
  14. package/prompts/initialize.md +2 -2
  15. package/prompts/select.md +6 -6
  16. package/src/Agentica.ts +359 -356
  17. package/src/chatgpt/ChatGptAgent.ts +76 -76
  18. package/src/chatgpt/ChatGptCallFunctionAgent.ts +466 -466
  19. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +280 -280
  20. package/src/chatgpt/ChatGptCompletionMessageUtil.ts +166 -166
  21. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +122 -122
  22. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
  23. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +96 -96
  24. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +311 -311
  25. package/src/chatgpt/ChatGptUsageAggregator.ts +62 -62
  26. package/src/context/AgenticaCancelPrompt.ts +32 -32
  27. package/src/context/AgenticaClassOperation.ts +23 -23
  28. package/src/context/AgenticaContext.ts +130 -130
  29. package/src/context/AgenticaHttpOperation.ts +27 -27
  30. package/src/context/AgenticaOperation.ts +66 -66
  31. package/src/context/AgenticaOperationBase.ts +57 -57
  32. package/src/context/AgenticaOperationCollection.ts +52 -52
  33. package/src/context/AgenticaOperationSelection.ts +27 -27
  34. package/src/context/AgenticaTokenUsage.ts +170 -170
  35. package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
  36. package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
  37. package/src/context/internal/__IChatFunctionReference.ts +21 -21
  38. package/src/context/internal/__IChatInitialApplication.ts +15 -15
  39. package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
  40. package/src/events/AgenticaCallEvent.ts +36 -36
  41. package/src/events/AgenticaCancelEvent.ts +28 -28
  42. package/src/events/AgenticaDescribeEvent.ts +66 -66
  43. package/src/events/AgenticaEvent.ts +36 -36
  44. package/src/events/AgenticaEventBase.ts +7 -7
  45. package/src/events/AgenticaEventSource.ts +6 -6
  46. package/src/events/AgenticaExecuteEvent.ts +50 -50
  47. package/src/events/AgenticaInitializeEvent.ts +14 -14
  48. package/src/events/AgenticaRequestEvent.ts +45 -45
  49. package/src/events/AgenticaResponseEvent.ts +48 -48
  50. package/src/events/AgenticaSelectEvent.ts +37 -37
  51. package/src/events/AgenticaTextEvent.ts +62 -62
  52. package/src/functional/assertHttpLlmApplication.ts +55 -55
  53. package/src/functional/validateHttpLlmApplication.ts +66 -66
  54. package/src/index.ts +44 -44
  55. package/src/internal/AgenticaConstant.ts +4 -4
  56. package/src/internal/AgenticaDefaultPrompt.ts +43 -43
  57. package/src/internal/AgenticaOperationComposer.ts +96 -96
  58. package/src/internal/ByteArrayUtil.ts +5 -5
  59. package/src/internal/MPSCUtil.ts +111 -111
  60. package/src/internal/MathUtil.ts +3 -3
  61. package/src/internal/Singleton.ts +22 -22
  62. package/src/internal/StreamUtil.ts +64 -64
  63. package/src/internal/__map_take.ts +15 -15
  64. package/src/json/IAgenticaEventJson.ts +178 -178
  65. package/src/json/IAgenticaOperationJson.ts +36 -36
  66. package/src/json/IAgenticaOperationSelectionJson.ts +19 -19
  67. package/src/json/IAgenticaPromptJson.ts +130 -130
  68. package/src/json/IAgenticaTokenUsageJson.ts +107 -107
  69. package/src/prompts/AgenticaCancelPrompt.ts +32 -32
  70. package/src/prompts/AgenticaDescribePrompt.ts +41 -41
  71. package/src/prompts/AgenticaExecutePrompt.ts +52 -52
  72. package/src/prompts/AgenticaPrompt.ts +14 -14
  73. package/src/prompts/AgenticaPromptBase.ts +27 -27
  74. package/src/prompts/AgenticaSelectPrompt.ts +32 -32
  75. package/src/prompts/AgenticaTextPrompt.ts +31 -31
  76. package/src/structures/IAgenticaConfig.ts +123 -123
  77. package/src/structures/IAgenticaController.ts +133 -133
  78. package/src/structures/IAgenticaExecutor.ts +157 -157
  79. package/src/structures/IAgenticaProps.ts +69 -69
  80. package/src/structures/IAgenticaSystemPrompt.ts +125 -125
  81. package/src/structures/IAgenticaVendor.ts +39 -39
  82. package/src/transformers/AgenticaEventTransformer.ts +165 -165
  83. package/src/transformers/AgenticaPromptTransformer.ts +134 -134
@@ -1,170 +1,170 @@
1
- import typia from "typia";
2
-
3
- import { IAgenticaTokenUsageJson } from "../json/IAgenticaTokenUsageJson";
4
-
5
- export class AgenticaTokenUsage implements IAgenticaTokenUsageJson {
6
- /**
7
- * Aggregated token usage.
8
- */
9
- public readonly aggregate: IAgenticaTokenUsageJson.IComponent;
10
-
11
- /**
12
- * Token uasge of initializer agent.
13
- */
14
- public readonly initialize: IAgenticaTokenUsageJson.IComponent;
15
-
16
- /**
17
- * Token usage of function selector agent.
18
- */
19
- public readonly select: IAgenticaTokenUsageJson.IComponent;
20
-
21
- /**
22
- * Token usage of function canceler agent.
23
- */
24
- public readonly cancel: IAgenticaTokenUsageJson.IComponent;
25
-
26
- /**
27
- * Token usage of function caller agent.
28
- */
29
- public readonly call: IAgenticaTokenUsageJson.IComponent;
30
-
31
- /**
32
- * Token usage of function calling describer agent.
33
- */
34
- public readonly describe: IAgenticaTokenUsageJson.IComponent;
35
-
36
- public constructor(props?: IAgenticaTokenUsageJson) {
37
- if (props === undefined) {
38
- const zero = AgenticaTokenUsage.zero();
39
- this.aggregate = zero.aggregate;
40
- this.initialize = zero.initialize;
41
- this.select = zero.select;
42
- this.cancel = zero.cancel;
43
- this.call = zero.call;
44
- this.describe = zero.describe;
45
- } else {
46
- this.aggregate = props.aggregate;
47
- this.initialize = props.initialize;
48
- this.select = props.select;
49
- this.cancel = props.cancel;
50
- this.call = props.call;
51
- this.describe = props.describe;
52
- }
53
- }
54
-
55
- public increment(y: IAgenticaTokenUsageJson): void {
56
- const increment = (
57
- x: IAgenticaTokenUsageJson.IComponent,
58
- y: IAgenticaTokenUsageJson.IComponent,
59
- ): void => {
60
- x.total += y.total;
61
- x.input.total += y.input.total;
62
- x.input.cached += y.input.cached;
63
- x.output.total += y.output.total;
64
- x.output.reasoning += y.output.reasoning;
65
- x.output.accepted_prediction += y.output.accepted_prediction;
66
- x.output.rejected_prediction += y.output.rejected_prediction;
67
- };
68
- increment(this.aggregate, y.aggregate);
69
- increment(this.initialize, y.initialize);
70
- increment(this.select, y.select);
71
- increment(this.cancel, y.cancel);
72
- increment(this.call, y.call);
73
- increment(this.describe, y.describe);
74
- }
75
-
76
- public toJSON(): IAgenticaTokenUsageJson {
77
- return typia.misc.clone<IAgenticaTokenUsageJson>(this);
78
- }
79
-
80
- public static zero(): AgenticaTokenUsage {
81
- const component = (): IAgenticaTokenUsageJson.IComponent => ({
82
- total: 0,
83
- input: {
84
- total: 0,
85
- cached: 0,
86
- },
87
- output: {
88
- total: 0,
89
- reasoning: 0,
90
- accepted_prediction: 0,
91
- rejected_prediction: 0,
92
- },
93
- });
94
- return new AgenticaTokenUsage({
95
- aggregate: component(),
96
- initialize: component(),
97
- select: component(),
98
- cancel: component(),
99
- call: component(),
100
- describe: component(),
101
- });
102
- }
103
-
104
- public static plus(
105
- x: AgenticaTokenUsage,
106
- y: AgenticaTokenUsage,
107
- ): AgenticaTokenUsage {
108
- const z: AgenticaTokenUsage = new AgenticaTokenUsage(x);
109
- z.increment(y.toJSON());
110
- return z;
111
- }
112
- }
113
- export namespace AgenticaTokenUsage {
114
- export interface IComponent {
115
- /**
116
- * Total token usage.
117
- */
118
- total: number;
119
-
120
- /**
121
- * Input token usage of detailed.
122
- */
123
- input: IInput;
124
-
125
- /**
126
- * Output token usage of detailed.
127
- */
128
- output: IOutput;
129
- }
130
-
131
- /**
132
- * Input token usage of detailed.
133
- */
134
- export interface IInput {
135
- /**
136
- * Total amount of input token uasge.
137
- */
138
- total: number;
139
-
140
- /**
141
- * Cached token usage.
142
- */
143
- cached: number;
144
- }
145
-
146
- /**
147
- * Output token usage of detailed.
148
- */
149
- export interface IOutput {
150
- /**
151
- * Total amount of output token usage.
152
- */
153
- total: number;
154
-
155
- /**
156
- * Reasoning token usage.
157
- */
158
- reasoning: number;
159
-
160
- /**
161
- * Prediction token usage.
162
- */
163
- accepted_prediction: number;
164
-
165
- /**
166
- * Rejected prediction token usage.
167
- */
168
- rejected_prediction: number;
169
- }
170
- }
1
+ import typia from "typia";
2
+
3
+ import { IAgenticaTokenUsageJson } from "../json/IAgenticaTokenUsageJson";
4
+
5
+ export class AgenticaTokenUsage implements IAgenticaTokenUsageJson {
6
+ /**
7
+ * Aggregated token usage.
8
+ */
9
+ public readonly aggregate: IAgenticaTokenUsageJson.IComponent;
10
+
11
+ /**
12
+ * Token uasge of initializer agent.
13
+ */
14
+ public readonly initialize: IAgenticaTokenUsageJson.IComponent;
15
+
16
+ /**
17
+ * Token usage of function selector agent.
18
+ */
19
+ public readonly select: IAgenticaTokenUsageJson.IComponent;
20
+
21
+ /**
22
+ * Token usage of function canceler agent.
23
+ */
24
+ public readonly cancel: IAgenticaTokenUsageJson.IComponent;
25
+
26
+ /**
27
+ * Token usage of function caller agent.
28
+ */
29
+ public readonly call: IAgenticaTokenUsageJson.IComponent;
30
+
31
+ /**
32
+ * Token usage of function calling describer agent.
33
+ */
34
+ public readonly describe: IAgenticaTokenUsageJson.IComponent;
35
+
36
+ public constructor(props?: IAgenticaTokenUsageJson) {
37
+ if (props === undefined) {
38
+ const zero = AgenticaTokenUsage.zero();
39
+ this.aggregate = zero.aggregate;
40
+ this.initialize = zero.initialize;
41
+ this.select = zero.select;
42
+ this.cancel = zero.cancel;
43
+ this.call = zero.call;
44
+ this.describe = zero.describe;
45
+ } else {
46
+ this.aggregate = props.aggregate;
47
+ this.initialize = props.initialize;
48
+ this.select = props.select;
49
+ this.cancel = props.cancel;
50
+ this.call = props.call;
51
+ this.describe = props.describe;
52
+ }
53
+ }
54
+
55
+ public increment(y: IAgenticaTokenUsageJson): void {
56
+ const increment = (
57
+ x: IAgenticaTokenUsageJson.IComponent,
58
+ y: IAgenticaTokenUsageJson.IComponent,
59
+ ): void => {
60
+ x.total += y.total;
61
+ x.input.total += y.input.total;
62
+ x.input.cached += y.input.cached;
63
+ x.output.total += y.output.total;
64
+ x.output.reasoning += y.output.reasoning;
65
+ x.output.accepted_prediction += y.output.accepted_prediction;
66
+ x.output.rejected_prediction += y.output.rejected_prediction;
67
+ };
68
+ increment(this.aggregate, y.aggregate);
69
+ increment(this.initialize, y.initialize);
70
+ increment(this.select, y.select);
71
+ increment(this.cancel, y.cancel);
72
+ increment(this.call, y.call);
73
+ increment(this.describe, y.describe);
74
+ }
75
+
76
+ public toJSON(): IAgenticaTokenUsageJson {
77
+ return typia.misc.clone<IAgenticaTokenUsageJson>(this);
78
+ }
79
+
80
+ public static zero(): AgenticaTokenUsage {
81
+ const component = (): IAgenticaTokenUsageJson.IComponent => ({
82
+ total: 0,
83
+ input: {
84
+ total: 0,
85
+ cached: 0,
86
+ },
87
+ output: {
88
+ total: 0,
89
+ reasoning: 0,
90
+ accepted_prediction: 0,
91
+ rejected_prediction: 0,
92
+ },
93
+ });
94
+ return new AgenticaTokenUsage({
95
+ aggregate: component(),
96
+ initialize: component(),
97
+ select: component(),
98
+ cancel: component(),
99
+ call: component(),
100
+ describe: component(),
101
+ });
102
+ }
103
+
104
+ public static plus(
105
+ x: AgenticaTokenUsage,
106
+ y: AgenticaTokenUsage,
107
+ ): AgenticaTokenUsage {
108
+ const z: AgenticaTokenUsage = new AgenticaTokenUsage(x);
109
+ z.increment(y.toJSON());
110
+ return z;
111
+ }
112
+ }
113
+ export namespace AgenticaTokenUsage {
114
+ export interface IComponent {
115
+ /**
116
+ * Total token usage.
117
+ */
118
+ total: number;
119
+
120
+ /**
121
+ * Input token usage of detailed.
122
+ */
123
+ input: IInput;
124
+
125
+ /**
126
+ * Output token usage of detailed.
127
+ */
128
+ output: IOutput;
129
+ }
130
+
131
+ /**
132
+ * Input token usage of detailed.
133
+ */
134
+ export interface IInput {
135
+ /**
136
+ * Total amount of input token uasge.
137
+ */
138
+ total: number;
139
+
140
+ /**
141
+ * Cached token usage.
142
+ */
143
+ cached: number;
144
+ }
145
+
146
+ /**
147
+ * Output token usage of detailed.
148
+ */
149
+ export interface IOutput {
150
+ /**
151
+ * Total amount of output token usage.
152
+ */
153
+ total: number;
154
+
155
+ /**
156
+ * Reasoning token usage.
157
+ */
158
+ reasoning: number;
159
+
160
+ /**
161
+ * Prediction token usage.
162
+ */
163
+ accepted_prediction: number;
164
+
165
+ /**
166
+ * Rejected prediction token usage.
167
+ */
168
+ rejected_prediction: number;
169
+ }
170
+ }
@@ -1,66 +1,66 @@
1
- import { CompletionUsage } from "openai/resources";
2
-
3
- import { IAgenticaTokenUsageJson } from "../../json/IAgenticaTokenUsageJson";
4
- import { AgenticaTokenUsage } from "../AgenticaTokenUsage";
5
-
6
- export namespace AgenticaTokenUsageAggregator {
7
- export const aggregate = (props: {
8
- kind: Exclude<keyof IAgenticaTokenUsageJson, "aggregate">;
9
- completionUsage: CompletionUsage;
10
- usage: AgenticaTokenUsage;
11
- }): void => {
12
- if (!props.completionUsage) return;
13
-
14
- //----
15
- // COMPONENT
16
- //----
17
- const component: AgenticaTokenUsage.IComponent = props.usage[props.kind];
18
-
19
- // TOTAL
20
- component.total += props.completionUsage.total_tokens;
21
-
22
- // PROMPT
23
- component.input.total += props.completionUsage.prompt_tokens;
24
- component.input.total +=
25
- props.completionUsage.prompt_tokens_details?.audio_tokens ?? 0;
26
- component.input.cached +=
27
- props.completionUsage.prompt_tokens_details?.cached_tokens ?? 0;
28
-
29
- // COMPLETION
30
- component.output.total += props.completionUsage.total_tokens;
31
- component.output.accepted_prediction +=
32
- props.completionUsage.completion_tokens_details
33
- ?.accepted_prediction_tokens ?? 0;
34
- component.output.reasoning +=
35
- props.completionUsage.completion_tokens_details?.reasoning_tokens ?? 0;
36
- component.output.rejected_prediction +=
37
- props.completionUsage.completion_tokens_details
38
- ?.rejected_prediction_tokens ?? 0;
39
-
40
- //----
41
- // RE-AGGREGATE
42
- //----
43
- const sum = (getter: (comp: AgenticaTokenUsage.IComponent) => number) =>
44
- (
45
- Object.entries(props.usage) as [
46
- keyof AgenticaTokenUsage,
47
- AgenticaTokenUsage.IComponent,
48
- ][]
49
- )
50
- .filter(([key]) => key !== "aggregate")
51
- .map(([, comp]) => getter(comp))
52
- .reduce((a, b) => a + b, 0);
53
- const aggregate: AgenticaTokenUsage.IComponent = props.usage.aggregate;
54
- aggregate.total = sum((comp) => comp.total);
55
- aggregate.input.total = sum((comp) => comp.input.total);
56
- aggregate.input.cached = sum((comp) => comp.input.cached);
57
- aggregate.output.total = sum((comp) => comp.output.total);
58
- aggregate.output.reasoning = sum((comp) => comp.output.reasoning);
59
- aggregate.output.accepted_prediction = sum(
60
- (comp) => comp.output.accepted_prediction,
61
- );
62
- aggregate.output.rejected_prediction = sum(
63
- (comp) => comp.output.rejected_prediction,
64
- );
65
- };
66
- }
1
+ import { CompletionUsage } from "openai/resources";
2
+
3
+ import { IAgenticaTokenUsageJson } from "../../json/IAgenticaTokenUsageJson";
4
+ import { AgenticaTokenUsage } from "../AgenticaTokenUsage";
5
+
6
+ export namespace AgenticaTokenUsageAggregator {
7
+ export const aggregate = (props: {
8
+ kind: Exclude<keyof IAgenticaTokenUsageJson, "aggregate">;
9
+ completionUsage: CompletionUsage;
10
+ usage: AgenticaTokenUsage;
11
+ }): void => {
12
+ if (!props.completionUsage) return;
13
+
14
+ //----
15
+ // COMPONENT
16
+ //----
17
+ const component: AgenticaTokenUsage.IComponent = props.usage[props.kind];
18
+
19
+ // TOTAL
20
+ component.total += props.completionUsage.total_tokens;
21
+
22
+ // PROMPT
23
+ component.input.total += props.completionUsage.prompt_tokens;
24
+ component.input.total +=
25
+ props.completionUsage.prompt_tokens_details?.audio_tokens ?? 0;
26
+ component.input.cached +=
27
+ props.completionUsage.prompt_tokens_details?.cached_tokens ?? 0;
28
+
29
+ // COMPLETION
30
+ component.output.total += props.completionUsage.completion_tokens;
31
+ component.output.accepted_prediction +=
32
+ props.completionUsage.completion_tokens_details
33
+ ?.accepted_prediction_tokens ?? 0;
34
+ component.output.reasoning +=
35
+ props.completionUsage.completion_tokens_details?.reasoning_tokens ?? 0;
36
+ component.output.rejected_prediction +=
37
+ props.completionUsage.completion_tokens_details
38
+ ?.rejected_prediction_tokens ?? 0;
39
+
40
+ //----
41
+ // RE-AGGREGATE
42
+ //----
43
+ const sum = (getter: (comp: AgenticaTokenUsage.IComponent) => number) =>
44
+ (
45
+ Object.entries(props.usage) as [
46
+ keyof AgenticaTokenUsage,
47
+ AgenticaTokenUsage.IComponent,
48
+ ][]
49
+ )
50
+ .filter(([key]) => key !== "aggregate")
51
+ .map(([, comp]) => getter(comp))
52
+ .reduce((a, b) => a + b, 0);
53
+ const aggregate: AgenticaTokenUsage.IComponent = props.usage.aggregate;
54
+ aggregate.total = sum((comp) => comp.total);
55
+ aggregate.input.total = sum((comp) => comp.input.total);
56
+ aggregate.input.cached = sum((comp) => comp.input.cached);
57
+ aggregate.output.total = sum((comp) => comp.output.total);
58
+ aggregate.output.reasoning = sum((comp) => comp.output.reasoning);
59
+ aggregate.output.accepted_prediction = sum(
60
+ (comp) => comp.output.accepted_prediction,
61
+ );
62
+ aggregate.output.rejected_prediction = sum(
63
+ (comp) => comp.output.rejected_prediction,
64
+ );
65
+ };
66
+ }
@@ -1,23 +1,23 @@
1
- import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
-
3
- export interface __IChatCancelFunctionsApplication {
4
- /**
5
- * Cancel a function from the candidate list to call.
6
- *
7
- * If you A.I. agent has understood that the user wants to cancel
8
- * some candidate functions to call from the conversation, please cancel
9
- * them through this function.
10
- *
11
- * Also, when you A.I. find a function that has been selected by the candidate
12
- * pooling, cancel the function by calling this function. For reference, the
13
- * candidate pooling means that user wants only one function to call, but you A.I.
14
- * agent selects multiple candidate functions because the A.I. agent can't specify
15
- * only one thing due to lack of specificity or homogeneity of candidate functions.
16
- *
17
- * Additionally, if you A.I. agent wants to cancel same function multiply, you can
18
- * do it by assigning the same function name multiply in the `functions` property.
19
- *
20
- * @param props Properties of the function
21
- */
22
- cancelFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
23
- }
1
+ import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
+
3
+ export interface __IChatCancelFunctionsApplication {
4
+ /**
5
+ * Cancel a function from the candidate list to call.
6
+ *
7
+ * If you A.I. agent has understood that the user wants to cancel
8
+ * some candidate functions to call from the conversation, please cancel
9
+ * them through this function.
10
+ *
11
+ * Also, when you A.I. find a function that has been selected by the candidate
12
+ * pooling, cancel the function by calling this function. For reference, the
13
+ * candidate pooling means that user wants only one function to call, but you A.I.
14
+ * agent selects multiple candidate functions because the A.I. agent can't specify
15
+ * only one thing due to lack of specificity or homogeneity of candidate functions.
16
+ *
17
+ * Additionally, if you A.I. agent wants to cancel same function multiply, you can
18
+ * do it by assigning the same function name multiply in the `functions` property.
19
+ *
20
+ * @param props Properties of the function
21
+ */
22
+ cancelFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
23
+ }
@@ -1,21 +1,21 @@
1
- export interface __IChatFunctionReference {
2
- /**
3
- * The reason of the function selection.
4
- *
5
- * Just write the reason why you've determined to select this function.
6
- */
7
- reason: string;
8
-
9
- /**
10
- * Name of the target function to call.
11
- */
12
- name: string;
13
- }
14
- export namespace __IChatFunctionReference {
15
- export interface IProps {
16
- /**
17
- * List of target functions.
18
- */
19
- functions: __IChatFunctionReference[];
20
- }
21
- }
1
+ export interface __IChatFunctionReference {
2
+ /**
3
+ * The reason of the function selection.
4
+ *
5
+ * Just write the reason why you've determined to select this function.
6
+ */
7
+ reason: string;
8
+
9
+ /**
10
+ * Name of the target function to call.
11
+ */
12
+ name: string;
13
+ }
14
+ export namespace __IChatFunctionReference {
15
+ export interface IProps {
16
+ /**
17
+ * List of target functions.
18
+ */
19
+ functions: __IChatFunctionReference[];
20
+ }
21
+ }
@@ -1,15 +1,15 @@
1
- import { IHttpLlmFunction } from "@samchon/openapi";
2
-
3
- export interface __IChatInitialApplication {
4
- /**
5
- * Get list of API functions.
6
- *
7
- * If user seems like to request some function calling except this one,
8
- * call this `getApiFunctions()` to get the list of candidate API functions
9
- * provided from this application.
10
- *
11
- * Also, user just wants to list up every remote API functions that can be
12
- * called from the backend server, utilize this function too.
13
- */
14
- getApiFunctions({}): Promise<Array<IHttpLlmFunction<"chatgpt">>>;
15
- }
1
+ import { IHttpLlmFunction } from "@samchon/openapi";
2
+
3
+ export interface __IChatInitialApplication {
4
+ /**
5
+ * Get list of API functions.
6
+ *
7
+ * If user seems like to request some function calling except this one,
8
+ * call this `getApiFunctions()` to get the list of candidate API functions
9
+ * provided from this application.
10
+ *
11
+ * Also, user just wants to list up every remote API functions that can be
12
+ * called from the backend server, utilize this function too.
13
+ */
14
+ getApiFunctions({}): Promise<Array<IHttpLlmFunction<"chatgpt">>>;
15
+ }
@@ -1,24 +1,24 @@
1
- import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
-
3
- export interface __IChatSelectFunctionsApplication {
4
- /**
5
- * Select proper API functions to call.
6
- *
7
- * If you A.I. agent has found some proper API functions to call
8
- * from the conversation with user, please select the API functions
9
- * just by calling this function.
10
- *
11
- * When user wants to call a same function multiply, you A.I. agent must
12
- * list up it multiply in the `functions` property. Otherwise the user has
13
- * requested to call many different functions, you A.I. agent have to assign
14
- * them all into the `functions` property.
15
- *
16
- * Also, if you A.I. agent can't specify a specific function to call due to lack
17
- * of specificity or homogeneity of candidate functions, just assign all of them
18
- * by in the` functions` property` too. Instead, when you A.I. agent can specify
19
- * a specific function to call, the others would be eliminated.
20
- *
21
- * @param props Properties of the function
22
- */
23
- selectFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
24
- }
1
+ import { __IChatFunctionReference } from "./__IChatFunctionReference";
2
+
3
+ export interface __IChatSelectFunctionsApplication {
4
+ /**
5
+ * Select proper API functions to call.
6
+ *
7
+ * If you A.I. agent has found some proper API functions to call
8
+ * from the conversation with user, please select the API functions
9
+ * just by calling this function.
10
+ *
11
+ * When user wants to call a same function multiply, you A.I. agent must
12
+ * list up it multiply in the `functions` property. Otherwise the user has
13
+ * requested to call many different functions, you A.I. agent have to assign
14
+ * them all into the `functions` property.
15
+ *
16
+ * Also, if you A.I. agent can't specify a specific function to call due to lack
17
+ * of specificity or homogeneity of candidate functions, just assign all of them
18
+ * by in the` functions` property` too. Instead, when you A.I. agent can specify
19
+ * a specific function to call, the others would be eliminated.
20
+ *
21
+ * @param props Properties of the function
22
+ */
23
+ selectFunctions(props: __IChatFunctionReference.IProps): Promise<void>;
24
+ }