@exulu/backend 1.30.2 → 1.30.4
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/CHANGELOG.md +2 -2
- package/dist/index.cjs +61 -45
- package/dist/index.js +61 -45
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## [1.30.
|
|
1
|
+
## [1.30.4](https://github.com/Qventu/exulu-backend/compare/v1.30.3...v1.30.4) (2025-11-04)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* log sdl ([30a2d34](https://github.com/Qventu/exulu-backend/commit/30a2d34bedc0e8939e68ba90697bc937e29a9034))
|
package/dist/index.cjs
CHANGED
|
@@ -4040,6 +4040,7 @@ type StatisticsResult {
|
|
|
4040
4040
|
}
|
|
4041
4041
|
`;
|
|
4042
4042
|
const fullSDL = typeDefs + mutationDefs + modelDefs + genericTypes;
|
|
4043
|
+
console.log("[EXULU] Full SDL:", fullSDL);
|
|
4043
4044
|
const schema = (0, import_schema.makeExecutableSchema)({
|
|
4044
4045
|
typeDefs: fullSDL,
|
|
4045
4046
|
resolvers
|
|
@@ -7795,7 +7796,8 @@ var ExuluQueues = class {
|
|
|
7795
7796
|
}
|
|
7796
7797
|
if (!redisServer.host?.length || !redisServer.port?.length) {
|
|
7797
7798
|
console.error(`[EXULU] no redis server configured, but you are trying to use a queue ( ${name}), likely in an agent or embedder (look for ExuluQueues.register().use() ).`);
|
|
7798
|
-
console.error(
|
|
7799
|
+
console.error("Stack trace:");
|
|
7800
|
+
console.trace();
|
|
7799
7801
|
throw new Error(`[EXULU] no redis server configured.`);
|
|
7800
7802
|
}
|
|
7801
7803
|
const newQueue = new import_bullmq5.Queue(
|
|
@@ -7835,50 +7837,64 @@ var queues = new ExuluQueues();
|
|
|
7835
7837
|
|
|
7836
7838
|
// src/templates/evals/index.ts
|
|
7837
7839
|
var import_zod3 = require("zod");
|
|
7838
|
-
var llmAsJudgeEval =
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7840
|
+
var llmAsJudgeEval = () => {
|
|
7841
|
+
if (process.env.REDIS_HOST?.length && process.env.REDIS_PORT?.length) {
|
|
7842
|
+
return new ExuluEval2({
|
|
7843
|
+
id: "llm_as_judge",
|
|
7844
|
+
name: "LLM as Judge",
|
|
7845
|
+
description: "Evaluate the output of the LLM as a judge.",
|
|
7846
|
+
execute: async ({ agent, backend, messages, testCase, config }) => {
|
|
7847
|
+
console.log("[EXULU] running llm as judge eval", { agent, backend, messages, testCase, config });
|
|
7848
|
+
let prompt = config?.prompt;
|
|
7849
|
+
if (!prompt) {
|
|
7850
|
+
console.error("[EXULU] prompt is required.");
|
|
7851
|
+
throw new Error("Prompt is required.");
|
|
7852
|
+
}
|
|
7853
|
+
const lastMessage = messages[messages.length - 1]?.parts?.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
7854
|
+
console.log("[EXULU] last message", lastMessage);
|
|
7855
|
+
if (!lastMessage) {
|
|
7856
|
+
return 0;
|
|
7857
|
+
}
|
|
7858
|
+
prompt = prompt.replace("{actual_output}", lastMessage);
|
|
7859
|
+
prompt = prompt.replace("{expected_output}", testCase.expected_output);
|
|
7860
|
+
if (!agent.providerapikey) {
|
|
7861
|
+
throw new Error(`Provider API key for agent ${agent.name} is required, variable name is ${agent.providerapikey} but it is not set.`);
|
|
7862
|
+
}
|
|
7863
|
+
const providerapikey = await ExuluVariables.get(agent.providerapikey);
|
|
7864
|
+
console.log("[EXULU] prompt", prompt);
|
|
7865
|
+
const response = await backend.generateSync({
|
|
7866
|
+
prompt,
|
|
7867
|
+
outputSchema: import_zod3.z.object({
|
|
7868
|
+
score: import_zod3.z.number().min(0).max(100).describe("The score between 0 and 100.")
|
|
7869
|
+
}),
|
|
7870
|
+
providerapikey
|
|
7871
|
+
});
|
|
7872
|
+
console.log("[EXULU] response", response);
|
|
7873
|
+
const score = parseFloat(response.score);
|
|
7874
|
+
if (isNaN(score)) {
|
|
7875
|
+
throw new Error(`Generated score from llm as a judge eval is not a number: ${response.score}`);
|
|
7876
|
+
}
|
|
7877
|
+
return score;
|
|
7878
|
+
},
|
|
7879
|
+
config: [{
|
|
7880
|
+
name: "prompt",
|
|
7881
|
+
description: "The prompt to send to the LLM as a judge, make sure to instruct the LLM to output a numerical score between 0 and 100. Add {actual_output} to the prompt to replace with the last message content, and {expected_output} to replace with the expected output."
|
|
7882
|
+
}],
|
|
7883
|
+
queue: queues.register("llm_as_judge", 1, 1).use(),
|
|
7884
|
+
llm: true
|
|
7867
7885
|
});
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
return
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
llm: true
|
|
7881
|
-
});
|
|
7886
|
+
}
|
|
7887
|
+
return void 0;
|
|
7888
|
+
};
|
|
7889
|
+
var getDefaultEvals = () => {
|
|
7890
|
+
if (process.env.REDIS_HOST?.length && process.env.REDIS_PORT?.length) {
|
|
7891
|
+
return [
|
|
7892
|
+
llmAsJudgeEval() ?? void 0
|
|
7893
|
+
].filter((x) => x !== void 0);
|
|
7894
|
+
}
|
|
7895
|
+
console.error("[EXULU] no redis server configured, skipping default evals as they require redis queues.");
|
|
7896
|
+
return [];
|
|
7897
|
+
};
|
|
7882
7898
|
|
|
7883
7899
|
// src/templates/tools/math.ts
|
|
7884
7900
|
var import_zod4 = require("zod");
|
|
@@ -8535,7 +8551,7 @@ var ExuluApp = class {
|
|
|
8535
8551
|
// initialize the MCP server if needed.
|
|
8536
8552
|
create = async ({ contexts, agents, config, tools, evals }) => {
|
|
8537
8553
|
this._evals = redisServer.host?.length && redisServer.port?.length ? [
|
|
8538
|
-
|
|
8554
|
+
...getDefaultEvals(),
|
|
8539
8555
|
...evals ?? []
|
|
8540
8556
|
] : [];
|
|
8541
8557
|
this._contexts = {
|
package/dist/index.js
CHANGED
|
@@ -3988,6 +3988,7 @@ type StatisticsResult {
|
|
|
3988
3988
|
}
|
|
3989
3989
|
`;
|
|
3990
3990
|
const fullSDL = typeDefs + mutationDefs + modelDefs + genericTypes;
|
|
3991
|
+
console.log("[EXULU] Full SDL:", fullSDL);
|
|
3991
3992
|
const schema = makeExecutableSchema({
|
|
3992
3993
|
typeDefs: fullSDL,
|
|
3993
3994
|
resolvers
|
|
@@ -7762,7 +7763,8 @@ var ExuluQueues = class {
|
|
|
7762
7763
|
}
|
|
7763
7764
|
if (!redisServer.host?.length || !redisServer.port?.length) {
|
|
7764
7765
|
console.error(`[EXULU] no redis server configured, but you are trying to use a queue ( ${name}), likely in an agent or embedder (look for ExuluQueues.register().use() ).`);
|
|
7765
|
-
console.error(
|
|
7766
|
+
console.error("Stack trace:");
|
|
7767
|
+
console.trace();
|
|
7766
7768
|
throw new Error(`[EXULU] no redis server configured.`);
|
|
7767
7769
|
}
|
|
7768
7770
|
const newQueue = new Queue3(
|
|
@@ -7802,50 +7804,64 @@ var queues = new ExuluQueues();
|
|
|
7802
7804
|
|
|
7803
7805
|
// src/templates/evals/index.ts
|
|
7804
7806
|
import { z as z3 } from "zod";
|
|
7805
|
-
var llmAsJudgeEval =
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7807
|
+
var llmAsJudgeEval = () => {
|
|
7808
|
+
if (process.env.REDIS_HOST?.length && process.env.REDIS_PORT?.length) {
|
|
7809
|
+
return new ExuluEval2({
|
|
7810
|
+
id: "llm_as_judge",
|
|
7811
|
+
name: "LLM as Judge",
|
|
7812
|
+
description: "Evaluate the output of the LLM as a judge.",
|
|
7813
|
+
execute: async ({ agent, backend, messages, testCase, config }) => {
|
|
7814
|
+
console.log("[EXULU] running llm as judge eval", { agent, backend, messages, testCase, config });
|
|
7815
|
+
let prompt = config?.prompt;
|
|
7816
|
+
if (!prompt) {
|
|
7817
|
+
console.error("[EXULU] prompt is required.");
|
|
7818
|
+
throw new Error("Prompt is required.");
|
|
7819
|
+
}
|
|
7820
|
+
const lastMessage = messages[messages.length - 1]?.parts?.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
7821
|
+
console.log("[EXULU] last message", lastMessage);
|
|
7822
|
+
if (!lastMessage) {
|
|
7823
|
+
return 0;
|
|
7824
|
+
}
|
|
7825
|
+
prompt = prompt.replace("{actual_output}", lastMessage);
|
|
7826
|
+
prompt = prompt.replace("{expected_output}", testCase.expected_output);
|
|
7827
|
+
if (!agent.providerapikey) {
|
|
7828
|
+
throw new Error(`Provider API key for agent ${agent.name} is required, variable name is ${agent.providerapikey} but it is not set.`);
|
|
7829
|
+
}
|
|
7830
|
+
const providerapikey = await ExuluVariables.get(agent.providerapikey);
|
|
7831
|
+
console.log("[EXULU] prompt", prompt);
|
|
7832
|
+
const response = await backend.generateSync({
|
|
7833
|
+
prompt,
|
|
7834
|
+
outputSchema: z3.object({
|
|
7835
|
+
score: z3.number().min(0).max(100).describe("The score between 0 and 100.")
|
|
7836
|
+
}),
|
|
7837
|
+
providerapikey
|
|
7838
|
+
});
|
|
7839
|
+
console.log("[EXULU] response", response);
|
|
7840
|
+
const score = parseFloat(response.score);
|
|
7841
|
+
if (isNaN(score)) {
|
|
7842
|
+
throw new Error(`Generated score from llm as a judge eval is not a number: ${response.score}`);
|
|
7843
|
+
}
|
|
7844
|
+
return score;
|
|
7845
|
+
},
|
|
7846
|
+
config: [{
|
|
7847
|
+
name: "prompt",
|
|
7848
|
+
description: "The prompt to send to the LLM as a judge, make sure to instruct the LLM to output a numerical score between 0 and 100. Add {actual_output} to the prompt to replace with the last message content, and {expected_output} to replace with the expected output."
|
|
7849
|
+
}],
|
|
7850
|
+
queue: queues.register("llm_as_judge", 1, 1).use(),
|
|
7851
|
+
llm: true
|
|
7834
7852
|
});
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
return
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
llm: true
|
|
7848
|
-
});
|
|
7853
|
+
}
|
|
7854
|
+
return void 0;
|
|
7855
|
+
};
|
|
7856
|
+
var getDefaultEvals = () => {
|
|
7857
|
+
if (process.env.REDIS_HOST?.length && process.env.REDIS_PORT?.length) {
|
|
7858
|
+
return [
|
|
7859
|
+
llmAsJudgeEval() ?? void 0
|
|
7860
|
+
].filter((x) => x !== void 0);
|
|
7861
|
+
}
|
|
7862
|
+
console.error("[EXULU] no redis server configured, skipping default evals as they require redis queues.");
|
|
7863
|
+
return [];
|
|
7864
|
+
};
|
|
7849
7865
|
|
|
7850
7866
|
// src/templates/tools/math.ts
|
|
7851
7867
|
import { z as z4 } from "zod";
|
|
@@ -8502,7 +8518,7 @@ var ExuluApp = class {
|
|
|
8502
8518
|
// initialize the MCP server if needed.
|
|
8503
8519
|
create = async ({ contexts, agents, config, tools, evals }) => {
|
|
8504
8520
|
this._evals = redisServer.host?.length && redisServer.port?.length ? [
|
|
8505
|
-
|
|
8521
|
+
...getDefaultEvals(),
|
|
8506
8522
|
...evals ?? []
|
|
8507
8523
|
] : [];
|
|
8508
8524
|
this._contexts = {
|