@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,113 +1,113 @@
1
- import { AgenticaPrompt, AgenticaTokenUsage } from "@agentica/core";
2
- import { ILlmSchema } from "@samchon/openapi";
3
-
4
- import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
5
-
6
- /**
7
- * Event of LLM function selection benchmark.
8
- *
9
- * `IAgenticaCallBenchmarkEvent` is an union type of the events occurred
10
- * during the LLM function calling benchmark, representing one phase of
11
- * the benchmark testing about a scenario.
12
- *
13
- * In other words, when {@link AgenticaCallBenchmark} executes the
14
- * benchmark, it will run the benchmark will test a scenario repeately with
15
- * the given configuration {@link AgenticaCallBenchmark.IConfig.repeat}.
16
- * And in the repeated benchmark about a scenario,
17
- * `IAgenticaCallBenchmarkEvent` is one of the repeated testing.
18
- *
19
- * For reference, `IAgenticaCallBenchmarkEvent` is categorized into three
20
- * types: `success`, `failure`, and `error`. The `success` means the
21
- * benchmark testing is fully meet the expected scenario, and `failure`
22
- * means that the `selector` or `caller` agents had not selected or
23
- * called the expected operations. The last type, `error`, means that
24
- * an error had been occurred during the benchmark testing.
25
- *
26
- * @author Samchon
27
- */
28
- export type IAgenticaCallBenchmarkEvent<Model extends ILlmSchema.Model> =
29
- | IAgenticaCallBenchmarkEvent.ISuccess<Model>
30
- | IAgenticaCallBenchmarkEvent.IFailure<Model>
31
- | IAgenticaCallBenchmarkEvent.IError<Model>;
32
- export namespace IAgenticaCallBenchmarkEvent {
33
- /**
34
- * Success event type.
35
- *
36
- * The `success` event type represents that the benchmark
37
- * testing is fully meet the expected scenario.
38
- */
39
- export interface ISuccess<Model extends ILlmSchema.Model>
40
- extends IEventBase<"success", Model> {
41
- /**
42
- * Whether succeeded to function selection.
43
- */
44
- select: true;
45
-
46
- /**
47
- * Whether succeeded to function call.
48
- */
49
- call: true;
50
- }
51
-
52
- /**
53
- * Failure event type.
54
- *
55
- * The `failure` event type represents that the `selector`
56
- * or `caller` agents have not selected or called following the
57
- * expected scenario in the benchmark testing.
58
- */
59
- export interface IFailure<Model extends ILlmSchema.Model>
60
- extends IEventBase<"failure", Model> {
61
- /**
62
- * Whether succeeded to function selection.
63
- */
64
- select: boolean;
65
-
66
- /**
67
- * Whether succeeded to function call.
68
- */
69
- call: boolean;
70
- }
71
-
72
- export interface IError<Model extends ILlmSchema.Model>
73
- extends IEventBase<"error", Model> {
74
- /**
75
- * Error occurred during the benchmark.
76
- */
77
- error: unknown;
78
- }
79
-
80
- interface IEventBase<Type extends string, Model extends ILlmSchema.Model> {
81
- /**
82
- * Discriminant type.
83
- */
84
- type: Type;
85
-
86
- /**
87
- * Expected scenario.
88
- */
89
- scenario: IAgenticaCallBenchmarkScenario<Model>;
90
-
91
- /**
92
- * Prompt histories.
93
- *
94
- * List of prompts occurred during the benchmark testing.
95
- */
96
- prompts: AgenticaPrompt<Model>[];
97
-
98
- /**
99
- * Usage of the token during the benchmark.
100
- */
101
- usage: AgenticaTokenUsage;
102
-
103
- /**
104
- * When the benchmark testing started.
105
- */
106
- started_at: Date;
107
-
108
- /**
109
- * When the benchmark testing completed.
110
- */
111
- completed_at: Date;
112
- }
113
- }
1
+ import { AgenticaPrompt, AgenticaTokenUsage } from "@agentica/core";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+
4
+ import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
5
+
6
+ /**
7
+ * Event of LLM function selection benchmark.
8
+ *
9
+ * `IAgenticaCallBenchmarkEvent` is an union type of the events occurred
10
+ * during the LLM function calling benchmark, representing one phase of
11
+ * the benchmark testing about a scenario.
12
+ *
13
+ * In other words, when {@link AgenticaCallBenchmark} executes the
14
+ * benchmark, it will run the benchmark will test a scenario repeately with
15
+ * the given configuration {@link AgenticaCallBenchmark.IConfig.repeat}.
16
+ * And in the repeated benchmark about a scenario,
17
+ * `IAgenticaCallBenchmarkEvent` is one of the repeated testing.
18
+ *
19
+ * For reference, `IAgenticaCallBenchmarkEvent` is categorized into three
20
+ * types: `success`, `failure`, and `error`. The `success` means the
21
+ * benchmark testing is fully meet the expected scenario, and `failure`
22
+ * means that the `selector` or `caller` agents had not selected or
23
+ * called the expected operations. The last type, `error`, means that
24
+ * an error had been occurred during the benchmark testing.
25
+ *
26
+ * @author Samchon
27
+ */
28
+ export type IAgenticaCallBenchmarkEvent<Model extends ILlmSchema.Model> =
29
+ | IAgenticaCallBenchmarkEvent.ISuccess<Model>
30
+ | IAgenticaCallBenchmarkEvent.IFailure<Model>
31
+ | IAgenticaCallBenchmarkEvent.IError<Model>;
32
+ export namespace IAgenticaCallBenchmarkEvent {
33
+ /**
34
+ * Success event type.
35
+ *
36
+ * The `success` event type represents that the benchmark
37
+ * testing is fully meet the expected scenario.
38
+ */
39
+ export interface ISuccess<Model extends ILlmSchema.Model>
40
+ extends IEventBase<"success", Model> {
41
+ /**
42
+ * Whether succeeded to function selection.
43
+ */
44
+ select: true;
45
+
46
+ /**
47
+ * Whether succeeded to function call.
48
+ */
49
+ call: true;
50
+ }
51
+
52
+ /**
53
+ * Failure event type.
54
+ *
55
+ * The `failure` event type represents that the `selector`
56
+ * or `caller` agents have not selected or called following the
57
+ * expected scenario in the benchmark testing.
58
+ */
59
+ export interface IFailure<Model extends ILlmSchema.Model>
60
+ extends IEventBase<"failure", Model> {
61
+ /**
62
+ * Whether succeeded to function selection.
63
+ */
64
+ select: boolean;
65
+
66
+ /**
67
+ * Whether succeeded to function call.
68
+ */
69
+ call: boolean;
70
+ }
71
+
72
+ export interface IError<Model extends ILlmSchema.Model>
73
+ extends IEventBase<"error", Model> {
74
+ /**
75
+ * Error occurred during the benchmark.
76
+ */
77
+ error: unknown;
78
+ }
79
+
80
+ interface IEventBase<Type extends string, Model extends ILlmSchema.Model> {
81
+ /**
82
+ * Discriminant type.
83
+ */
84
+ type: Type;
85
+
86
+ /**
87
+ * Expected scenario.
88
+ */
89
+ scenario: IAgenticaCallBenchmarkScenario<Model>;
90
+
91
+ /**
92
+ * Prompt histories.
93
+ *
94
+ * List of prompts occurred during the benchmark testing.
95
+ */
96
+ prompts: AgenticaPrompt<Model>[];
97
+
98
+ /**
99
+ * Usage of the token during the benchmark.
100
+ */
101
+ usage: AgenticaTokenUsage;
102
+
103
+ /**
104
+ * When the benchmark testing started.
105
+ */
106
+ started_at: Date;
107
+
108
+ /**
109
+ * When the benchmark testing completed.
110
+ */
111
+ completed_at: Date;
112
+ }
113
+ }
@@ -1,70 +1,70 @@
1
- import { AgenticaTokenUsage } from "@agentica/core";
2
- import { ILlmSchema } from "@samchon/openapi";
3
-
4
- import { IAgenticaCallBenchmarkEvent } from "./IAgenticaCallBenchmarkEvent";
5
- import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
6
-
7
- /**
8
- * Result of the LLM function calling benchmark.
9
- *
10
- * `IAgenticaCallBenchmarkResult` is a structure representing the result
11
- * of the LLM function calling benchmark executed by the
12
- * {@link AgenticaCallBenchmark.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 IAgenticaCallBenchmarkResult<Model extends ILlmSchema.Model> {
25
- /**
26
- * Experiments for each scenario.
27
- */
28
- experiments: IAgenticaCallBenchmarkResult.IExperiment<Model>[];
29
-
30
- /**
31
- * Aggregated token usage information.
32
- */
33
- usage: AgenticaTokenUsage;
34
-
35
- /**
36
- * Start time of the benchmark.
37
- */
38
- started_at: Date;
39
-
40
- /**
41
- * End time of the benchmark.
42
- */
43
- completed_at: Date;
44
- }
45
- export namespace IAgenticaCallBenchmarkResult {
46
- /**
47
- * Experiment result about a scenario.
48
- */
49
- export interface IExperiment<Model extends ILlmSchema.Model> {
50
- /**
51
- * Scenario of the experiment.
52
- */
53
- scenario: IAgenticaCallBenchmarkScenario<Model>;
54
-
55
- /**
56
- * Events occurred during the benchmark in the scenario.
57
- *
58
- * When benchmarking a scenario, {@link AgenticaCallBenchmark} will
59
- * test a scenario multiple times with the given
60
- * {@link AgenticaCallBenchmark.IConfig.repeat repeat} count.
61
- * And the event is one of the repeated benchmark results.
62
- */
63
- events: IAgenticaCallBenchmarkEvent<Model>[];
64
-
65
- /**
66
- * LLM token usage information.
67
- */
68
- usage: AgenticaTokenUsage;
69
- }
70
- }
1
+ import { AgenticaTokenUsage } from "@agentica/core";
2
+ import { ILlmSchema } from "@samchon/openapi";
3
+
4
+ import { IAgenticaCallBenchmarkEvent } from "./IAgenticaCallBenchmarkEvent";
5
+ import { IAgenticaCallBenchmarkScenario } from "./IAgenticaCallBenchmarkScenario";
6
+
7
+ /**
8
+ * Result of the LLM function calling benchmark.
9
+ *
10
+ * `IAgenticaCallBenchmarkResult` is a structure representing the result
11
+ * of the LLM function calling benchmark executed by the
12
+ * {@link AgenticaCallBenchmark.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 IAgenticaCallBenchmarkResult<Model extends ILlmSchema.Model> {
25
+ /**
26
+ * Experiments for each scenario.
27
+ */
28
+ experiments: IAgenticaCallBenchmarkResult.IExperiment<Model>[];
29
+
30
+ /**
31
+ * Aggregated token usage information.
32
+ */
33
+ usage: AgenticaTokenUsage;
34
+
35
+ /**
36
+ * Start time of the benchmark.
37
+ */
38
+ started_at: Date;
39
+
40
+ /**
41
+ * End time of the benchmark.
42
+ */
43
+ completed_at: Date;
44
+ }
45
+ export namespace IAgenticaCallBenchmarkResult {
46
+ /**
47
+ * Experiment result about a scenario.
48
+ */
49
+ export interface IExperiment<Model extends ILlmSchema.Model> {
50
+ /**
51
+ * Scenario of the experiment.
52
+ */
53
+ scenario: IAgenticaCallBenchmarkScenario<Model>;
54
+
55
+ /**
56
+ * Events occurred during the benchmark in the scenario.
57
+ *
58
+ * When benchmarking a scenario, {@link AgenticaCallBenchmark} will
59
+ * test a scenario multiple times with the given
60
+ * {@link AgenticaCallBenchmark.IConfig.repeat repeat} count.
61
+ * And the event is one of the repeated benchmark results.
62
+ */
63
+ events: IAgenticaCallBenchmarkEvent<Model>[];
64
+
65
+ /**
66
+ * LLM token usage information.
67
+ */
68
+ usage: AgenticaTokenUsage;
69
+ }
70
+ }
@@ -1,43 +1,43 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
4
-
5
- /**
6
- * Scenario of function calling.
7
- *
8
- * `IAgenticaCallBenchmarkScenario` is a data structure which
9
- * represents a function calling 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 `caller` agent through the {@link text}
15
- * conversation.
16
- *
17
- * @author Samchon
18
- */
19
- export interface IAgenticaCallBenchmarkScenario<
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 calling sequence.
36
- *
37
- * Sequence of operations (API operation or class function) that
38
- * should be called by both `selector` and `caller` agents from
39
- * the user's {@link text} conversation for the LLM
40
- * (Large Language Model) function calling.
41
- */
42
- expected: IAgenticaBenchmarkExpected<Model>;
43
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { IAgenticaBenchmarkExpected } from "./IAgenticaBenchmarkExpected";
4
+
5
+ /**
6
+ * Scenario of function calling.
7
+ *
8
+ * `IAgenticaCallBenchmarkScenario` is a data structure which
9
+ * represents a function calling 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 `caller` agent through the {@link text}
15
+ * conversation.
16
+ *
17
+ * @author Samchon
18
+ */
19
+ export interface IAgenticaCallBenchmarkScenario<
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 calling sequence.
36
+ *
37
+ * Sequence of operations (API operation or class function) that
38
+ * should be called by both `selector` and `caller` agents from
39
+ * the user's {@link text} conversation for the LLM
40
+ * (Large Language Model) function calling.
41
+ */
42
+ expected: IAgenticaBenchmarkExpected<Model>;
43
+ }