@agentica/benchmark 0.12.21 → 0.13.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/README.md +39 -33
- package/lib/AgenticaCallBenchmark.d.ts +12 -6
- package/lib/AgenticaCallBenchmark.js +24 -18
- package/lib/AgenticaCallBenchmark.js.map +1 -1
- package/lib/AgenticaSelectBenchmark.d.ts +12 -6
- package/lib/AgenticaSelectBenchmark.js +14 -12
- package/lib/AgenticaSelectBenchmark.js.map +1 -1
- package/lib/index.mjs +315 -236
- package/lib/index.mjs.map +1 -1
- package/lib/internal/AgenticaBenchmarkPredicator.d.ts +38 -29
- package/lib/internal/AgenticaBenchmarkPredicator.js +100 -84
- package/lib/internal/AgenticaBenchmarkPredicator.js.map +1 -1
- package/lib/internal/AgenticaBenchmarkUtil.d.ts +21 -6
- package/lib/internal/AgenticaBenchmarkUtil.js +39 -33
- package/lib/internal/AgenticaBenchmarkUtil.js.map +1 -1
- package/lib/internal/AgenticaCallBenchmarkReporter.d.ts +6 -5
- package/lib/internal/AgenticaCallBenchmarkReporter.js +130 -126
- package/lib/internal/AgenticaCallBenchmarkReporter.js.map +1 -1
- package/lib/internal/AgenticaPromptReporter.d.ts +13 -5
- package/lib/internal/AgenticaPromptReporter.js +45 -41
- package/lib/internal/AgenticaPromptReporter.js.map +1 -1
- package/lib/internal/AgenticaSelectBenchmarkReporter.d.ts +3 -1
- package/lib/internal/AgenticaSelectBenchmarkReporter.js +153 -150
- package/lib/internal/AgenticaSelectBenchmarkReporter.js.map +1 -1
- package/lib/structures/IAgenticaBenchmarkExpected.d.ts +8 -2
- package/lib/structures/IAgenticaCallBenchmarkEvent.d.ts +9 -3
- package/lib/structures/IAgenticaCallBenchmarkResult.d.ts +10 -4
- package/lib/structures/IAgenticaCallBenchmarkScenario.d.ts +8 -2
- package/lib/structures/IAgenticaSelectBenchmarkEvent.d.ts +9 -3
- package/lib/structures/IAgenticaSelectBenchmarkResult.d.ts +10 -4
- package/lib/structures/IAgenticaSelectBenchmarkScenario.d.ts +8 -2
- package/lib/utils/MathUtil.d.ts +15 -3
- package/lib/utils/MathUtil.js +15 -4
- package/lib/utils/MathUtil.js.map +1 -1
- package/package.json +12 -10
- package/src/AgenticaCallBenchmark.ts +64 -45
- package/src/AgenticaSelectBenchmark.ts +42 -30
- package/src/internal/AgenticaBenchmarkPredicator.ts +208 -186
- package/src/internal/AgenticaBenchmarkUtil.ts +58 -40
- package/src/internal/AgenticaCallBenchmarkReporter.ts +180 -182
- package/src/internal/AgenticaPromptReporter.ts +46 -33
- package/src/internal/AgenticaSelectBenchmarkReporter.ts +205 -203
- package/src/structures/IAgenticaBenchmarkExpected.ts +9 -2
- package/src/structures/IAgenticaCallBenchmarkEvent.ts +9 -3
- package/src/structures/IAgenticaCallBenchmarkResult.ts +10 -4
- package/src/structures/IAgenticaCallBenchmarkScenario.ts +8 -2
- package/src/structures/IAgenticaSelectBenchmarkEvent.ts +9 -3
- package/src/structures/IAgenticaSelectBenchmarkResult.ts +10 -4
- package/src/structures/IAgenticaSelectBenchmarkScenario.ts +8 -2
- package/src/utils/MathUtil.ts +16 -3
|
@@ -1,215 +1,217 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains functions to work with AgenticaSelectBenchmarkReporter.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { AgenticaTokenUsage } from "@agentica/core";
|
|
8
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
3
9
|
|
|
4
|
-
import { IAgenticaSelectBenchmarkEvent } from "../structures/IAgenticaSelectBenchmarkEvent";
|
|
5
|
-
import { IAgenticaSelectBenchmarkResult } from "../structures/IAgenticaSelectBenchmarkResult";
|
|
10
|
+
import type { IAgenticaSelectBenchmarkEvent } from "../structures/IAgenticaSelectBenchmarkEvent";
|
|
11
|
+
import type { IAgenticaSelectBenchmarkResult } from "../structures/IAgenticaSelectBenchmarkResult";
|
|
6
12
|
import { MathUtil } from "../utils/MathUtil";
|
|
7
13
|
import { AgenticaBenchmarkUtil } from "./AgenticaBenchmarkUtil";
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* @internal
|
|
11
17
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
): Record<string, string> =>
|
|
16
|
-
Object.fromEntries([
|
|
17
|
-
["./README.md", writeIndex(result)],
|
|
18
|
-
...result.experiments
|
|
19
|
-
.map((exp) => [
|
|
20
|
-
[`./${exp.scenario.name}/README.md`, writeExperimentIndex(exp)],
|
|
21
|
-
...exp.events.map((event, i) => [
|
|
22
|
-
`./${exp.scenario.name}/${i + 1}.${event.type}.md`,
|
|
23
|
-
writeExperimentEvent(event, i),
|
|
24
|
-
]),
|
|
25
|
-
])
|
|
26
|
-
.flat(),
|
|
27
|
-
]);
|
|
18
|
+
export const AgenticaSelectBenchmarkReporter = {
|
|
19
|
+
markdown,
|
|
20
|
+
};
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.map(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
export function markdown<Model extends ILlmSchema.Model>(result: IAgenticaSelectBenchmarkResult<Model>): Record<string, string> {
|
|
23
|
+
const iterator = [
|
|
24
|
+
["./README.md", writeIndex(result)],
|
|
25
|
+
...result.experiments
|
|
26
|
+
.map<[string, string][]>(exp => [
|
|
27
|
+
[`./${exp.scenario.name}/README.md`, writeExperimentIndex(exp)],
|
|
28
|
+
...exp.events.map<[string, string]>((event, i) => [
|
|
29
|
+
`./${exp.scenario.name}/${i + 1}.${event.type}.md`,
|
|
30
|
+
writeExperimentEvent(event, i),
|
|
31
|
+
]),
|
|
32
|
+
])
|
|
33
|
+
.flat(),
|
|
34
|
+
] satisfies [string, string][];
|
|
35
|
+
|
|
36
|
+
return Object.fromEntries(iterator);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function writeIndex<Model extends ILlmSchema.Model>(result: IAgenticaSelectBenchmarkResult<Model>): string {
|
|
40
|
+
const events: IAgenticaSelectBenchmarkEvent<Model>[] = result.experiments
|
|
41
|
+
.map(r => r.events)
|
|
42
|
+
.flat();
|
|
43
|
+
const average: number
|
|
44
|
+
= events
|
|
45
|
+
.map(e => e.completed_at.getTime() - e.started_at.getTime())
|
|
38
46
|
.reduce((a, b) => a + b, 0) / events.length;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
47
|
+
const aggregate: AgenticaTokenUsage.IComponent = result.usage.aggregate;
|
|
48
|
+
return [
|
|
49
|
+
"# LLM Function Selection Benchmark",
|
|
50
|
+
"## Summary",
|
|
51
|
+
` - Aggregation:`,
|
|
52
|
+
` - Scenarios: #${result.experiments.length.toLocaleString()}`,
|
|
53
|
+
` - Trial: ${events.length}`,
|
|
54
|
+
` - Success: ${events.filter(e => e.type === "success").length}`,
|
|
55
|
+
` - Failure: ${events.filter(e => e.type === "failure").length}`,
|
|
56
|
+
` - Average Time: ${MathUtil.round(average).toLocaleString()} ms`,
|
|
57
|
+
` - Token Usage`,
|
|
58
|
+
` - Total: ${aggregate.total.toLocaleString()}`,
|
|
59
|
+
` - Input`,
|
|
60
|
+
` - Total: ${aggregate.input.total.toLocaleString()}`,
|
|
61
|
+
` - Cached: ${aggregate.input.cached.toLocaleString()}`,
|
|
62
|
+
` - Output:`,
|
|
63
|
+
` - Total: ${aggregate.output.total.toLocaleString()}`,
|
|
64
|
+
` - Accepted Prediction: ${aggregate.output.accepted_prediction.toLocaleString()}`,
|
|
65
|
+
` - Reasoning: ${aggregate.output.reasoning.toLocaleString()}`,
|
|
66
|
+
` - Rejected Prediction: ${aggregate.output.rejected_prediction.toLocaleString()}`,
|
|
67
|
+
"",
|
|
68
|
+
"## Experiments",
|
|
69
|
+
" Name | Status | Time/Avg ",
|
|
70
|
+
":-----|:-------|----------:",
|
|
71
|
+
...result.experiments.map(exp =>
|
|
72
|
+
[
|
|
73
|
+
`[${exp.scenario.name}](./${exp.scenario.name}/README.md)`,
|
|
74
|
+
(() => {
|
|
75
|
+
const success: number = Math.floor(
|
|
76
|
+
(exp.events.filter(e => e.type === "success").length
|
|
77
|
+
/ exp.events.length)
|
|
78
|
+
* 10,
|
|
79
|
+
);
|
|
80
|
+
return (
|
|
81
|
+
Array.from({ length: success }).fill("■").join("")
|
|
82
|
+
+ Array.from({ length: 10 - success }).fill("□").join("")
|
|
83
|
+
);
|
|
84
|
+
})(),
|
|
85
|
+
`${MathUtil.round(
|
|
86
|
+
exp.events
|
|
87
|
+
.map(
|
|
88
|
+
event =>
|
|
89
|
+
event.completed_at.getTime() - event.started_at.getTime(),
|
|
90
|
+
)
|
|
91
|
+
.reduce((a, b) => a + b, 0) / exp.events.length,
|
|
92
|
+
).toLocaleString()} ms`,
|
|
93
|
+
].join(" | "),
|
|
94
|
+
),
|
|
95
|
+
].join("\n");
|
|
96
|
+
}
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
].join("\n");
|
|
145
|
-
};
|
|
98
|
+
function writeExperimentIndex<Model extends ILlmSchema.Model>(exp: IAgenticaSelectBenchmarkResult.IExperiment<Model>): string {
|
|
99
|
+
const aggregate: AgenticaTokenUsage.IComponent = exp.usage.aggregate;
|
|
100
|
+
return [
|
|
101
|
+
`# ${exp.scenario.name}`,
|
|
102
|
+
"## Summary",
|
|
103
|
+
" - Aggregation:",
|
|
104
|
+
` - Trial: ${exp.events.length}`,
|
|
105
|
+
` - Success: ${exp.events.filter(e => e.type === "success").length}`,
|
|
106
|
+
` - Failure: ${exp.events.filter(e => e.type === "failure").length}`,
|
|
107
|
+
` - Average Time: ${MathUtil.round(
|
|
108
|
+
exp.events
|
|
109
|
+
.map(
|
|
110
|
+
event =>
|
|
111
|
+
event.completed_at.getTime() - event.started_at.getTime(),
|
|
112
|
+
)
|
|
113
|
+
.reduce((a, b) => a + b, 0) / exp.events.length,
|
|
114
|
+
).toLocaleString()} ms`,
|
|
115
|
+
` - Token Usage`,
|
|
116
|
+
` - Total: ${aggregate.total.toLocaleString()}`,
|
|
117
|
+
` - Input`,
|
|
118
|
+
` - Total: ${aggregate.input.total.toLocaleString()}`,
|
|
119
|
+
` - Cached: ${aggregate.input.cached.toLocaleString()}`,
|
|
120
|
+
` - Output:`,
|
|
121
|
+
` - Total: ${aggregate.output.total.toLocaleString()}`,
|
|
122
|
+
` - Accepted Prediction: ${aggregate.output.accepted_prediction.toLocaleString()}`,
|
|
123
|
+
` - Reasoning: ${aggregate.output.reasoning.toLocaleString()}`,
|
|
124
|
+
` - Rejected Prediction: ${aggregate.output.rejected_prediction.toLocaleString()}`,
|
|
125
|
+
"",
|
|
126
|
+
"## Events",
|
|
127
|
+
" No | Type | Time",
|
|
128
|
+
"---:|:-----|----:",
|
|
129
|
+
...exp.events.map((e, i) =>
|
|
130
|
+
[
|
|
131
|
+
`[${i + 1}.](./${i + 1}.${e.type}.md)`,
|
|
132
|
+
e.type,
|
|
133
|
+
`${MathUtil.round(e.completed_at.getTime() - e.started_at.getTime())
|
|
134
|
+
} ms`,
|
|
135
|
+
].join(" | "),
|
|
136
|
+
),
|
|
137
|
+
"",
|
|
138
|
+
"## Scenario",
|
|
139
|
+
"### User Prompt",
|
|
140
|
+
exp.scenario.text,
|
|
141
|
+
"",
|
|
142
|
+
"### Expected",
|
|
143
|
+
"```json",
|
|
144
|
+
JSON.stringify(
|
|
145
|
+
AgenticaBenchmarkUtil.expectedToJson(exp.scenario.expected),
|
|
146
|
+
null,
|
|
147
|
+
2,
|
|
148
|
+
),
|
|
149
|
+
"```",
|
|
150
|
+
].join("\n");
|
|
151
|
+
}
|
|
146
152
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
index
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
]
|
|
212
|
-
: []),
|
|
213
|
-
].join("\n");
|
|
214
|
-
};
|
|
153
|
+
function writeExperimentEvent<Model extends ILlmSchema.Model>(event: IAgenticaSelectBenchmarkEvent<Model>, index: number): string {
|
|
154
|
+
return [
|
|
155
|
+
`# ${index + 1}. ${event.type}`,
|
|
156
|
+
`## Summary`,
|
|
157
|
+
` - Name: ${event.scenario.name}`,
|
|
158
|
+
` - Type: ${event.type}`,
|
|
159
|
+
` - Time: ${(event.completed_at.getTime() - event.started_at.getTime()).toLocaleString()} ms`,
|
|
160
|
+
...(event.type !== "error"
|
|
161
|
+
? [
|
|
162
|
+
" - Token Usage",
|
|
163
|
+
` - Total: ${event.usage.aggregate.toLocaleString()}`,
|
|
164
|
+
` - Prompt`,
|
|
165
|
+
` - Total: ${event.usage.aggregate.input.total.toLocaleString()}`,
|
|
166
|
+
` - Cached: ${event.usage.aggregate.input.cached.toLocaleString()}`,
|
|
167
|
+
` - Completion:`,
|
|
168
|
+
` - Total: ${event.usage.aggregate.output.total.toLocaleString()}`,
|
|
169
|
+
` - Reasoning: ${event.usage.aggregate.output.reasoning.toLocaleString()}`,
|
|
170
|
+
` - Accepted Prediction: ${event.usage.aggregate.output.accepted_prediction.toLocaleString()}`,
|
|
171
|
+
` - Rejected Prediction: ${event.usage.aggregate.output.rejected_prediction.toLocaleString()}`,
|
|
172
|
+
]
|
|
173
|
+
: []),
|
|
174
|
+
"",
|
|
175
|
+
"## Scenario",
|
|
176
|
+
"### User Prompt",
|
|
177
|
+
event.scenario.text,
|
|
178
|
+
"",
|
|
179
|
+
"### Expected",
|
|
180
|
+
"```json",
|
|
181
|
+
JSON.stringify(
|
|
182
|
+
AgenticaBenchmarkUtil.expectedToJson(event.scenario.expected),
|
|
183
|
+
null,
|
|
184
|
+
2,
|
|
185
|
+
),
|
|
186
|
+
"```",
|
|
187
|
+
"",
|
|
188
|
+
...(event.type === "success" || event.type === "failure"
|
|
189
|
+
? [
|
|
190
|
+
"## Result",
|
|
191
|
+
...event.selected.map(s =>
|
|
192
|
+
[
|
|
193
|
+
`### ${s.operation.name}`,
|
|
194
|
+
` - Controller: \`${s.operation.controller.name}\``,
|
|
195
|
+
` - Function: \`${s.operation.function.name}\``,
|
|
196
|
+
` - Reason: ${s.reason}`,
|
|
197
|
+
"",
|
|
198
|
+
...(s.operation.function.description !== undefined && s.operation.function.description !== ""
|
|
199
|
+
? [s.operation.function.description, ""]
|
|
200
|
+
: []),
|
|
201
|
+
].join("\n"),
|
|
202
|
+
),
|
|
203
|
+
]
|
|
204
|
+
: []),
|
|
205
|
+
...(event.type === "error"
|
|
206
|
+
? [
|
|
207
|
+
"## Error",
|
|
208
|
+
"```json",
|
|
209
|
+
AgenticaBenchmarkUtil.errorToJson(
|
|
210
|
+
JSON.stringify(event.error, null, 2),
|
|
211
|
+
),
|
|
212
|
+
"```",
|
|
213
|
+
"",
|
|
214
|
+
]
|
|
215
|
+
: []),
|
|
216
|
+
].join("\n");
|
|
215
217
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaBenchmarkExpected class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { AgenticaOperation } from "@agentica/core";
|
|
8
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* Expected operation determinant.
|
|
@@ -18,6 +24,7 @@ export type IAgenticaBenchmarkExpected<Model extends ILlmSchema.Model> =
|
|
|
18
24
|
| IAgenticaBenchmarkExpected.IAnyOf<Model>
|
|
19
25
|
| IAgenticaBenchmarkExpected.IArray<Model>
|
|
20
26
|
| IAgenticaBenchmarkExpected.IStandalone<Model>;
|
|
27
|
+
|
|
21
28
|
export namespace IAgenticaBenchmarkExpected {
|
|
22
29
|
/**
|
|
23
30
|
* All of them must meet the condition, but sequence is not important.
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaCallBenchmarkEvent class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { AgenticaPrompt, AgenticaTokenUsage } from "@agentica/core";
|
|
8
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
3
9
|
|
|
4
|
-
import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
|
|
10
|
+
import type { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Event of LLM function selection benchmark.
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaCallBenchmarkResult class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { AgenticaTokenUsage } from "@agentica/core";
|
|
8
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
3
9
|
|
|
4
|
-
import { IAgenticaCallBenchmarkEvent } from "./IAgenticaCallBenchmarkEvent";
|
|
5
|
-
import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
|
|
10
|
+
import type { IAgenticaCallBenchmarkEvent } from "./IAgenticaCallBenchmarkEvent";
|
|
11
|
+
import type { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* Result of the LLM function calling benchmark.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaCallBenchmarkScenario class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
8
|
|
|
3
|
-
import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
|
|
9
|
+
import type { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* Scenario of function calling.
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaSelectBenchmarkEvent class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type {
|
|
2
8
|
AgenticaOperationSelection,
|
|
3
9
|
AgenticaTextPrompt,
|
|
4
10
|
AgenticaTokenUsage,
|
|
5
11
|
} from "@agentica/core";
|
|
6
|
-
import { ILlmSchema } from "@samchon/openapi";
|
|
12
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
7
13
|
|
|
8
|
-
import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
|
|
14
|
+
import type { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* Event of LLM function selection benchmark.
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaSelectBenchmarkResult class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { AgenticaTokenUsage } from "@agentica/core";
|
|
8
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
3
9
|
|
|
4
|
-
import { IAgenticaSelectBenchmarkEvent } from "./IAgenticaSelectBenchmarkEvent";
|
|
5
|
-
import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
|
|
10
|
+
import type { IAgenticaSelectBenchmarkEvent } from "./IAgenticaSelectBenchmarkEvent";
|
|
11
|
+
import type { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* Result of the LLM function selection benchmark.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains the implementation of the IAgenticaSelectBenchmarkScenario class.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
import type { ILlmSchema } from "@samchon/openapi";
|
|
2
8
|
|
|
3
|
-
import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
|
|
9
|
+
import type { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* Scenario of function selection.
|
package/src/utils/MathUtil.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This file contains functions to work with MathUtil.
|
|
4
|
+
*
|
|
5
|
+
* @author Wrtn Technologies
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const MathUtil = {
|
|
9
|
+
/**
|
|
10
|
+
* Round a number to 2 decimal places.
|
|
11
|
+
*
|
|
12
|
+
* @param value - The number to round.
|
|
13
|
+
* @returns The rounded number.
|
|
14
|
+
*/
|
|
15
|
+
round: (value: number): number => Math.floor(value * 100) / 100,
|
|
16
|
+
};
|