@sprucelabs/sprucebot-llm 8.6.2 → 8.6.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/build/esm/tests/MockLlmSkill.d.ts +2 -1
- package/build/esm/tests/MockLlmSkill.js +16 -0
- package/build/esm/tests/SpyLlmBot.d.ts +1 -0
- package/build/esm/tests/SpyLlmBot.js +1 -0
- package/build/tests/MockLlmSkill.d.ts +2 -1
- package/build/tests/MockLlmSkill.js +5 -0
- package/build/tests/SpyLlmBot.d.ts +1 -0
- package/build/tests/SpyLlmBot.js +1 -0
- package/package.json +1 -1
|
@@ -9,5 +9,6 @@ export default class MockLlmSkill<StateSchema extends Schema = Schema, State ext
|
|
|
9
9
|
assertPleaseKeepInMindEquals(expected: string[] | undefined): void;
|
|
10
10
|
assertModelEquals(model: string | undefined): void;
|
|
11
11
|
assertStateSchemaEquals(expected: Schema | undefined): void;
|
|
12
|
-
assertHasCallback(name: string, expectedOptions?: Omit<LlmCallback, 'cb'>):
|
|
12
|
+
assertHasCallback(name: string, expectedOptions?: Omit<LlmCallback, 'cb'>): (options?: Record<string, any>) => import("../llm.types").SendMessage | Promise<import("../llm.types").SendMessage>;
|
|
13
|
+
invokeCallback(cbName: string, options?: Record<string, any>): Promise<import("../llm.types").SendMessage>;
|
|
13
14
|
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
11
|
var t = {};
|
|
3
12
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -40,5 +49,12 @@ export default class MockLlmSkill extends SprucebotLlmSkillImpl {
|
|
|
40
49
|
if (expectedOptions) {
|
|
41
50
|
assert.isEqualDeep(options, expectedOptions, `the options for the '${name}' callback don\`t match`);
|
|
42
51
|
}
|
|
52
|
+
return cb;
|
|
53
|
+
}
|
|
54
|
+
invokeCallback(cbName, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const cb = this.assertHasCallback(cbName);
|
|
57
|
+
return yield cb(options);
|
|
58
|
+
});
|
|
43
59
|
}
|
|
44
60
|
}
|
|
@@ -3,6 +3,7 @@ import SprucebotLlmBotImpl from '../bots/SprucebotLlmBotImpl';
|
|
|
3
3
|
import { BotOptions, LlmMessage, SprucebotLlmBot } from '../llm.types';
|
|
4
4
|
export default class SpyLlmBot<StateSchema extends Schema = Schema, State extends SchemaValues<StateSchema> = SchemaValues<StateSchema>> extends SprucebotLlmBotImpl<StateSchema, State> implements SprucebotLlmBot {
|
|
5
5
|
static instance: SpyLlmBot;
|
|
6
|
+
constructorOptions: BotOptions<StateSchema, State>;
|
|
6
7
|
constructor(options: BotOptions<StateSchema, State>);
|
|
7
8
|
getState(): Partial<State> | undefined;
|
|
8
9
|
getSkill(): import("../llm.types").SprucebotLLmSkill<Schema, Pick<import("@sprucelabs/schema").SchemaStaticValues<Schema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<Schema, false>>, never>> | undefined;
|
|
@@ -9,5 +9,6 @@ export default class MockLlmSkill<StateSchema extends Schema = Schema, State ext
|
|
|
9
9
|
assertPleaseKeepInMindEquals(expected: string[] | undefined): void;
|
|
10
10
|
assertModelEquals(model: string | undefined): void;
|
|
11
11
|
assertStateSchemaEquals(expected: Schema | undefined): void;
|
|
12
|
-
assertHasCallback(name: string, expectedOptions?: Omit<LlmCallback, 'cb'>):
|
|
12
|
+
assertHasCallback(name: string, expectedOptions?: Omit<LlmCallback, 'cb'>): (options?: Record<string, any>) => import("../llm.types").SendMessage | Promise<import("../llm.types").SendMessage>;
|
|
13
|
+
invokeCallback(cbName: string, options?: Record<string, any>): Promise<import("../llm.types").SendMessage>;
|
|
13
14
|
}
|
|
@@ -33,6 +33,11 @@ class MockLlmSkill extends SprucebotLlmSkillImpl_1.default {
|
|
|
33
33
|
if (expectedOptions) {
|
|
34
34
|
test_utils_1.assert.isEqualDeep(options, expectedOptions, `the options for the '${name}' callback don\`t match`);
|
|
35
35
|
}
|
|
36
|
+
return cb;
|
|
37
|
+
}
|
|
38
|
+
async invokeCallback(cbName, options) {
|
|
39
|
+
const cb = this.assertHasCallback(cbName);
|
|
40
|
+
return await cb(options);
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
exports.default = MockLlmSkill;
|
|
@@ -3,6 +3,7 @@ import SprucebotLlmBotImpl from '../bots/SprucebotLlmBotImpl';
|
|
|
3
3
|
import { BotOptions, LlmMessage, SprucebotLlmBot } from '../llm.types';
|
|
4
4
|
export default class SpyLlmBot<StateSchema extends Schema = Schema, State extends SchemaValues<StateSchema> = SchemaValues<StateSchema>> extends SprucebotLlmBotImpl<StateSchema, State> implements SprucebotLlmBot {
|
|
5
5
|
static instance: SpyLlmBot;
|
|
6
|
+
constructorOptions: BotOptions<StateSchema, State>;
|
|
6
7
|
constructor(options: BotOptions<StateSchema, State>);
|
|
7
8
|
getState(): Partial<State> | undefined;
|
|
8
9
|
getSkill(): import("../llm.types").SprucebotLLmSkill<Schema, Pick<import("@sprucelabs/schema").SchemaStaticValues<Schema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<Schema, false>>, never>> | undefined;
|
package/build/tests/SpyLlmBot.js
CHANGED