@axiom-lattice/gateway 3.0.4 → 3.0.6
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/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8269,6 +8269,7 @@ var EvalRunner = class {
|
|
|
8269
8269
|
input: { message: c.inputMessage, files: c.inputFiles },
|
|
8270
8270
|
steps: c.steps,
|
|
8271
8271
|
output: { type: "message_content" },
|
|
8272
|
+
interruptPolicy: c.interruptPolicy,
|
|
8272
8273
|
eval: {
|
|
8273
8274
|
content_assertion: c.contentAssertion,
|
|
8274
8275
|
eval_rubrics: c.rubrics?.map((r) => ({
|
|
@@ -8325,13 +8326,14 @@ var EvalRunner = class {
|
|
|
8325
8326
|
concurrency
|
|
8326
8327
|
};
|
|
8327
8328
|
const abortController = new AbortController();
|
|
8328
|
-
const stats = { passed: 0, failed: 0, totalScore: 0 };
|
|
8329
|
+
const stats = { passed: 0, failed: 0, interrupted: 0, totalScore: 0 };
|
|
8329
8330
|
const onCaseComplete = async (result, suiteName) => {
|
|
8330
8331
|
const passed = result.result?.pass ?? false;
|
|
8331
8332
|
const score = result.result?.final_score ?? 0;
|
|
8332
8333
|
if (passed) stats.passed++;
|
|
8333
8334
|
else stats.failed++;
|
|
8334
8335
|
stats.totalScore += score;
|
|
8336
|
+
if (result.interrupted) stats.interrupted++;
|
|
8335
8337
|
const completedCount = stats.passed + stats.failed;
|
|
8336
8338
|
await store2.createRunResult(tenantId, runId, (0, import_uuid4.v4)(), {
|
|
8337
8339
|
suiteName,
|
|
@@ -8347,18 +8349,20 @@ var EvalRunner = class {
|
|
|
8347
8349
|
durationMs: result.duration_ms,
|
|
8348
8350
|
messages: result.messages,
|
|
8349
8351
|
logs: mapLogs(result.logs),
|
|
8350
|
-
error: result.error
|
|
8352
|
+
error: result.error,
|
|
8353
|
+
interrupted: result.interrupted
|
|
8351
8354
|
});
|
|
8352
8355
|
const avgScore = completedCount > 0 ? stats.totalScore / completedCount : 0;
|
|
8353
8356
|
await store2.updateRunStatus(tenantId, runId, {
|
|
8354
8357
|
passedCases: stats.passed,
|
|
8355
8358
|
failedCases: stats.failed,
|
|
8359
|
+
interruptedCases: stats.interrupted,
|
|
8356
8360
|
avgScore
|
|
8357
8361
|
});
|
|
8358
8362
|
this.eventEmitter.emit(`run:${runId}`, {
|
|
8359
8363
|
type: "progress",
|
|
8360
8364
|
runId,
|
|
8361
|
-
data: { suiteName, caseId: result.caseId, pass: passed, score, completed: completedCount, total: totalCases }
|
|
8365
|
+
data: { suiteName, caseId: result.caseId, pass: passed, score, interrupted: result.interrupted ?? false, completed: completedCount, total: totalCases }
|
|
8362
8366
|
});
|
|
8363
8367
|
};
|
|
8364
8368
|
const runPromise = (async () => {
|
|
@@ -8384,6 +8388,7 @@ var EvalRunner = class {
|
|
|
8384
8388
|
completedAt: /* @__PURE__ */ new Date(),
|
|
8385
8389
|
passedCases: stats.passed,
|
|
8386
8390
|
failedCases: stats.failed,
|
|
8391
|
+
interruptedCases: stats.interrupted,
|
|
8387
8392
|
avgScore: completedCount > 0 ? stats.totalScore / completedCount : 0
|
|
8388
8393
|
});
|
|
8389
8394
|
this.eventEmitter.emit(`run:${runId}`, {
|
|
@@ -8457,6 +8462,13 @@ async function createProject(request, reply) {
|
|
|
8457
8462
|
const store2 = getEvalStore();
|
|
8458
8463
|
const id = (0, import_uuid5.v4)();
|
|
8459
8464
|
const data = request.body;
|
|
8465
|
+
const existing = await store2.getProjectsByTenant(tenantId);
|
|
8466
|
+
if (existing.some((p) => p.name === data.name)) {
|
|
8467
|
+
return reply.status(409).send({
|
|
8468
|
+
success: false,
|
|
8469
|
+
message: `Eval project with name "${data.name}" already exists`
|
|
8470
|
+
});
|
|
8471
|
+
}
|
|
8460
8472
|
const serverCfg = data.targetServerConfig || {};
|
|
8461
8473
|
const judgeCfg = data.judgeModelConfig || {};
|
|
8462
8474
|
const modelKey = judgeCfg.modelKey || "";
|
|
@@ -8488,6 +8500,14 @@ async function createProject(request, reply) {
|
|
|
8488
8500
|
});
|
|
8489
8501
|
} catch (err) {
|
|
8490
8502
|
const message = err instanceof Error ? err.message : "Failed to create project";
|
|
8503
|
+
const code = err.code;
|
|
8504
|
+
const isUniqueViolation = code === "23505" || typeof message === "string" && message.includes("UNIQUE constraint failed");
|
|
8505
|
+
if (isUniqueViolation) {
|
|
8506
|
+
return reply.status(409).send({
|
|
8507
|
+
success: false,
|
|
8508
|
+
message: `Eval project with name "${request.body.name}" already exists`
|
|
8509
|
+
});
|
|
8510
|
+
}
|
|
8491
8511
|
return reply.status(500).send({ success: false, message });
|
|
8492
8512
|
}
|
|
8493
8513
|
}
|
|
@@ -8685,7 +8705,8 @@ async function createCase(request, reply) {
|
|
|
8685
8705
|
steps: data.steps ?? [],
|
|
8686
8706
|
outputType: data.outputType ?? "message_content",
|
|
8687
8707
|
contentAssertion: data.contentAssertion ?? "",
|
|
8688
|
-
rubrics: data.rubrics
|
|
8708
|
+
rubrics: data.rubrics,
|
|
8709
|
+
interruptPolicy: data.interruptPolicy
|
|
8689
8710
|
});
|
|
8690
8711
|
return reply.status(201).send({
|
|
8691
8712
|
success: true,
|