@sprucelabs/sprucebot-llm 13.1.6 → 13.1.8
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.
|
@@ -14,7 +14,16 @@ class SpruceError extends error_1.default {
|
|
|
14
14
|
message = `You must create a bot and set it using 'SprucebotLlmFactory.setInstance(bot)' before you can get an instance of it.`;
|
|
15
15
|
break;
|
|
16
16
|
case 'INVALID_CALLBACK':
|
|
17
|
-
message = `The callback you tried to invoke (${options.matchedCallback})
|
|
17
|
+
message = `The callback you tried to invoke (${options.matchedCallback}) failed. Here are common reasons:
|
|
18
|
+
|
|
19
|
+
1. The callback does not exist (see valid callbacks below).
|
|
20
|
+
2. Syntax error in tags with no arguments. Make sure the callback is in the form of <<callbackName/>> (double << >> and closing forward slash / before the closing >>) and not <<callbackName>>.
|
|
21
|
+
3. Syntax error in tags with arguments. Make sure the callback is in the form of <<callbackName>>{{JSON arguments}}<</callbackName>> and not <<callbackName>>{{JSON arguments}}<</callbackName> (missing closing >> in the opening tag).
|
|
22
|
+
4. Syntax error in the JSON arguments. Make sure the JSON is valid and properly formatted.
|
|
23
|
+
|
|
24
|
+
Valid callbacks:
|
|
25
|
+
|
|
26
|
+
${options.validCallbacks.map((name, idx) => `${idx + 1}: ${name}`).join('\n')}`;
|
|
18
27
|
break;
|
|
19
28
|
case 'CALLBACK_ERROR':
|
|
20
29
|
message =
|
|
@@ -9,7 +9,16 @@ export default class SpruceError extends BaseSpruceError {
|
|
|
9
9
|
message = `You must create a bot and set it using 'SprucebotLlmFactory.setInstance(bot)' before you can get an instance of it.`;
|
|
10
10
|
break;
|
|
11
11
|
case 'INVALID_CALLBACK':
|
|
12
|
-
message = `The callback you tried to invoke (${options.matchedCallback})
|
|
12
|
+
message = `The callback you tried to invoke (${options.matchedCallback}) failed. Here are common reasons:
|
|
13
|
+
|
|
14
|
+
1. The callback does not exist (see valid callbacks below).
|
|
15
|
+
2. Syntax error in tags with no arguments. Make sure the callback is in the form of <<callbackName/>> (double << >> and closing forward slash / before the closing >>) and not <<callbackName>>.
|
|
16
|
+
3. Syntax error in tags with arguments. Make sure the callback is in the form of <<callbackName>>{{JSON arguments}}<</callbackName>> and not <<callbackName>>{{JSON arguments}}<</callbackName> (missing closing >> in the opening tag).
|
|
17
|
+
4. Syntax error in the JSON arguments. Make sure the JSON is valid and properly formatted.
|
|
18
|
+
|
|
19
|
+
Valid callbacks:
|
|
20
|
+
|
|
21
|
+
${options.validCallbacks.map((name, idx) => `${idx + 1}: ${name}`).join('\n')}`;
|
|
13
22
|
break;
|
|
14
23
|
case 'CALLBACK_ERROR':
|
|
15
24
|
message =
|
|
@@ -92,6 +92,11 @@ class ResponseParser {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
const { match, regex } = this.parseState(message);
|
|
96
|
+
if (match && regex) {
|
|
97
|
+
message = message.replace(regex, '').trim();
|
|
98
|
+
state = JSON.parse(match);
|
|
99
|
+
}
|
|
95
100
|
const matchedCallback = this.findFirstBadCallback(message);
|
|
96
101
|
if (matchedCallback) {
|
|
97
102
|
throw new SpruceError({
|
|
@@ -100,11 +105,6 @@ class ResponseParser {
|
|
|
100
105
|
matchedCallback,
|
|
101
106
|
});
|
|
102
107
|
}
|
|
103
|
-
const { match, regex } = this.parseState(message);
|
|
104
|
-
if (match && regex) {
|
|
105
|
-
message = message.replace(regex, '').trim();
|
|
106
|
-
state = JSON.parse(match);
|
|
107
|
-
}
|
|
108
108
|
return {
|
|
109
109
|
isDone: this.doesIncludeDoneToken(response),
|
|
110
110
|
state,
|
|
@@ -75,6 +75,11 @@ class ResponseParser {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
+
const { match, regex } = this.parseState(message);
|
|
79
|
+
if (match && regex) {
|
|
80
|
+
message = message.replace(regex, '').trim();
|
|
81
|
+
state = JSON.parse(match);
|
|
82
|
+
}
|
|
78
83
|
const matchedCallback = this.findFirstBadCallback(message);
|
|
79
84
|
if (matchedCallback) {
|
|
80
85
|
throw new SpruceError_1.default({
|
|
@@ -83,11 +88,6 @@ class ResponseParser {
|
|
|
83
88
|
matchedCallback,
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
|
-
const { match, regex } = this.parseState(message);
|
|
87
|
-
if (match && regex) {
|
|
88
|
-
message = message.replace(regex, '').trim();
|
|
89
|
-
state = JSON.parse(match);
|
|
90
|
-
}
|
|
91
91
|
return {
|
|
92
92
|
isDone: this.doesIncludeDoneToken(response),
|
|
93
93
|
state,
|