@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.
- package/package.json +1 -1
- package/scripts/demo.mjs +6 -6
package/package.json
CHANGED
package/scripts/demo.mjs
CHANGED
|
@@ -37,7 +37,7 @@ const stockQuote = {
|
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const
|
|
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(
|
|
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:
|
|
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:
|
|
116
|
+
before: mismatchedArgs,
|
|
117
117
|
after: wrappedOutput,
|
|
118
118
|
},
|
|
119
119
|
reliableToolCalls: {
|
|
120
|
-
before: { tool: "stock_price", args:
|
|
120
|
+
before: { tool: "stock_price", args: mismatchedArgs },
|
|
121
121
|
repaired: repairedCall,
|
|
122
122
|
diagnostics: reliableResult?.diagnostics ?? null,
|
|
123
123
|
},
|