@autobe/agent 0.26.0 → 0.28.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/lib/AutoBeAgent.d.ts +2 -1
- package/lib/AutoBeAgent.js +27 -7
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +2 -4
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -11
- package/lib/context/AutoBeContext.d.ts +4 -1
- package/lib/context/AutoBeTokenUsage.d.ts +1 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/assertSchemaModel.d.ts +1 -1
- package/lib/context/assertSchemaModel.js +4 -7
- package/lib/context/assertSchemaModel.js.map +1 -1
- package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
- package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
- package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
- package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
- package/lib/factory/createAutoBeContext.d.ts +2 -1
- package/lib/factory/createAutoBeContext.js +78 -27
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +24065 -12997
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +166 -87
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +639 -322
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +146 -76
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +17 -52
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +25 -22
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +7 -23
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +168 -4
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
- package/lib/orchestrate/facade/createAutoBeFacadeController.js +1308 -0
- package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
- package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
- package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
- package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +15 -8
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +874 -49
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +1858 -67
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +251 -133
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +257 -135
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +341 -227
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +761 -49
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +911 -50
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +207 -4
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +109 -2
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +5 -3
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +1904 -77
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +1858 -67
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +23 -23
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +391 -197
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1168 -591
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +1186 -600
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +6 -3
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +2 -1
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +362 -180
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +399 -199
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +133 -4
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +171 -7
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +132 -3
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +2 -1
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +134 -3
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +169 -4
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +257 -4
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +283 -4
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +141 -3
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/utils/TokenUsageComputer.d.ts +5 -0
- package/lib/utils/TokenUsageComputer.js +29 -0
- package/lib/utils/TokenUsageComputer.js.map +1 -0
- package/package.json +10 -10
- package/src/AutoBeAgent.ts +40 -6
- package/src/AutoBeMockAgent.ts +2 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +11 -11
- package/src/context/AutoBeContext.ts +8 -0
- package/src/context/AutoBeTokenUsage.ts +1 -1
- package/src/context/assertSchemaModel.ts +5 -8
- package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
- package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
- package/src/factory/createAutoBeContext.ts +96 -36
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +9 -10
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +15 -10
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +10 -11
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +19 -54
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +25 -22
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +8 -24
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +20 -3
- package/src/orchestrate/facade/createAutoBeFacadeController.ts +136 -0
- package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +17 -6
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +13 -2
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +13 -2
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +16 -11
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +16 -13
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +19 -15
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +13 -2
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +16 -2
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +13 -2
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +11 -2
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +24 -16
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +13 -2
- package/src/orchestrate/prisma/orchestratePrisma.ts +2 -1
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +15 -10
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -10
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +9 -11
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +2 -1
- package/src/orchestrate/realize/orchestrateRealize.ts +3 -2
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +15 -10
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +15 -10
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +14 -3
- package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +21 -6
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +13 -2
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +5 -1
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +1 -1
- package/src/orchestrate/test/orchestrateTest.ts +3 -2
- package/src/orchestrate/test/orchestrateTestCorrect.ts +14 -2
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +21 -3
- package/src/orchestrate/test/orchestrateTestScenario.ts +13 -2
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +13 -2
- package/src/orchestrate/test/orchestrateTestWrite.ts +13 -2
- package/src/utils/TokenUsageComputer.ts +35 -0
- package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
- package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
- package/lib/factory/createAutoBeApplication.js +0 -942
- package/lib/factory/createAutoBeApplication.js.map +0 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
- package/src/factory/createAutoBeApplication.ts +0 -123
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
- /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
- /package/lib/orchestrate/facade/{transformFacadeStateMessage.js → structures/transformFacadeStateMessage.js} +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
- /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
|
@@ -59,7 +59,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
59
59
|
const pointer: IPointer<IAutoBePrismaSchemaApplication.IProps | null> = {
|
|
60
60
|
value: null,
|
|
61
61
|
};
|
|
62
|
-
const { tokenUsage } = await ctx.conversate({
|
|
62
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
63
63
|
source: "prismaSchema",
|
|
64
64
|
histories: transformPrismaSchemaHistories({
|
|
65
65
|
analysis:
|
|
@@ -97,6 +97,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
namespace: props.component.namespace,
|
|
98
98
|
models: pointer.value.models,
|
|
99
99
|
},
|
|
100
|
+
metric,
|
|
100
101
|
tokenUsage,
|
|
101
102
|
completed: (props.completed.value += props.component.tables.length),
|
|
102
103
|
total: props.total,
|
|
@@ -13,9 +13,9 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
13
13
|
import { v7 } from "uuid";
|
|
14
14
|
|
|
15
15
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
16
|
-
import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
|
|
17
16
|
import { executeCachedBatch } from "../../utils/executeCachedBatch";
|
|
18
17
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
18
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
19
19
|
import { compileRealizeFiles } from "./internal/compileRealizeFiles";
|
|
20
20
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
21
21
|
import { orchestrateRealizeCorrect } from "./orchestrateRealizeCorrect";
|
|
@@ -189,13 +189,14 @@ export const orchestrateRealize =
|
|
|
189
189
|
return ctx.dispatch({
|
|
190
190
|
type: "realizeComplete",
|
|
191
191
|
id: v7(),
|
|
192
|
-
created_at: new Date().toISOString(),
|
|
193
192
|
functions: bucket.corrected,
|
|
194
193
|
authorizations,
|
|
195
194
|
controllers,
|
|
196
195
|
compiled: bucket.validate.result,
|
|
196
|
+
aggregates: ctx.getCurrentAggregates("realize"),
|
|
197
197
|
step: ctx.state().analyze?.step ?? 0,
|
|
198
198
|
elapsed: new Date().getTime() - start.getTime(),
|
|
199
|
+
created_at: new Date().toISOString(),
|
|
199
200
|
});
|
|
200
201
|
};
|
|
201
202
|
|
|
@@ -80,7 +80,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
80
80
|
{
|
|
81
81
|
value: null,
|
|
82
82
|
};
|
|
83
|
-
const { tokenUsage } = await ctx.conversate({
|
|
83
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
84
84
|
source: "realizeAuthorizationWrite",
|
|
85
85
|
histories: transformRealizeAuthorizationHistories(ctx, actor),
|
|
86
86
|
controller: createController({
|
|
@@ -129,6 +129,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
129
129
|
id: v7(),
|
|
130
130
|
created_at: new Date().toISOString(),
|
|
131
131
|
authorization: authorization,
|
|
132
|
+
metric,
|
|
132
133
|
tokenUsage,
|
|
133
134
|
completed: ++progress.completed,
|
|
134
135
|
total: progress.total,
|
|
@@ -149,7 +150,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
149
150
|
assertSchemaModel(props.model);
|
|
150
151
|
|
|
151
152
|
const application: ILlmApplication<Model> = collection[
|
|
152
|
-
props.model
|
|
153
|
+
props.model === "chatgpt"
|
|
154
|
+
? "chatgpt"
|
|
155
|
+
: props.model === "gemini"
|
|
156
|
+
? "gemini"
|
|
157
|
+
: "claude"
|
|
153
158
|
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
154
159
|
|
|
155
160
|
return {
|
|
@@ -164,17 +169,17 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
164
169
|
};
|
|
165
170
|
}
|
|
166
171
|
|
|
167
|
-
const claude = typia.llm.application<
|
|
168
|
-
IAutoBeRealizeAuthorizationApplication,
|
|
169
|
-
"claude"
|
|
170
|
-
>();
|
|
171
172
|
const collection = {
|
|
172
173
|
chatgpt: typia.llm.application<
|
|
173
174
|
IAutoBeRealizeAuthorizationApplication,
|
|
174
175
|
"chatgpt"
|
|
175
176
|
>(),
|
|
176
|
-
claude
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
claude: typia.llm.application<
|
|
178
|
+
IAutoBeRealizeAuthorizationApplication,
|
|
179
|
+
"claude"
|
|
180
|
+
>(),
|
|
181
|
+
gemini: typia.llm.application<
|
|
182
|
+
IAutoBeRealizeAuthorizationApplication,
|
|
183
|
+
"gemini"
|
|
184
|
+
>(),
|
|
180
185
|
};
|
|
@@ -76,7 +76,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
76
76
|
{
|
|
77
77
|
value: null,
|
|
78
78
|
};
|
|
79
|
-
const { tokenUsage } = await ctx.conversate({
|
|
79
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
80
80
|
source: "realizeAuthorizationCorrect",
|
|
81
81
|
histories: transformRealizeAuthorizationCorrectHistories(
|
|
82
82
|
ctx,
|
|
@@ -126,6 +126,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
126
126
|
created_at: new Date().toISOString(),
|
|
127
127
|
authorization: result,
|
|
128
128
|
result: compiled,
|
|
129
|
+
metric,
|
|
129
130
|
tokenUsage,
|
|
130
131
|
step: ctx.state().test?.step ?? 0,
|
|
131
132
|
});
|
|
@@ -146,7 +147,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
146
147
|
assertSchemaModel(props.model);
|
|
147
148
|
|
|
148
149
|
const application: ILlmApplication<Model> = collection[
|
|
149
|
-
props.model
|
|
150
|
+
props.model === "chatgpt"
|
|
151
|
+
? "chatgpt"
|
|
152
|
+
: props.model === "gemini"
|
|
153
|
+
? "gemini"
|
|
154
|
+
: "claude"
|
|
150
155
|
] satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
151
156
|
return {
|
|
152
157
|
protocol: "class",
|
|
@@ -160,17 +165,17 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
160
165
|
};
|
|
161
166
|
}
|
|
162
167
|
|
|
163
|
-
const claude = typia.llm.application<
|
|
164
|
-
IAutoBeRealizeAuthorizationCorrectApplication,
|
|
165
|
-
"claude"
|
|
166
|
-
>();
|
|
167
168
|
const collection = {
|
|
168
169
|
chatgpt: typia.llm.application<
|
|
169
170
|
IAutoBeRealizeAuthorizationCorrectApplication,
|
|
170
171
|
"chatgpt"
|
|
171
172
|
>(),
|
|
172
|
-
claude
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
claude: typia.llm.application<
|
|
174
|
+
IAutoBeRealizeAuthorizationCorrectApplication,
|
|
175
|
+
"claude"
|
|
176
|
+
>(),
|
|
177
|
+
gemini: typia.llm.application<
|
|
178
|
+
IAutoBeRealizeAuthorizationCorrectApplication,
|
|
179
|
+
"gemini"
|
|
180
|
+
>(),
|
|
176
181
|
};
|
|
@@ -214,7 +214,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
217
|
-
const { tokenUsage } = await ctx.conversate({
|
|
217
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
218
218
|
source: "realizeCorrect",
|
|
219
219
|
controller: createController({
|
|
220
220
|
model: ctx.model,
|
|
@@ -239,7 +239,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
239
239
|
When modifying, modify the entire code, but not the import statement.
|
|
240
240
|
|
|
241
241
|
Below is template code you wrote:
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
${getRealizeWriteCodeTemplate({
|
|
244
244
|
scenario: props.scenario,
|
|
245
245
|
schemas: ctx.state().interface!.document.components.schemas,
|
|
@@ -278,6 +278,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
278
278
|
id: v7(),
|
|
279
279
|
location: props.scenario.location,
|
|
280
280
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
281
|
+
metric,
|
|
281
282
|
tokenUsage,
|
|
282
283
|
completed: ++props.progress.completed,
|
|
283
284
|
total: props.progress.total,
|
|
@@ -313,7 +314,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
313
314
|
: result;
|
|
314
315
|
};
|
|
315
316
|
const application: ILlmApplication<Model> = collection[
|
|
316
|
-
props.model === "chatgpt"
|
|
317
|
+
props.model === "chatgpt"
|
|
318
|
+
? "chatgpt"
|
|
319
|
+
: props.model === "gemini"
|
|
320
|
+
? "gemini"
|
|
321
|
+
: "claude"
|
|
317
322
|
](
|
|
318
323
|
validate,
|
|
319
324
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -343,6 +348,12 @@ const collection = {
|
|
|
343
348
|
correct: validate,
|
|
344
349
|
},
|
|
345
350
|
}),
|
|
351
|
+
gemini: (validate: Validator) =>
|
|
352
|
+
typia.llm.application<IAutoBeRealizeCorrectApplication, "gemini">({
|
|
353
|
+
validate: {
|
|
354
|
+
correct: validate,
|
|
355
|
+
},
|
|
356
|
+
}),
|
|
346
357
|
};
|
|
347
358
|
|
|
348
359
|
type Validator = (
|
|
@@ -133,7 +133,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
133
133
|
> = {
|
|
134
134
|
value: null,
|
|
135
135
|
};
|
|
136
|
-
const { tokenUsage } = await ctx.conversate({
|
|
136
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
137
137
|
source: "realizeCorrect",
|
|
138
138
|
histories: transformRealizeCorrectCastingHistories({
|
|
139
139
|
failures: [
|
|
@@ -165,13 +165,13 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
165
165
|
message: StringUtil.trim`
|
|
166
166
|
Fix the TypeScript casting problems to resolve the compilation error.
|
|
167
167
|
|
|
168
|
-
Most casting errors are caused by type mismatches between Date types and
|
|
168
|
+
Most casting errors are caused by type mismatches between Date types and
|
|
169
169
|
string & tags.Format<'date-time'>. To fix these:
|
|
170
170
|
- Use ONLY the pre-provided toISOStringSafe() function to convert Date to string
|
|
171
171
|
- Do NOT use .toISOString() method directly (use toISOStringSafe instead)
|
|
172
172
|
- Never use Date type directly in declarations or return values
|
|
173
173
|
|
|
174
|
-
You don't need to explain me anything, but just fix or give it up
|
|
174
|
+
You don't need to explain me anything, but just fix or give it up
|
|
175
175
|
immediately without any hesitation, explanation, and questions.
|
|
176
176
|
|
|
177
177
|
The instruction to write at first was as follows, and the code you received is the code you wrote according to this instruction.
|
|
@@ -195,10 +195,10 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
195
195
|
Also, never use typia.assert and typia.assertGuard like functions
|
|
196
196
|
to the Prisma types. Your mission is to fix the casting problem of
|
|
197
197
|
primitive types like string or number. Prisma type is not your scope.
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
If you take a mistake that casting the Prisma type with the typia.assert
|
|
200
200
|
function, it would be fallen into the infinite compilation due to extremely
|
|
201
|
-
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
201
|
+
complicated Prisma type. Note that, the typia.assert function is allowed
|
|
202
202
|
only in the individual property level string or literal type.
|
|
203
203
|
|
|
204
204
|
I repeat that, never assert the Prisma type. It's not your mission.
|
|
@@ -233,6 +233,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
233
233
|
created_at: new Date().toISOString(),
|
|
234
234
|
location: func.location,
|
|
235
235
|
step: ctx.state().analyze?.step ?? 0,
|
|
236
|
+
metric,
|
|
236
237
|
tokenUsage,
|
|
237
238
|
completed: props.progress.completed,
|
|
238
239
|
total: props.progress.total,
|
|
@@ -404,7 +405,11 @@ const createController = <Model extends ILlmSchema.Model>(props: {
|
|
|
404
405
|
: result;
|
|
405
406
|
};
|
|
406
407
|
const application = collection[
|
|
407
|
-
props.model === "chatgpt"
|
|
408
|
+
props.model === "chatgpt"
|
|
409
|
+
? "chatgpt"
|
|
410
|
+
: props.model === "gemini"
|
|
411
|
+
? "gemini"
|
|
412
|
+
: "claude"
|
|
408
413
|
](validate) satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
|
|
409
414
|
return {
|
|
410
415
|
protocol: "class",
|
|
@@ -442,6 +447,16 @@ const collection = {
|
|
|
442
447
|
}),
|
|
443
448
|
},
|
|
444
449
|
}),
|
|
450
|
+
gemini: (validate: Validator) =>
|
|
451
|
+
typia.llm.application<IAutoBeCommonCorrectCastingApplication, "gemini">({
|
|
452
|
+
validate: {
|
|
453
|
+
rewrite: validate,
|
|
454
|
+
reject: () => ({
|
|
455
|
+
success: true,
|
|
456
|
+
data: undefined,
|
|
457
|
+
}),
|
|
458
|
+
},
|
|
459
|
+
}),
|
|
445
460
|
};
|
|
446
461
|
|
|
447
462
|
type Validator = (
|
|
@@ -40,7 +40,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const dto = await getRealizeWriteDto(ctx, props.scenario.operation);
|
|
43
|
-
const { tokenUsage } = await ctx.conversate({
|
|
43
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
44
44
|
source: "realizeWrite",
|
|
45
45
|
histories: transformRealizeWriteHistories({
|
|
46
46
|
state: ctx.state(),
|
|
@@ -97,6 +97,7 @@ export async function orchestrateRealizeWrite<Model extends ILlmSchema.Model>(
|
|
|
97
97
|
id: v7(),
|
|
98
98
|
location: props.scenario.location,
|
|
99
99
|
content: pointer.value.revise.final ?? pointer.value.draft,
|
|
100
|
+
metric,
|
|
100
101
|
tokenUsage,
|
|
101
102
|
completed: ++props.progress.completed,
|
|
102
103
|
total: props.progress.total,
|
|
@@ -132,7 +133,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
132
133
|
: result;
|
|
133
134
|
};
|
|
134
135
|
const application: ILlmApplication<Model> = collection[
|
|
135
|
-
props.model === "chatgpt"
|
|
136
|
+
props.model === "chatgpt"
|
|
137
|
+
? "chatgpt"
|
|
138
|
+
: props.model === "gemini"
|
|
139
|
+
? "gemini"
|
|
140
|
+
: "claude"
|
|
136
141
|
](
|
|
137
142
|
validate,
|
|
138
143
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -162,6 +167,12 @@ const collection = {
|
|
|
162
167
|
write: validate,
|
|
163
168
|
},
|
|
164
169
|
}),
|
|
170
|
+
gemini: (validate: Validator) =>
|
|
171
|
+
typia.llm.application<IAutoBeRealizeWriteApplication, "gemini">({
|
|
172
|
+
validate: {
|
|
173
|
+
write: validate,
|
|
174
|
+
},
|
|
175
|
+
}),
|
|
165
176
|
};
|
|
166
177
|
|
|
167
178
|
type Validator = (
|
|
@@ -4,96 +4,6 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
4
4
|
import { AutoBeContext } from "../../../context/AutoBeContext";
|
|
5
5
|
import { getRealizeWriteImportStatements } from "./getRealizeWriteImportStatements";
|
|
6
6
|
|
|
7
|
-
// /**
|
|
8
|
-
// * Removes all import statements that LLM might have incorrectly added. This
|
|
9
|
-
// * includes standard library imports, auto-injected imports, and any API
|
|
10
|
-
// * structure imports with wrong paths.
|
|
11
|
-
// *
|
|
12
|
-
// * @param code - The code containing imports to remove
|
|
13
|
-
// * @param typeReferences - List of type names to specifically remove
|
|
14
|
-
// * @param decoratorType - Optional decorator type to remove
|
|
15
|
-
// * @returns Code with all imports removed
|
|
16
|
-
// */
|
|
17
|
-
// function removeAllImports(
|
|
18
|
-
// code: string,
|
|
19
|
-
// typeReferences: string[],
|
|
20
|
-
// decoratorType?: string,
|
|
21
|
-
// ): string {
|
|
22
|
-
// // Remove standard library and auto-injected imports
|
|
23
|
-
// let cleanedCode = code
|
|
24
|
-
// // MyGlobal - often with wrong path
|
|
25
|
-
// .replace(
|
|
26
|
-
// /import\s*{\s*MyGlobal\s*}\s*from\s*["']\.\.\/MyGlobal["']\s*;?\s*/gm,
|
|
27
|
-
// "",
|
|
28
|
-
// )
|
|
29
|
-
// // typia - various import patterns
|
|
30
|
-
// .replace(
|
|
31
|
-
// /import\s+typia\s*,\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
32
|
-
// "",
|
|
33
|
-
// )
|
|
34
|
-
// .replace(/import\s*{\s*tags\s*}\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
35
|
-
// .replace(
|
|
36
|
-
// /import\s*{\s*tags\s*,\s*typia\s*}\s*from\s*["']typia["']\s*;?\s*/gm,
|
|
37
|
-
// "",
|
|
38
|
-
// )
|
|
39
|
-
// .replace(/import\s+typia\s*from\s*["']typia["']\s*;?\s*/gm, "")
|
|
40
|
-
// // Prisma client
|
|
41
|
-
// .replace(
|
|
42
|
-
// /import\s*{\s*Prisma\s*}\s*from\s*["']@prisma\/client["']\s*;?\s*/gm,
|
|
43
|
-
// "",
|
|
44
|
-
// )
|
|
45
|
-
// // uuid
|
|
46
|
-
// .replace(/import\s*{\s*v4\s*}\s*from\s*["']uuid["']\s*;?\s*/gm, "")
|
|
47
|
-
// // toISOStringSafe utility
|
|
48
|
-
// .replace(
|
|
49
|
-
// /import\s*{\s*toISOStringSafe\s*}\s*from\s*["']\.\.\/utils\/toISOStringSafe["']\s*;?\s*/gm,
|
|
50
|
-
// "",
|
|
51
|
-
// )
|
|
52
|
-
// // JWT imports (if LLM adds them)
|
|
53
|
-
// .replace(/import\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm, "")
|
|
54
|
-
// .replace(
|
|
55
|
-
// /import\s*\*\s*as\s+jwt\s+from\s*["']jsonwebtoken["']\s*;?\s*/gm,
|
|
56
|
-
// "",
|
|
57
|
-
// )
|
|
58
|
-
// // NestJS HttpException
|
|
59
|
-
// .replace(
|
|
60
|
-
// /import\s*{\s*HttpException\s*}\s*from\s*["']@nestjs\/common["']\s*;?\s*/gm,
|
|
61
|
-
// "",
|
|
62
|
-
// );
|
|
63
|
-
|
|
64
|
-
// // Remove API structure imports with wrong paths
|
|
65
|
-
// // Pattern 1: ../api/structures path (LLM often uses this wrong path)
|
|
66
|
-
// cleanedCode = cleanedCode.replace(
|
|
67
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']\.\.\/api\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
68
|
-
// "",
|
|
69
|
-
// );
|
|
70
|
-
// // Pattern 2: @ORGANIZATION/PROJECT-api path (correct path but LLM shouldn't write it)
|
|
71
|
-
// cleanedCode = cleanedCode.replace(
|
|
72
|
-
// /import\s*(?:type\s*)?{\s*[^}]+\s*}\s*from\s*["']@ORGANIZATION\/PROJECT-api\/lib\/structures\/[^"']+["']\s*;?\s*/gm,
|
|
73
|
-
// "",
|
|
74
|
-
// );
|
|
75
|
-
|
|
76
|
-
// // Remove specific type imports that match our typeReferences
|
|
77
|
-
// for (const ref of typeReferences) {
|
|
78
|
-
// const typeImportRegex = new RegExp(
|
|
79
|
-
// `import\\s*(?:type\\s*)?{\\s*${ref}\\s*}\\s*from\\s*["'][^"']+["']\\s*;?\\s*`,
|
|
80
|
-
// "gm",
|
|
81
|
-
// );
|
|
82
|
-
// cleanedCode = cleanedCode.replace(typeImportRegex, "");
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
// // Remove decorator type imports if LLM mistakenly added them
|
|
86
|
-
// if (decoratorType) {
|
|
87
|
-
// const decoratorTypeRegex = new RegExp(
|
|
88
|
-
// `import\\s*(?:type\\s*)?{\\s*${decoratorType}\\s*}\\s*from\\s*["']\\.\\.\/decorators\/payload\/${decoratorType}["']\\s*;?\\s*`,
|
|
89
|
-
// "gm",
|
|
90
|
-
// );
|
|
91
|
-
// cleanedCode = cleanedCode.replace(decoratorTypeRegex, "");
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
|
-
// return cleanedCode;
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
7
|
export async function replaceImportStatements<Model extends ILlmSchema.Model>(
|
|
98
8
|
ctx: AutoBeContext<Model>,
|
|
99
9
|
props: {
|
|
@@ -247,7 +247,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
249
|
const application: ILlmApplication<Model> = collection[
|
|
250
|
-
props.model === "chatgpt"
|
|
250
|
+
props.model === "chatgpt"
|
|
251
|
+
? "chatgpt"
|
|
252
|
+
: props.model === "gemini"
|
|
253
|
+
? "gemini"
|
|
254
|
+
: "claude"
|
|
251
255
|
](
|
|
252
256
|
validate,
|
|
253
257
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -167,6 +167,6 @@ export namespace transformTestWriteHistories {
|
|
|
167
167
|
const systemPrompt = new Singleton(() =>
|
|
168
168
|
AutoBeSystemPromptConstant.TEST_WRITE.replace(
|
|
169
169
|
"{{AutoBeTestScenario}}",
|
|
170
|
-
JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "
|
|
170
|
+
JSON.stringify(typia.llm.parameters<AutoBeTestScenario, "claude">()),
|
|
171
171
|
),
|
|
172
172
|
);
|
|
@@ -11,8 +11,8 @@ import { ILlmSchema } from "@samchon/openapi";
|
|
|
11
11
|
import { v7 } from "uuid";
|
|
12
12
|
|
|
13
13
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
14
|
-
import { IAutoBeFacadeApplicationProps } from "../../context/IAutoBeFacadeApplicationProps";
|
|
15
14
|
import { predicateStateMessage } from "../../utils/predicateStateMessage";
|
|
15
|
+
import { IAutoBeFacadeApplicationProps } from "../facade/histories/IAutoBeFacadeApplicationProps";
|
|
16
16
|
import { orchestrateTestCorrect } from "./orchestrateTestCorrect";
|
|
17
17
|
import { orchestrateTestScenario } from "./orchestrateTestScenario";
|
|
18
18
|
import { orchestrateTestWrite } from "./orchestrateTestWrite";
|
|
@@ -101,10 +101,11 @@ export const orchestrateTest =
|
|
|
101
101
|
return ctx.dispatch({
|
|
102
102
|
type: "testComplete",
|
|
103
103
|
id: v7(),
|
|
104
|
-
created_at: new Date().toISOString(),
|
|
105
104
|
files: corrects.map((s) => s.file),
|
|
106
105
|
compiled: compileResult,
|
|
106
|
+
aggregates: ctx.getCurrentAggregates("test"),
|
|
107
107
|
step: ctx.state().interface?.step ?? 0,
|
|
108
108
|
elapsed: new Date().getTime() - start.getTime(),
|
|
109
|
+
created_at: new Date().toISOString(),
|
|
109
110
|
});
|
|
110
111
|
};
|
|
@@ -61,6 +61,7 @@ export const orchestrateTestCorrect = async <Model extends ILlmSchema.Model>(
|
|
|
61
61
|
},
|
|
62
62
|
result: next.failure,
|
|
63
63
|
tokenUsage: next.tokenUsage,
|
|
64
|
+
metric: next.metric,
|
|
64
65
|
think: next.think,
|
|
65
66
|
draft: next.draft,
|
|
66
67
|
review: next.review,
|
|
@@ -151,7 +152,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
151
152
|
const pointer: IPointer<IAutoBeTestCorrectApplication.IProps | null> = {
|
|
152
153
|
value: null,
|
|
153
154
|
};
|
|
154
|
-
const { tokenUsage } = await ctx.conversate({
|
|
155
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
155
156
|
source: "testCorrect",
|
|
156
157
|
histories: await transformTestCorrectHistories(ctx, {
|
|
157
158
|
instruction: props.instruction,
|
|
@@ -202,6 +203,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
202
203
|
created_at: new Date().toISOString(),
|
|
203
204
|
file: props.validate.file,
|
|
204
205
|
result: props.validate.result,
|
|
206
|
+
metric,
|
|
205
207
|
tokenUsage,
|
|
206
208
|
step: ctx.state().analyze?.step ?? 0,
|
|
207
209
|
think: pointer.value.think,
|
|
@@ -264,7 +266,11 @@ const createController = <Model extends ILlmSchema.Model>(props: {
|
|
|
264
266
|
: result;
|
|
265
267
|
};
|
|
266
268
|
const application: ILlmApplication<Model> = collection[
|
|
267
|
-
props.model === "chatgpt"
|
|
269
|
+
props.model === "chatgpt"
|
|
270
|
+
? "chatgpt"
|
|
271
|
+
: props.model === "gemini"
|
|
272
|
+
? "gemini"
|
|
273
|
+
: "claude"
|
|
268
274
|
](
|
|
269
275
|
validate,
|
|
270
276
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -293,6 +299,12 @@ const collection = {
|
|
|
293
299
|
rewrite: validate,
|
|
294
300
|
},
|
|
295
301
|
}),
|
|
302
|
+
gemini: (validate: Validator) =>
|
|
303
|
+
typia.llm.application<IAutoBeTestCorrectApplication, "gemini">({
|
|
304
|
+
validate: {
|
|
305
|
+
rewrite: validate,
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
296
308
|
};
|
|
297
309
|
|
|
298
310
|
type Validator = (
|
|
@@ -63,7 +63,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
63
63
|
> = {
|
|
64
64
|
value: null,
|
|
65
65
|
};
|
|
66
|
-
const { tokenUsage } = await ctx.conversate({
|
|
66
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
67
67
|
source: "testCorrect",
|
|
68
68
|
histories: await transformTestCorrectInvalidRequestHistories(
|
|
69
69
|
null!,
|
|
@@ -83,7 +83,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
83
83
|
message: StringUtil.trim`
|
|
84
84
|
Fix the AutoBeTest.IFunction data to resolve the compilation error.
|
|
85
85
|
|
|
86
|
-
You don't need to explain me anything, but just fix or give it up
|
|
86
|
+
You don't need to explain me anything, but just fix or give it up
|
|
87
87
|
immediately without any hesitation, explanation, and questions.
|
|
88
88
|
`,
|
|
89
89
|
});
|
|
@@ -112,6 +112,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
112
112
|
content: write.script,
|
|
113
113
|
},
|
|
114
114
|
result: event.result,
|
|
115
|
+
metric,
|
|
115
116
|
tokenUsage,
|
|
116
117
|
step: ctx.state().analyze?.step ?? 0,
|
|
117
118
|
think: pointer.value.think,
|
|
@@ -154,7 +155,11 @@ const createController = <Model extends ILlmSchema.Model>(props: {
|
|
|
154
155
|
: result;
|
|
155
156
|
};
|
|
156
157
|
const application = collection[
|
|
157
|
-
props.model === "chatgpt"
|
|
158
|
+
props.model === "chatgpt"
|
|
159
|
+
? "chatgpt"
|
|
160
|
+
: props.model === "gemini"
|
|
161
|
+
? "gemini"
|
|
162
|
+
: "claude"
|
|
158
163
|
](validate) satisfies ILlmApplication<any> as any as ILlmApplication<Model>;
|
|
159
164
|
return {
|
|
160
165
|
protocol: "class",
|
|
@@ -198,6 +203,19 @@ const collection = {
|
|
|
198
203
|
}),
|
|
199
204
|
},
|
|
200
205
|
}),
|
|
206
|
+
gemini: (validate: Validator) =>
|
|
207
|
+
typia.llm.application<
|
|
208
|
+
IAutoBeTestCorrectInvalidRequestApplication,
|
|
209
|
+
"gemini"
|
|
210
|
+
>({
|
|
211
|
+
validate: {
|
|
212
|
+
rewrite: validate,
|
|
213
|
+
reject: () => ({
|
|
214
|
+
success: true,
|
|
215
|
+
data: undefined,
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
201
219
|
};
|
|
202
220
|
|
|
203
221
|
type Validator = (
|
|
@@ -147,7 +147,7 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
|
147
147
|
ctx.state().interface?.authorizations ?? [];
|
|
148
148
|
|
|
149
149
|
try {
|
|
150
|
-
const { tokenUsage } = await ctx.conversate({
|
|
150
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
151
151
|
source: "testScenario",
|
|
152
152
|
histories: transformTestScenarioHistories({
|
|
153
153
|
state: ctx.state(),
|
|
@@ -184,6 +184,7 @@ const divideAndConquer = async <Model extends ILlmSchema.Model>(
|
|
|
184
184
|
ctx.dispatch({
|
|
185
185
|
type: "testScenario",
|
|
186
186
|
id: v7(),
|
|
187
|
+
metric,
|
|
187
188
|
tokenUsage,
|
|
188
189
|
scenarios: pointer.value
|
|
189
190
|
.map((v) =>
|
|
@@ -390,7 +391,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
390
391
|
};
|
|
391
392
|
};
|
|
392
393
|
const application: ILlmApplication<Model> = collection[
|
|
393
|
-
props.model === "chatgpt"
|
|
394
|
+
props.model === "chatgpt"
|
|
395
|
+
? "chatgpt"
|
|
396
|
+
: props.model === "gemini"
|
|
397
|
+
? "gemini"
|
|
398
|
+
: "claude"
|
|
394
399
|
](
|
|
395
400
|
validate,
|
|
396
401
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -430,6 +435,12 @@ const collection = {
|
|
|
430
435
|
makeScenario: validate,
|
|
431
436
|
},
|
|
432
437
|
}),
|
|
438
|
+
gemini: (validate: Validator) =>
|
|
439
|
+
typia.llm.application<IAutoBeTestScenarioApplication, "gemini">({
|
|
440
|
+
validate: {
|
|
441
|
+
makeScenario: validate,
|
|
442
|
+
},
|
|
443
|
+
}),
|
|
433
444
|
};
|
|
434
445
|
|
|
435
446
|
type Validator = (
|
|
@@ -42,7 +42,7 @@ async function review<Model extends ILlmSchema.Model>(
|
|
|
42
42
|
{
|
|
43
43
|
value: null,
|
|
44
44
|
};
|
|
45
|
-
const { tokenUsage } = await ctx.conversate({
|
|
45
|
+
const { metric, tokenUsage } = await ctx.conversate({
|
|
46
46
|
source: "testScenarioReview",
|
|
47
47
|
controller: createController({
|
|
48
48
|
model: ctx.model,
|
|
@@ -70,6 +70,7 @@ async function review<Model extends ILlmSchema.Model>(
|
|
|
70
70
|
ctx.dispatch({
|
|
71
71
|
type: "testScenarioReview",
|
|
72
72
|
id: v7(),
|
|
73
|
+
metric,
|
|
73
74
|
tokenUsage,
|
|
74
75
|
total: props.progress.total,
|
|
75
76
|
completed: props.progress.completed,
|
|
@@ -150,7 +151,11 @@ function createController<Model extends ILlmSchema.Model>(props: {
|
|
|
150
151
|
};
|
|
151
152
|
|
|
152
153
|
const application: ILlmApplication<Model> = collection[
|
|
153
|
-
props.model === "chatgpt"
|
|
154
|
+
props.model === "chatgpt"
|
|
155
|
+
? "chatgpt"
|
|
156
|
+
: props.model === "gemini"
|
|
157
|
+
? "gemini"
|
|
158
|
+
: "claude"
|
|
154
159
|
](
|
|
155
160
|
validate,
|
|
156
161
|
) satisfies ILlmApplication<any> as unknown as ILlmApplication<Model>;
|
|
@@ -191,6 +196,12 @@ const collection = {
|
|
|
191
196
|
review: validate,
|
|
192
197
|
},
|
|
193
198
|
}),
|
|
199
|
+
gemini: (validate: Validator) =>
|
|
200
|
+
typia.llm.application<IAutoBeTestScenarioReviewApplication, "gemini">({
|
|
201
|
+
validate: {
|
|
202
|
+
review: validate,
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
194
205
|
};
|
|
195
206
|
|
|
196
207
|
type Validator = (
|