@agentica/benchmark 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.
@@ -1,120 +1,120 @@
1
- import {
2
- AgenticaOperationSelection,
3
- AgenticaTextPrompt,
4
- AgenticaTokenUsage,
5
- } from "@agentica/core";
6
- import { ILlmSchema } from "@samchon/openapi";
7
-
8
- import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
9
-
10
- /**
11
- * Event of LLM function selection benchmark.
12
- *
13
- * `IAgenticaSelectBenchmarkEvent` is an union type of the events occurred
14
- * during the LLM function selection benchmark, representing one phase of
15
- * the benchmark testing about a scenario.
16
- *
17
- * In other words, when {@link AgenticaSelectBenchmark} executes the
18
- * benchmark, it will run the benchmark will test a scenario repeately with
19
- * the given configuration {@link AgenticaSelectBenchmark.IConfig.repeat}.
20
- * And in the repeated benchmark about a scenario,
21
- * `IAgenticaSelectBenchmarkEvent` is one of the repeated testing.
22
- *
23
- * For reference, `IAgenticaSelectBenchmarkEvent` is categorized into three
24
- * types: `success`, `failure`, and `error`. The `success` means the
25
- * benchmark testing is fully meet the expected scenario, and `failure`
26
- * means that the `selector` had not selected the expected operations. The
27
- * last type, `error`, means that an error had been occurred during the
28
- * benchmark testing.
29
- *
30
- * @author Samchon
31
- */
32
- export type IAgenticaSelectBenchmarkEvent<Model extends ILlmSchema.Model> =
33
- | IAgenticaSelectBenchmarkEvent.ISuccess<Model>
34
- | IAgenticaSelectBenchmarkEvent.IFailure<Model>
35
- | IAgenticaSelectBenchmarkEvent.IError<Model>;
36
- export namespace IAgenticaSelectBenchmarkEvent {
37
- /**
38
- * Success event type.
39
- *
40
- * The `success` event type represents that the benchmark testing is
41
- * fully meet the expected scenario.
42
- */
43
- export interface ISuccess<Model extends ILlmSchema.Model>
44
- extends IEventBase<"success", Model> {
45
- /**
46
- * Usage of the token during the benchmark.
47
- */
48
- usage: AgenticaTokenUsage;
49
-
50
- /**
51
- * Selected operations in the benchmark.
52
- */
53
- selected: AgenticaOperationSelection<Model>[];
54
-
55
- /**
56
- * Prompt messages from the assistant.
57
- */
58
- assistantPrompts: AgenticaTextPrompt<"assistant">[];
59
- }
60
-
61
- /**
62
- * Failure event type.
63
- *
64
- * The `failure` event type represents that the `selector` had not
65
- * selected the expected scenario in the benchmark testing.
66
- */
67
- export interface IFailure<Model extends ILlmSchema.Model>
68
- extends IEventBase<"failure", Model> {
69
- /**
70
- * Usage of the token during the benchmark.
71
- */
72
- usage: AgenticaTokenUsage;
73
-
74
- /**
75
- * Selected operations in the benchmark.
76
- */
77
- selected: AgenticaOperationSelection<Model>[];
78
-
79
- /**
80
- * Prompt messages from the assistant.
81
- */
82
- assistantPrompts: AgenticaTextPrompt<"assistant">[];
83
- }
84
-
85
- /**
86
- * Error event type.
87
- *
88
- * The `error` event type repsents that an error had been occurred
89
- * during the benchmark testing.
90
- */
91
- export interface IError<Model extends ILlmSchema.Model>
92
- extends IEventBase<"error", Model> {
93
- /**
94
- * Error occurred during the benchmark.
95
- */
96
- error: unknown;
97
- }
98
-
99
- interface IEventBase<Type extends string, Model extends ILlmSchema.Model> {
100
- /**
101
- * Discriminant type.
102
- */
103
- type: Type;
104
-
105
- /**
106
- * Expected scenario.
107
- */
108
- scenario: IAgenticaSelectBenchmarkScenario<Model>;
109
-
110
- /**
111
- * When the benchmark testing started.
112
- */
113
- started_at: Date;
114
-
115
- /**
116
- * When the benchmark testing completed.
117
- */
118
- completed_at: Date;
119
- }
120
- }
1
+ import {
2
+ AgenticaOperationSelection,
3
+ AgenticaTextPrompt,
4
+ AgenticaTokenUsage,
5
+ } from "@agentica/core";
6
+ import { ILlmSchema } from "@samchon/openapi";
7
+
8
+ import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
9
+
10
+ /**
11
+ * Event of LLM function selection benchmark.
12
+ *
13
+ * `IAgenticaSelectBenchmarkEvent` is an union type of the events occurred
14
+ * during the LLM function selection benchmark, representing one phase of
15
+ * the benchmark testing about a scenario.
16
+ *
17
+ * In other words, when {@link AgenticaSelectBenchmark} executes the
18
+ * benchmark, it will run the benchmark will test a scenario repeately with
19
+ * the given configuration {@link AgenticaSelectBenchmark.IConfig.repeat}.
20
+ * And in the repeated benchmark about a scenario,
21
+ * `IAgenticaSelectBenchmarkEvent` is one of the repeated testing.
22
+ *
23
+ * For reference, `IAgenticaSelectBenchmarkEvent` is categorized into three
24
+ * types: `success`, `failure`, and `error`. The `success` means the
25
+ * benchmark testing is fully meet the expected scenario, and `failure`
26
+ * means that the `selector` had not selected the expected operations. The
27
+ * last type, `error`, means that an error had been occurred during the
28
+ * benchmark testing.
29
+ *
30
+ * @author Samchon
31
+ */
32
+ export type IAgenticaSelectBenchmarkEvent<Model extends ILlmSchema.Model> =
33
+ | IAgenticaSelectBenchmarkEvent.ISuccess<Model>
34
+ | IAgenticaSelectBenchmarkEvent.IFailure<Model>
35
+ | IAgenticaSelectBenchmarkEvent.IError<Model>;
36
+ export namespace IAgenticaSelectBenchmarkEvent {
37
+ /**
38
+ * Success event type.
39
+ *
40
+ * The `success` event type represents that the benchmark testing is
41
+ * fully meet the expected scenario.
42
+ */
43
+ export interface ISuccess<Model extends ILlmSchema.Model>
44
+ extends IEventBase<"success", Model> {
45
+ /**
46
+ * Usage of the token during the benchmark.
47
+ */
48
+ usage: AgenticaTokenUsage;
49
+
50
+ /**
51
+ * Selected operations in the benchmark.
52
+ */
53
+ selected: AgenticaOperationSelection<Model>[];
54
+
55
+ /**
56
+ * Prompt messages from the assistant.
57
+ */
58
+ assistantPrompts: AgenticaTextPrompt<"assistant">[];
59
+ }
60
+
61
+ /**
62
+ * Failure event type.
63
+ *
64
+ * The `failure` event type represents that the `selector` had not
65
+ * selected the expected scenario in the benchmark testing.
66
+ */
67
+ export interface IFailure<Model extends ILlmSchema.Model>
68
+ extends IEventBase<"failure", Model> {
69
+ /**
70
+ * Usage of the token during the benchmark.
71
+ */
72
+ usage: AgenticaTokenUsage;
73
+
74
+ /**
75
+ * Selected operations in the benchmark.
76
+ */
77
+ selected: AgenticaOperationSelection<Model>[];
78
+
79
+ /**
80
+ * Prompt messages from the assistant.
81
+ */
82
+ assistantPrompts: AgenticaTextPrompt<"assistant">[];
83
+ }
84
+
85
+ /**
86
+ * Error event type.
87
+ *
88
+ * The `error` event type repsents that an error had been occurred
89
+ * during the benchmark testing.
90
+ */
91
+ export interface IError<Model extends ILlmSchema.Model>
92
+ extends IEventBase<"error", Model> {
93
+ /**
94
+ * Error occurred during the benchmark.
95
+ */
96
+ error: unknown;
97
+ }
98
+
99
+ interface IEventBase<Type extends string, Model extends ILlmSchema.Model> {
100
+ /**
101
+ * Discriminant type.
102
+ */
103
+ type: Type;
104
+
105
+ /**
106
+ * Expected scenario.
107
+ */
108
+ scenario: IAgenticaSelectBenchmarkScenario<Model>;
109
+
110
+ /**
111
+ * When the benchmark testing started.
112
+ */
113
+ started_at: Date;
114
+
115
+ /**
116
+ * When the benchmark testing completed.
117
+ */
118
+ completed_at: Date;
119
+ }
120
+ }
@@ -1,72 +1,72 @@
1
- import { AgenticaTokenUsage } from "@agentica/core";
2
- import { ILlmSchema } from "@samchon/openapi";
3
-
4
- import { IAgenticaSelectBenchmarkEvent } from "./IAgenticaSelectBenchmarkEvent";
5
- import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
6
-
7
- /**
8
- * Result of the LLM function selection benchmark.
9
- *
10
- * `IAgenticaSelectBenchmarkResult` is a structure representing the result
11
- * of the LLM function selection benchmark executed by the
12
- * {@link AgenticaSelectBenchmark.execute execute} function.
13
- *
14
- * It contains every experiment results for each scenario, and aggregated
15
- * LLM token cost in the benchmark process.
16
- *
17
- * In each scenario, as the benchmark program experiments multiple times
18
- * about a scenario, it will contain multiple events. Also, because of the
19
- * characteristics of the LLM which is not predictable, the result can be
20
- * different in each event.
21
- *
22
- * @author Samchon
23
- */
24
- export interface IAgenticaSelectBenchmarkResult<
25
- Model extends ILlmSchema.Model,
26
- > {
27
- /**
28
- * Experiments for each scenario.
29
- */
30
- experiments: IAgenticaSelectBenchmarkResult.IExperiment<Model>[];
31
-
32
- /**
33
- * Aggregated token usage information.
34
- */
35
- usage: AgenticaTokenUsage;
36
-
37
- /**
38
- * Start time of the benchmark.
39
- */
40
- started_at: Date;
41
-
42
- /**
43
- * End time of the benchmark.
44
- */
45
- completed_at: Date;
46
- }
47
- export namespace IAgenticaSelectBenchmarkResult {
48
- /**
49
- * Experiment result about a scenario.
50
- */
51
- export interface IExperiment<Model extends ILlmSchema.Model> {
52
- /**
53
- * Expected scenario.
54
- */
55
- scenario: IAgenticaSelectBenchmarkScenario<Model>;
56
-
57
- /**
58
- * Events occurred during the benchmark in the scenario.
59
- *
60
- * When benchmarking a scenario, {@link AgenticaSelectBenchmark} will
61
- * test a scenario multiple times with the given
62
- * {@link AgenticaSelectBenchmark.IConfig.repeat repeat} count.
63
- * And the event is one of the repeated benchmark results.
64
- */
65
- events: IAgenticaSelectBenchmarkEvent<Model>[];
66
-
67
- /**
68
- * LLM token usage information.
69
- */
70
- usage: AgenticaTokenUsage;
71
- }
72
- }
1
+ import { AgenticaTokenUsage } from "@agentica/core";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+
4
+ import { IAgenticaSelectBenchmarkEvent } from "./IAgenticaSelectBenchmarkEvent";
5
+ import { IAgenticaSelectBenchmarkScenario } from "./IAgenticaSelectBenchmarkScenario";
6
+
7
+ /**
8
+ * Result of the LLM function selection benchmark.
9
+ *
10
+ * `IAgenticaSelectBenchmarkResult` is a structure representing the result
11
+ * of the LLM function selection benchmark executed by the
12
+ * {@link AgenticaSelectBenchmark.execute execute} function.
13
+ *
14
+ * It contains every experiment results for each scenario, and aggregated
15
+ * LLM token cost in the benchmark process.
16
+ *
17
+ * In each scenario, as the benchmark program experiments multiple times
18
+ * about a scenario, it will contain multiple events. Also, because of the
19
+ * characteristics of the LLM which is not predictable, the result can be
20
+ * different in each event.
21
+ *
22
+ * @author Samchon
23
+ */
24
+ export interface IAgenticaSelectBenchmarkResult<
25
+ Model extends ILlmSchema.Model,
26
+ > {
27
+ /**
28
+ * Experiments for each scenario.
29
+ */
30
+ experiments: IAgenticaSelectBenchmarkResult.IExperiment<Model>[];
31
+
32
+ /**
33
+ * Aggregated token usage information.
34
+ */
35
+ usage: AgenticaTokenUsage;
36
+
37
+ /**
38
+ * Start time of the benchmark.
39
+ */
40
+ started_at: Date;
41
+
42
+ /**
43
+ * End time of the benchmark.
44
+ */
45
+ completed_at: Date;
46
+ }
47
+ export namespace IAgenticaSelectBenchmarkResult {
48
+ /**
49
+ * Experiment result about a scenario.
50
+ */
51
+ export interface IExperiment<Model extends ILlmSchema.Model> {
52
+ /**
53
+ * Expected scenario.
54
+ */
55
+ scenario: IAgenticaSelectBenchmarkScenario<Model>;
56
+
57
+ /**
58
+ * Events occurred during the benchmark in the scenario.
59
+ *
60
+ * When benchmarking a scenario, {@link AgenticaSelectBenchmark} will
61
+ * test a scenario multiple times with the given
62
+ * {@link AgenticaSelectBenchmark.IConfig.repeat repeat} count.
63
+ * And the event is one of the repeated benchmark results.
64
+ */
65
+ events: IAgenticaSelectBenchmarkEvent<Model>[];
66
+
67
+ /**
68
+ * LLM token usage information.
69
+ */
70
+ usage: AgenticaTokenUsage;
71
+ }
72
+ }
@@ -1,43 +1,43 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
4
-
5
- /**
6
- * Scenario of function selection.
7
- *
8
- * `IAgenticaSelectBenchmarkScenario` is a data structure which
9
- * represents a function selection benchmark scenario. It contains two
10
- * properties; {@linkk text} and {@link operations}.
11
- *
12
- * The {@link text} means the conversation text from the user, and
13
- * the other {@link operations} are the expected operations that
14
- * should be selected by the `selector` agent through the {@link text}
15
- * conversation.
16
- *
17
- * @author Samchon
18
- */
19
- export interface IAgenticaSelectBenchmarkScenario<
20
- Model extends ILlmSchema.Model,
21
- > {
22
- /**
23
- * Name of the scenario.
24
- *
25
- * It must be unique within the benchmark scenarios.
26
- */
27
- name: string;
28
-
29
- /**
30
- * The prompt text from user.
31
- */
32
- text: string;
33
-
34
- /**
35
- * Expected function selection sequence.
36
- *
37
- * Sequence of operations (API operation or class function) that
38
- * should be selected by the `selector` agent from the user's
39
- * {@link text} conversation for the LLM (Large Language Model)
40
- * function selection.
41
- */
42
- expected: IAgenticaBenchmarkExpected<Model>;
43
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
4
+
5
+ /**
6
+ * Scenario of function selection.
7
+ *
8
+ * `IAgenticaSelectBenchmarkScenario` is a data structure which
9
+ * represents a function selection benchmark scenario. It contains two
10
+ * properties; {@linkk text} and {@link operations}.
11
+ *
12
+ * The {@link text} means the conversation text from the user, and
13
+ * the other {@link operations} are the expected operations that
14
+ * should be selected by the `selector` agent through the {@link text}
15
+ * conversation.
16
+ *
17
+ * @author Samchon
18
+ */
19
+ export interface IAgenticaSelectBenchmarkScenario<
20
+ Model extends ILlmSchema.Model,
21
+ > {
22
+ /**
23
+ * Name of the scenario.
24
+ *
25
+ * It must be unique within the benchmark scenarios.
26
+ */
27
+ name: string;
28
+
29
+ /**
30
+ * The prompt text from user.
31
+ */
32
+ text: string;
33
+
34
+ /**
35
+ * Expected function selection sequence.
36
+ *
37
+ * Sequence of operations (API operation or class function) that
38
+ * should be selected by the `selector` agent from the user's
39
+ * {@link text} conversation for the LLM (Large Language Model)
40
+ * function selection.
41
+ */
42
+ expected: IAgenticaBenchmarkExpected<Model>;
43
+ }
@@ -1,3 +1,3 @@
1
- export namespace MathUtil {
2
- export const round = (value: number): number => Math.floor(value * 100) / 100;
3
- }
1
+ export namespace MathUtil {
2
+ export const round = (value: number): number => Math.floor(value * 100) / 100;
3
+ }