@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 CHANGED
@@ -1,6 +1,6 @@
1
- ## [1.30.2](https://github.com/Qventu/exulu-backend/compare/v1.30.1...v1.30.2) (2025-11-04)
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
- * add stack log to queue error ([22372bd](https://github.com/Qventu/exulu-backend/commit/22372bd103acaf8346301f9bd7fa3b8ce843b432))
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(new Error().stack);
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 = new ExuluEval2({
7839
- id: "llm_as_judge",
7840
- name: "LLM as Judge",
7841
- description: "Evaluate the output of the LLM as a judge.",
7842
- execute: async ({ agent, backend, messages, testCase, config }) => {
7843
- console.log("[EXULU] running llm as judge eval", { agent, backend, messages, testCase, config });
7844
- let prompt = config?.prompt;
7845
- if (!prompt) {
7846
- console.error("[EXULU] prompt is required.");
7847
- throw new Error("Prompt is required.");
7848
- }
7849
- const lastMessage = messages[messages.length - 1]?.parts?.filter((part) => part.type === "text").map((part) => part.text).join("\n");
7850
- console.log("[EXULU] last message", lastMessage);
7851
- if (!lastMessage) {
7852
- return 0;
7853
- }
7854
- prompt = prompt.replace("{actual_output}", lastMessage);
7855
- prompt = prompt.replace("{expected_output}", testCase.expected_output);
7856
- if (!agent.providerapikey) {
7857
- throw new Error(`Provider API key for agent ${agent.name} is required, variable name is ${agent.providerapikey} but it is not set.`);
7858
- }
7859
- const providerapikey = await ExuluVariables.get(agent.providerapikey);
7860
- console.log("[EXULU] prompt", prompt);
7861
- const response = await backend.generateSync({
7862
- prompt,
7863
- outputSchema: import_zod3.z.object({
7864
- score: import_zod3.z.number().min(0).max(100).describe("The score between 0 and 100.")
7865
- }),
7866
- providerapikey
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
- console.log("[EXULU] response", response);
7869
- const score = parseFloat(response.score);
7870
- if (isNaN(score)) {
7871
- throw new Error(`Generated score from llm as a judge eval is not a number: ${response.score}`);
7872
- }
7873
- return score;
7874
- },
7875
- config: [{
7876
- name: "prompt",
7877
- 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."
7878
- }],
7879
- queue: queues.register("llm_as_judge", 1, 1).use(),
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
- llmAsJudgeEval,
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(new Error().stack);
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 = new ExuluEval2({
7806
- id: "llm_as_judge",
7807
- name: "LLM as Judge",
7808
- description: "Evaluate the output of the LLM as a judge.",
7809
- execute: async ({ agent, backend, messages, testCase, config }) => {
7810
- console.log("[EXULU] running llm as judge eval", { agent, backend, messages, testCase, config });
7811
- let prompt = config?.prompt;
7812
- if (!prompt) {
7813
- console.error("[EXULU] prompt is required.");
7814
- throw new Error("Prompt is required.");
7815
- }
7816
- const lastMessage = messages[messages.length - 1]?.parts?.filter((part) => part.type === "text").map((part) => part.text).join("\n");
7817
- console.log("[EXULU] last message", lastMessage);
7818
- if (!lastMessage) {
7819
- return 0;
7820
- }
7821
- prompt = prompt.replace("{actual_output}", lastMessage);
7822
- prompt = prompt.replace("{expected_output}", testCase.expected_output);
7823
- if (!agent.providerapikey) {
7824
- throw new Error(`Provider API key for agent ${agent.name} is required, variable name is ${agent.providerapikey} but it is not set.`);
7825
- }
7826
- const providerapikey = await ExuluVariables.get(agent.providerapikey);
7827
- console.log("[EXULU] prompt", prompt);
7828
- const response = await backend.generateSync({
7829
- prompt,
7830
- outputSchema: z3.object({
7831
- score: z3.number().min(0).max(100).describe("The score between 0 and 100.")
7832
- }),
7833
- providerapikey
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
- console.log("[EXULU] response", response);
7836
- const score = parseFloat(response.score);
7837
- if (isNaN(score)) {
7838
- throw new Error(`Generated score from llm as a judge eval is not a number: ${response.score}`);
7839
- }
7840
- return score;
7841
- },
7842
- config: [{
7843
- name: "prompt",
7844
- 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."
7845
- }],
7846
- queue: queues.register("llm_as_judge", 1, 1).use(),
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
- llmAsJudgeEval,
8521
+ ...getDefaultEvals(),
8506
8522
  ...evals ?? []
8507
8523
  ] : [];
8508
8524
  this._contexts = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu Bv.",
4
- "version": "1.30.2",
4
+ "version": "1.30.4",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {