@botbotgo/better-call 0.1.31 → 0.1.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/demo.mjs +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/better-call",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Small-model tool-call reliability layer for LangChain and custom agent runtimes.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/scripts/demo.mjs CHANGED
@@ -37,7 +37,7 @@ const stockQuote = {
37
37
  },
38
38
  };
39
39
 
40
- const invalidArgs = { symbol: "Apple", market: "NASDAQ" };
40
+ const mismatchedArgs = { symbol: "Apple", market: "NASDAQ" };
41
41
 
42
42
  const wrappedTools = betterTools([stockQuote], {
43
43
  userInput: "Get Apple stock in the US market.",
@@ -57,18 +57,18 @@ const wrappedStockQuote = wrappedTools[0];
57
57
 
58
58
  let wrappedOutput;
59
59
  try {
60
- wrappedOutput = await wrappedStockQuote.invoke(invalidArgs);
60
+ wrappedOutput = await wrappedStockQuote.invoke(mismatchedArgs);
61
61
  } catch (error) {
62
62
  exitWithError("wrapped stock_quote invocation", error);
63
63
  }
64
64
 
65
- let reliableResult;
65
+ let reliableResult = null;
66
66
  try {
67
67
  reliableResult = await reliableToolCalls({
68
68
  userInput: "Get Apple stock in the US market.",
69
69
  tools: [stockQuote],
70
70
  // The tool name is intentionally wrong to demonstrate repair to stock_quote.
71
- calls: [{ tool: "stock_price", args: invalidArgs }],
71
+ calls: [{ tool: "stock_price", args: mismatchedArgs }],
72
72
  repair() {
73
73
  return [{ tool: "stock_quote", args: { ticker: "AAPL", market: "US" } }];
74
74
  },
@@ -113,11 +113,11 @@ const repairedCall = reliableResult?.calls?.[0] ?? null;
113
113
 
114
114
  const report = {
115
115
  wrappedTool: {
116
- before: invalidArgs,
116
+ before: mismatchedArgs,
117
117
  after: wrappedOutput,
118
118
  },
119
119
  reliableToolCalls: {
120
- before: { tool: "stock_price", args: invalidArgs },
120
+ before: { tool: "stock_price", args: mismatchedArgs },
121
121
  repaired: repairedCall,
122
122
  diagnostics: reliableResult?.diagnostics ?? null,
123
123
  },