@fonoster/autopilot 0.9.13 → 0.9.14

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.
@@ -38,6 +38,6 @@ function createTestTextSimilarity(evalsLanguageModel, systemPrompt) {
38
38
  ];
39
39
  const response = await llm.invoke(messages);
40
40
  const reply = response.content?.toString().trim().toLowerCase();
41
- return new Boolean(reply).valueOf();
41
+ return reply === "true" || reply === "yes";
42
42
  };
43
43
  }
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.evaluateToolCalls = evaluateToolCalls;
7
+ const moment_1 = __importDefault(require("moment"));
4
8
  function evaluateToolCalls(expectedTools, toolCalls) {
5
9
  const evaluations = [];
6
10
  let overallPassed = true;
@@ -33,6 +37,17 @@ function evaluateToolCalls(expectedTools, toolCalls) {
33
37
  const expectedParams = expectedTool.parameters || {};
34
38
  const actualParams = actualCall.args || {};
35
39
  for (const key of Object.keys(expectedParams)) {
40
+ if ((0, moment_1.default)(expectedParams[key], moment_1.default.ISO_8601, true).isValid()) {
41
+ actualParams[key] = (0, moment_1.default)(actualParams[key], moment_1.default.ISO_8601, true);
42
+ if (!actualParams[key].isValid()) {
43
+ toolPassed = false;
44
+ const paramMsg = `Expected parameter "${key}" to be a valid date, but got ${JSON.stringify(actualParams[key])}.`;
45
+ errorMessage = errorMessage
46
+ ? errorMessage + " " + paramMsg
47
+ : paramMsg;
48
+ }
49
+ continue;
50
+ }
36
51
  if (actualParams[key] !== expectedParams[key]) {
37
52
  toolPassed = false;
38
53
  const paramMsg = `Expected parameter "${key}" to have value ${JSON.stringify(expectedParams[key])}, but got ${JSON.stringify(actualParams[key])}.`;
@@ -37,7 +37,14 @@ function printEval(results) {
37
37
  "Tool Calls",
38
38
  "Passed"
39
39
  ],
40
- colWidths: [8, 25, 25, 25, 25, 8],
40
+ colWidths: [
41
+ 6, // Step
42
+ 28, // Human Input
43
+ 28, // Expected
44
+ 28, // AI Response
45
+ null, // Tool Calls - dynamic width
46
+ 8 // Passed
47
+ ],
41
48
  wordWrap: true
42
49
  });
43
50
  result.steps.forEach((step, index) => {
@@ -46,10 +53,22 @@ function printEval(results) {
46
53
  if (step.toolEvaluations && step.toolEvaluations.length > 0) {
47
54
  toolEvalText = step.toolEvaluations
48
55
  .map((toolEval) => {
49
- const params = JSON.stringify(toolEval.actualParameters || {});
50
- return `${toolEval.actualTool}(${params})`;
56
+ if (!Object.keys(toolEval.actualParameters || {}).length) {
57
+ return `${toolEval.actualTool}()`;
58
+ }
59
+ const params = JSON.stringify(toolEval.actualParameters || {}, null, 1)
60
+ .split("\n")
61
+ .map((line, index, arr) => {
62
+ if (index === 0)
63
+ return "";
64
+ if (index === arr.length - 1)
65
+ return "";
66
+ return " " + line.trim();
67
+ })
68
+ .join("\n");
69
+ return `${toolEval.actualTool}({${params}})`;
51
70
  })
52
- .join("\n");
71
+ .join("\n\n"); // Add extra line between multiple tool calls
53
72
  }
54
73
  table.push([
55
74
  index + 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "Voice AI for the Fonoster platform",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -33,11 +33,11 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-s3": "^3.712.0",
36
- "@fonoster/common": "^0.9.12",
36
+ "@fonoster/common": "^0.9.14",
37
37
  "@fonoster/logger": "^0.9.12",
38
- "@fonoster/sdk": "^0.9.13",
39
- "@fonoster/types": "^0.9.12",
40
- "@fonoster/voice": "^0.9.12",
38
+ "@fonoster/sdk": "^0.9.14",
39
+ "@fonoster/types": "^0.9.14",
40
+ "@fonoster/voice": "^0.9.14",
41
41
  "@langchain/community": "^0.3.29",
42
42
  "@langchain/core": "^0.3.39",
43
43
  "@langchain/groq": "^0.1.3",
@@ -57,5 +57,5 @@
57
57
  "devDependencies": {
58
58
  "typescript": "^5.5.4"
59
59
  },
60
- "gitHead": "233b3a9489beedabcebc668c78d6fe91f335f319"
60
+ "gitHead": "ba1b5e9898fafef1d3c4d3f1e72d3c2326fcec7b"
61
61
  }