@sprucelabs/sprucebot-llm 0.0.2 → 0.0.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/README.md +1 -0
- package/build/bots/adapters/OpenAi.js +1 -1
- package/build/bots/templates.d.ts +1 -1
- package/build/bots/templates.js +1 -1
- package/build/chat.js +3 -1
- package/build/esm/bots/adapters/OpenAi.js +1 -1
- package/build/esm/bots/templates.d.ts +1 -1
- package/build/esm/bots/templates.js +1 -1
- package/build/esm/chat.js +3 -1
- package/build/esm/examples/buildCallbackSkill.js +3 -0
- package/build/esm/examples/buildFileTransformerSkill.d.ts +2 -0
- package/build/esm/examples/buildFileTransformerSkill.js +25 -0
- package/build/examples/buildCallbackSkill.js +3 -0
- package/build/examples/buildFileTransformerSkill.d.ts +2 -0
- package/build/examples/buildFileTransformerSkill.js +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ class OpenAi {
|
|
|
20
20
|
const response = await this.api.createCompletion({
|
|
21
21
|
prompt,
|
|
22
22
|
model: 'text-davinci-003',
|
|
23
|
-
max_tokens:
|
|
23
|
+
max_tokens: 250,
|
|
24
24
|
stop: ['__Me__:'],
|
|
25
25
|
});
|
|
26
26
|
return ((_c = (_b = (_a = response.data.choices[0]) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : exports.MESSAGE_RESPONSE_ERROR_MESSAGE);
|
package/build/bots/templates.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.PROMPT_TEMPLATE = exports.CALLBACK_BOUNDARY = exports.DONE_TOKEN = exports.STATE_BOUNDARY = void 0;
|
|
7
7
|
const renderPlaceholder_1 = __importDefault(require("../parsingResponses/renderPlaceholder"));
|
|
8
8
|
exports.STATE_BOUNDARY = '*****';
|
|
9
|
-
exports.DONE_TOKEN = `
|
|
9
|
+
exports.DONE_TOKEN = `DONE_DONE_DONE`;
|
|
10
10
|
exports.CALLBACK_BOUNDARY = 'xxxxx';
|
|
11
11
|
exports.PROMPT_TEMPLATE = `You are <%= it.youAre %>
|
|
12
12
|
|
package/build/chat.js
CHANGED
|
@@ -32,6 +32,7 @@ const dotenv_1 = __importDefault(require("dotenv"));
|
|
|
32
32
|
const OpenAi_1 = require("./bots/adapters/OpenAi");
|
|
33
33
|
const SprucebotLlmFactory_1 = __importDefault(require("./bots/SprucebotLlmFactory"));
|
|
34
34
|
const buildCallbackSkill_1 = __importDefault(require("./examples/buildCallbackSkill"));
|
|
35
|
+
const buildFileTransformerSkill_1 = __importDefault(require("./examples/buildFileTransformerSkill"));
|
|
35
36
|
const buildJokeSkill_1 = __importDefault(require("./examples/buildJokeSkill"));
|
|
36
37
|
const buildProfileSkill_1 = __importDefault(require("./examples/buildProfileSkill"));
|
|
37
38
|
dotenv_1.default.config();
|
|
@@ -44,10 +45,11 @@ const rl = readline.createInterface({ input: node_process_1.stdin, output: node_
|
|
|
44
45
|
jokes: (0, buildJokeSkill_1.default)(bots),
|
|
45
46
|
profile: (0, buildProfileSkill_1.default)(bots),
|
|
46
47
|
callbacks: (0, buildCallbackSkill_1.default)(bots),
|
|
48
|
+
fileTransformer: (0, buildFileTransformerSkill_1.default)(bots),
|
|
47
49
|
};
|
|
48
50
|
const bot = bots.Bot({
|
|
49
51
|
adapter,
|
|
50
|
-
skill: skills.
|
|
52
|
+
skill: skills.profile,
|
|
51
53
|
youAre: "a bot named Sprucebot that is in test mode. At the start of every conversation, you introduce yourself and announce that you are in test mode so I don't get confused! You are both hip and adorable. You say things like, 'Jeepers' and 'Golly' or even 'Jeezey peezy'!",
|
|
52
54
|
});
|
|
53
55
|
do {
|
|
@@ -24,7 +24,7 @@ export class OpenAi {
|
|
|
24
24
|
const response = yield this.api.createCompletion({
|
|
25
25
|
prompt,
|
|
26
26
|
model: 'text-davinci-003',
|
|
27
|
-
max_tokens:
|
|
27
|
+
max_tokens: 250,
|
|
28
28
|
stop: ['__Me__:'],
|
|
29
29
|
});
|
|
30
30
|
return ((_c = (_b = (_a = response.data.choices[0]) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : MESSAGE_RESPONSE_ERROR_MESSAGE);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import renderPlaceholder from '../parsingResponses/renderPlaceholder.js';
|
|
2
2
|
export const STATE_BOUNDARY = '*****';
|
|
3
|
-
export const DONE_TOKEN = `
|
|
3
|
+
export const DONE_TOKEN = `DONE_DONE_DONE`;
|
|
4
4
|
export const CALLBACK_BOUNDARY = 'xxxxx';
|
|
5
5
|
export const PROMPT_TEMPLATE = `You are <%= it.youAre %>
|
|
6
6
|
|
package/build/esm/chat.js
CHANGED
|
@@ -13,6 +13,7 @@ import dotenv from 'dotenv';
|
|
|
13
13
|
import { OpenAi } from './bots/adapters/OpenAi.js';
|
|
14
14
|
import SprucebotLlmFactory from './bots/SprucebotLlmFactory.js';
|
|
15
15
|
import buildCallbackSkill from './examples/buildCallbackSkill.js';
|
|
16
|
+
import buildFileTransformerSkill from './examples/buildFileTransformerSkill.js';
|
|
16
17
|
import buildJokeSkill from './examples/buildJokeSkill.js';
|
|
17
18
|
import buildProfileSkill from './examples/buildProfileSkill.js';
|
|
18
19
|
dotenv.config();
|
|
@@ -25,10 +26,11 @@ const rl = readline.createInterface({ input, output });
|
|
|
25
26
|
jokes: buildJokeSkill(bots),
|
|
26
27
|
profile: buildProfileSkill(bots),
|
|
27
28
|
callbacks: buildCallbackSkill(bots),
|
|
29
|
+
fileTransformer: buildFileTransformerSkill(bots),
|
|
28
30
|
};
|
|
29
31
|
const bot = bots.Bot({
|
|
30
32
|
adapter,
|
|
31
|
-
skill: skills.
|
|
33
|
+
skill: skills.profile,
|
|
32
34
|
youAre: "a bot named Sprucebot that is in test mode. At the start of every conversation, you introduce yourself and announce that you are in test mode so I don't get confused! You are both hip and adorable. You say things like, 'Jeepers' and 'Golly' or even 'Jeezey peezy'!",
|
|
33
35
|
});
|
|
34
36
|
do {
|
|
@@ -10,6 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
export default function buildCallbackSkill(bots) {
|
|
11
11
|
return bots.Skill({
|
|
12
12
|
yourJobIfYouChooseToAcceptItIs: "to be be the best appointment taker on the planet. You have a many years of experience. You are going to ask me only 2 questions for this practice run. First, you'll ask me to pick an available time. Then, you'll ask me to pick my favorite color:",
|
|
13
|
+
pleaseKeepInMindThat: [
|
|
14
|
+
"getting a service is really important, so if i don't like any of the time, as to check another day or if i want to see a different provider",
|
|
15
|
+
],
|
|
13
16
|
callbacks: {
|
|
14
17
|
availableTimes: {
|
|
15
18
|
cb: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import SprucebotLlmFactory from '../bots/SprucebotLlmFactory';
|
|
2
|
+
export default function buildFileTransformerSkill(bots: SprucebotLlmFactory): import("../llm.types").SprucebotLLmSkill<import("@sprucelabs/schema").Schema, import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/schema").Schema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/schema").Schema, false>>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { buildSchema } from '@sprucelabs/schema';
|
|
2
|
+
export default function buildFileTransformerSkill(bots) {
|
|
3
|
+
return bots.Skill({
|
|
4
|
+
yourJobIfYouChooseToAcceptItIs: 'is to convert data from one format to another. Since you are a robot, this should be no problem for you! You are going to jump right in by asking me the import and output formats and then the data to convert!',
|
|
5
|
+
pleaseKeepInMindThat: [
|
|
6
|
+
'you will need to ask me the format of the input and the desired format of the output.',
|
|
7
|
+
'last step is to take the data and convert it to the desired format and send it back to me.',
|
|
8
|
+
],
|
|
9
|
+
stateSchema: buildSchema({
|
|
10
|
+
id: 'fileTransformer',
|
|
11
|
+
fields: {
|
|
12
|
+
inputFormat: {
|
|
13
|
+
type: 'text',
|
|
14
|
+
},
|
|
15
|
+
outputFormat: {
|
|
16
|
+
type: 'text',
|
|
17
|
+
},
|
|
18
|
+
dataToConvert: {
|
|
19
|
+
type: 'text',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
weAreDoneWhen: 'You have converted the input to the desired output format and sent it back to me.',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
function buildCallbackSkill(bots) {
|
|
4
4
|
return bots.Skill({
|
|
5
5
|
yourJobIfYouChooseToAcceptItIs: "to be be the best appointment taker on the planet. You have a many years of experience. You are going to ask me only 2 questions for this practice run. First, you'll ask me to pick an available time. Then, you'll ask me to pick my favorite color:",
|
|
6
|
+
pleaseKeepInMindThat: [
|
|
7
|
+
"getting a service is really important, so if i don't like any of the time, as to check another day or if i want to see a different provider",
|
|
8
|
+
],
|
|
6
9
|
callbacks: {
|
|
7
10
|
availableTimes: {
|
|
8
11
|
cb: async () => {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import SprucebotLlmFactory from '../bots/SprucebotLlmFactory';
|
|
2
|
+
export default function buildFileTransformerSkill(bots: SprucebotLlmFactory): import("../llm.types").SprucebotLLmSkill<import("@sprucelabs/schema").Schema, import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/schema").Schema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/schema").Schema, false>>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
4
|
+
function buildFileTransformerSkill(bots) {
|
|
5
|
+
return bots.Skill({
|
|
6
|
+
yourJobIfYouChooseToAcceptItIs: 'is to convert data from one format to another. Since you are a robot, this should be no problem for you! You are going to jump right in by asking me the import and output formats and then the data to convert!',
|
|
7
|
+
pleaseKeepInMindThat: [
|
|
8
|
+
'you will need to ask me the format of the input and the desired format of the output.',
|
|
9
|
+
'last step is to take the data and convert it to the desired format and send it back to me.',
|
|
10
|
+
],
|
|
11
|
+
stateSchema: (0, schema_1.buildSchema)({
|
|
12
|
+
id: 'fileTransformer',
|
|
13
|
+
fields: {
|
|
14
|
+
inputFormat: {
|
|
15
|
+
type: 'text',
|
|
16
|
+
},
|
|
17
|
+
outputFormat: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
},
|
|
20
|
+
dataToConvert: {
|
|
21
|
+
type: 'text',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
weAreDoneWhen: 'You have converted the input to the desired output format and sent it back to me.',
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.default = buildFileTransformerSkill;
|