@sprucelabs/sprucebot-llm 11.1.12 → 11.1.14
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 -1
- package/build/.spruce/errors/errors.types.js +1 -0
- package/build/.spruce/errors/errors.types.js.map +1 -0
- package/build/.spruce/errors/options.types.js +1 -0
- package/build/.spruce/errors/options.types.js.map +1 -0
- package/build/.spruce/errors/sprucebotLlm/callbackError.schema.js +1 -0
- package/build/.spruce/errors/sprucebotLlm/callbackError.schema.js.map +1 -0
- package/build/.spruce/errors/sprucebotLlm/invalidCallback.schema.js +1 -0
- package/build/.spruce/errors/sprucebotLlm/invalidCallback.schema.js.map +1 -0
- package/build/.spruce/errors/sprucebotLlm/noBotInstanceSet.schema.js +1 -0
- package/build/.spruce/errors/sprucebotLlm/noBotInstanceSet.schema.js.map +1 -0
- package/build/.spruce/event-cache.json +1 -0
- package/build/.spruce/schemas/fields/fieldClassMap.js +1 -0
- package/build/.spruce/schemas/fields/fieldClassMap.js.map +1 -0
- package/build/.spruce/schemas/fields/fields.types.js +1 -0
- package/build/.spruce/schemas/fields/fields.types.js.map +1 -0
- package/build/__tests__/behavioral/LlmBot.test.d.ts +55 -0
- package/build/__tests__/behavioral/LlmBot.test.js +607 -0
- package/build/__tests__/behavioral/LlmBot.test.js.map +1 -0
- package/build/__tests__/behavioral/SprucebotLlmFactory.test.d.ts +16 -0
- package/build/__tests__/behavioral/SprucebotLlmFactory.test.js +132 -0
- package/build/__tests__/behavioral/SprucebotLlmFactory.test.js.map +1 -0
- package/build/__tests__/behavioral/adapters/OpenAi.test.d.ts +52 -0
- package/build/__tests__/behavioral/adapters/OpenAi.test.js +699 -0
- package/build/__tests__/behavioral/adapters/OpenAi.test.js.map +1 -0
- package/build/__tests__/behavioral/prompts/PromptGenerator.test.d.ts +20 -0
- package/build/__tests__/behavioral/prompts/PromptGenerator.test.js +211 -0
- package/build/__tests__/behavioral/prompts/PromptGenerator.test.js.map +1 -0
- package/build/__tests__/behavioral/prompts/ResponseParser.test.d.ts +35 -0
- package/build/__tests__/behavioral/prompts/ResponseParser.test.js +312 -0
- package/build/__tests__/behavioral/prompts/ResponseParser.test.js.map +1 -0
- package/build/__tests__/behavioral/skills/Skill.test.d.ts +19 -0
- package/build/__tests__/behavioral/skills/Skill.test.js +188 -0
- package/build/__tests__/behavioral/skills/Skill.test.js.map +1 -0
- package/build/__tests__/behavioral/testing/MockLlmSkill.test.d.ts +37 -0
- package/build/__tests__/behavioral/testing/MockLlmSkill.test.js +340 -0
- package/build/__tests__/behavioral/testing/MockLlmSkill.test.js.map +1 -0
- package/build/__tests__/behavioral/testing/SpyLlmBot.test.d.ts +4 -0
- package/build/__tests__/behavioral/testing/SpyLlmBot.test.js +34 -0
- package/build/__tests__/behavioral/testing/SpyLlmBot.test.js.map +1 -0
- package/build/__tests__/support/AbstractLlmTest.d.ts +14 -0
- package/build/__tests__/support/AbstractLlmTest.js +67 -0
- package/build/__tests__/support/AbstractLlmTest.js.map +1 -0
- package/build/__tests__/support/schemas/carSchema.d.ts +16 -0
- package/build/__tests__/support/schemas/carSchema.js +19 -0
- package/build/__tests__/support/schemas/carSchema.js.map +1 -0
- package/build/__tests__/support/schemas/personSchema.d.ts +23 -0
- package/build/__tests__/support/schemas/personSchema.js +37 -0
- package/build/__tests__/support/schemas/personSchema.js.map +1 -0
- package/build/__tests__/support/schemas/personWithDefaultsSchema.d.ts +13 -0
- package/build/__tests__/support/schemas/personWithDefaultsSchema.js +18 -0
- package/build/__tests__/support/schemas/personWithDefaultsSchema.js.map +1 -0
- package/build/bots/PromptGenerator.js +1 -0
- package/build/bots/PromptGenerator.js.map +1 -0
- package/build/bots/SprucebotLlmBotImpl.js +9 -4
- package/build/bots/SprucebotLlmBotImpl.js.map +1 -0
- package/build/bots/SprucebotLlmFactory.js +1 -0
- package/build/bots/SprucebotLlmFactory.js.map +1 -0
- package/build/bots/SprucebotLlmSkillImpl.js +1 -0
- package/build/bots/SprucebotLlmSkillImpl.js.map +1 -0
- package/build/bots/adapters/OpenAi.js +1 -0
- package/build/bots/adapters/OpenAi.js.map +1 -0
- package/build/bots/adapters/OpenAiMessageBuilder.js +1 -0
- package/build/bots/adapters/OpenAiMessageBuilder.js.map +1 -0
- package/build/bots/adapters/SpyOpenAiApi.js +1 -0
- package/build/bots/adapters/SpyOpenAiApi.js.map +1 -0
- package/build/bots/templates.js +1 -0
- package/build/bots/templates.js.map +1 -0
- package/build/chat.js +1 -0
- package/build/chat.js.map +1 -0
- package/build/chatWithImages.js +1 -0
- package/build/chatWithImages.js.map +1 -0
- package/build/errors/SpruceError.js +1 -0
- package/build/errors/SpruceError.js.map +1 -0
- package/build/errors/callbackError.builder.js +1 -0
- package/build/errors/callbackError.builder.js.map +1 -0
- package/build/errors/invalidCallback.builder.js +1 -0
- package/build/errors/invalidCallback.builder.js.map +1 -0
- package/build/errors/noBotInstanceSet.builder.js +1 -0
- package/build/errors/noBotInstanceSet.builder.js.map +1 -0
- package/build/examples/buildCallbackSkill.js +1 -0
- package/build/examples/buildCallbackSkill.js.map +1 -0
- package/build/examples/buildFileTransformerSkill.js +1 -0
- package/build/examples/buildFileTransformerSkill.js.map +1 -0
- package/build/examples/buildJokeSkill.js +1 -0
- package/build/examples/buildJokeSkill.js.map +1 -0
- package/build/examples/buildProfileSkill.js +1 -0
- package/build/examples/buildProfileSkill.js.map +1 -0
- package/build/examples/buildReceptionistSkill.js +1 -0
- package/build/examples/buildReceptionistSkill.js.map +1 -0
- package/build/fineTuningSprucebot/constants/DIRECTORY_SHARES.js +1 -0
- package/build/fineTuningSprucebot/constants/DIRECTORY_SHARES.js.map +1 -0
- package/build/fineTuningSprucebot/constants/FIRST_MESSAGES.js +1 -0
- package/build/fineTuningSprucebot/constants/FIRST_MESSAGES.js.map +1 -0
- package/build/fineTuningSprucebot/constants/GREETINGS.js +1 -0
- package/build/fineTuningSprucebot/constants/GREETINGS.js.map +1 -0
- package/build/fineTuningSprucebot/constants/OFF_THE_RAILS_CONVERSATIONS.js +1 -0
- package/build/fineTuningSprucebot/constants/OFF_THE_RAILS_CONVERSATIONS.js.map +1 -0
- package/build/fineTuningSprucebot/constants/TOPICS.js +1 -0
- package/build/fineTuningSprucebot/constants/TOPICS.js.map +1 -0
- package/build/fineTuningSprucebot/generateSamples.js +1 -0
- package/build/fineTuningSprucebot/generateSamples.js.map +1 -0
- package/build/fineTuningSprucebot/support.js +1 -0
- package/build/fineTuningSprucebot/support.js.map +1 -0
- package/build/fineTuningSprucebot/types.js +1 -0
- package/build/fineTuningSprucebot/types.js.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/llm.types.js +1 -0
- package/build/llm.types.js.map +1 -0
- package/build/parsingResponses/ResponseParser.js +1 -0
- package/build/parsingResponses/ResponseParser.js.map +1 -0
- package/build/parsingResponses/renderPlaceholder.js +1 -0
- package/build/parsingResponses/renderPlaceholder.js.map +1 -0
- package/build/tests/MockLlmSkill.js +1 -0
- package/build/tests/MockLlmSkill.js.map +1 -0
- package/build/tests/SpyAdapter.js +1 -0
- package/build/tests/SpyAdapter.js.map +1 -0
- package/build/tests/SpyLlmBot.js +1 -0
- package/build/tests/SpyLlmBot.js.map +1 -0
- package/package.json +14 -14
- package/build/esm/.spruce/errors/errors.types.d.ts +0 -52
- package/build/esm/.spruce/errors/errors.types.js +0 -1
- package/build/esm/.spruce/errors/options.types.d.ts +0 -13
- package/build/esm/.spruce/errors/options.types.js +0 -1
- package/build/esm/bots/PromptGenerator.d.ts +0 -22
- package/build/esm/bots/PromptGenerator.js +0 -74
- package/build/esm/bots/SprucebotLlmBotImpl.d.ts +0 -26
- package/build/esm/bots/SprucebotLlmBotImpl.js +0 -159
- package/build/esm/bots/SprucebotLlmFactory.d.ts +0 -15
- package/build/esm/bots/SprucebotLlmFactory.js +0 -41
- package/build/esm/bots/SprucebotLlmSkillImpl.d.ts +0 -12
- package/build/esm/bots/SprucebotLlmSkillImpl.js +0 -47
- package/build/esm/bots/adapters/OpenAi.d.ts +0 -11
- package/build/esm/bots/adapters/OpenAi.js +0 -46
- package/build/esm/bots/adapters/OpenAiMessageBuilder.d.ts +0 -18
- package/build/esm/bots/adapters/OpenAiMessageBuilder.js +0 -153
- package/build/esm/bots/adapters/SpyOpenAiApi.d.ts +0 -19
- package/build/esm/bots/adapters/SpyOpenAiApi.js +0 -49
- package/build/esm/bots/templates.d.ts +0 -4
- package/build/esm/bots/templates.js +0 -68
- package/build/esm/chat.d.ts +0 -1
- package/build/esm/chat.js +0 -53
- package/build/esm/chatWithImages.d.ts +0 -1
- package/build/esm/chatWithImages.js +0 -46
- package/build/esm/errors/SpruceError.d.ts +0 -6
- package/build/esm/errors/SpruceError.js +0 -25
- package/build/esm/errors/callbackError.builder.d.ts +0 -6
- package/build/esm/errors/callbackError.builder.js +0 -6
- package/build/esm/errors/invalidCallback.builder.d.ts +0 -17
- package/build/esm/errors/invalidCallback.builder.js +0 -17
- package/build/esm/errors/noBotInstanceSet.builder.d.ts +0 -6
- package/build/esm/errors/noBotInstanceSet.builder.js +0 -6
- package/build/esm/examples/buildCallbackSkill.d.ts +0 -2
- package/build/esm/examples/buildCallbackSkill.js +0 -57
- package/build/esm/examples/buildFileTransformerSkill.d.ts +0 -2
- package/build/esm/examples/buildFileTransformerSkill.js +0 -25
- package/build/esm/examples/buildJokeSkill.d.ts +0 -2
- package/build/esm/examples/buildJokeSkill.js +0 -12
- package/build/esm/examples/buildProfileSkill.d.ts +0 -2
- package/build/esm/examples/buildProfileSkill.js +0 -30
- package/build/esm/examples/buildReceptionistSkill.d.ts +0 -2
- package/build/esm/examples/buildReceptionistSkill.js +0 -16
- package/build/esm/fineTuningSprucebot/constants/DIRECTORY_SHARES.d.ts +0 -1
- package/build/esm/fineTuningSprucebot/constants/DIRECTORY_SHARES.js +0 -7
- package/build/esm/fineTuningSprucebot/constants/FIRST_MESSAGES.d.ts +0 -1
- package/build/esm/fineTuningSprucebot/constants/FIRST_MESSAGES.js +0 -17
- package/build/esm/fineTuningSprucebot/constants/GREETINGS.d.ts +0 -1
- package/build/esm/fineTuningSprucebot/constants/GREETINGS.js +0 -22
- package/build/esm/fineTuningSprucebot/constants/OFF_THE_RAILS_CONVERSATIONS.d.ts +0 -2
- package/build/esm/fineTuningSprucebot/constants/OFF_THE_RAILS_CONVERSATIONS.js +0 -32
- package/build/esm/fineTuningSprucebot/constants/TOPICS.d.ts +0 -2
- package/build/esm/fineTuningSprucebot/constants/TOPICS.js +0 -314
- package/build/esm/fineTuningSprucebot/generateSamples.d.ts +0 -1
- package/build/esm/fineTuningSprucebot/generateSamples.js +0 -41
- package/build/esm/fineTuningSprucebot/support.d.ts +0 -12
- package/build/esm/fineTuningSprucebot/support.js +0 -60
- package/build/esm/fineTuningSprucebot/types.d.ts +0 -15
- package/build/esm/fineTuningSprucebot/types.js +0 -1
- package/build/esm/index.d.ts +0 -10
- package/build/esm/index.js +0 -10
- package/build/esm/llm.types.d.ts +0 -84
- package/build/esm/llm.types.js +0 -6
- package/build/esm/parsingResponses/ResponseParser.d.ts +0 -18
- package/build/esm/parsingResponses/ResponseParser.js +0 -115
- package/build/esm/parsingResponses/renderPlaceholder.d.ts +0 -1
- package/build/esm/parsingResponses/renderPlaceholder.js +0 -4
- package/build/esm/tests/MockLlmSkill.d.ts +0 -14
- package/build/esm/tests/MockLlmSkill.js +0 -60
- package/build/esm/tests/SpyAdapter.d.ts +0 -8
- package/build/esm/tests/SpyAdapter.js +0 -21
- package/build/esm/tests/SpyLlmBot.d.ts +0 -12
- package/build/esm/tests/SpyLlmBot.js +0 -20
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { buildSchema } from '@sprucelabs/schema';
|
|
2
|
-
export default function buildProfileSkill(bots) {
|
|
3
|
-
return bots.Skill({
|
|
4
|
-
yourJobIfYouChooseToAcceptItIs: 'to collect some information from me! You are a receptionist with 20 years experience and are very focused on getting answers needed to complete my profile',
|
|
5
|
-
weAreDoneWhen: 'You have all the information to complete my profile',
|
|
6
|
-
stateSchema: buildSchema({
|
|
7
|
-
id: 'profile',
|
|
8
|
-
fields: {
|
|
9
|
-
firstName: {
|
|
10
|
-
type: 'text',
|
|
11
|
-
label: 'First name',
|
|
12
|
-
},
|
|
13
|
-
lastName: {
|
|
14
|
-
type: 'text',
|
|
15
|
-
label: 'Last name',
|
|
16
|
-
},
|
|
17
|
-
favoriteColor: {
|
|
18
|
-
type: 'select',
|
|
19
|
-
options: {
|
|
20
|
-
choices: [
|
|
21
|
-
{ label: 'Red', value: 'red' },
|
|
22
|
-
{ label: 'Blue', value: 'blue' },
|
|
23
|
-
{ label: 'Green', value: 'green' },
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import SprucebotLlmFactory from '../bots/SprucebotLlmFactory';
|
|
2
|
-
export default function buildReceptionistSkill(bots: SprucebotLlmFactory): import("..").SprucebotLLmSkill<import("@sprucelabs/schema").Schema, Pick<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/schema").Schema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/schema").Schema, false>>, never>>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default function buildReceptionistSkill(bots) {
|
|
2
|
-
return bots.Skill({
|
|
3
|
-
yourJobIfYouChooseToAcceptItIs: `to help me with the following topics you are allowed to help me with:
|
|
4
|
-
1. Knock knock jokes
|
|
5
|
-
2. Ask a human for help
|
|
6
|
-
3. Book an appointment
|
|
7
|
-
|
|
8
|
-
So start asking me how you can help.`,
|
|
9
|
-
pleaseKeepInMindThat: [
|
|
10
|
-
'sharing the list helps me pick faster and you like helping',
|
|
11
|
-
'you can only talk about the topics listed above. If i ask you about something else, you should tell me that you can only help me with the topics listed above and share the list again.',
|
|
12
|
-
"you are not to help me with the topics above, only to help me pick one. For example, if I want to hear a knock knock joke, you send {{#1}} and don't start telling any jokes.",
|
|
13
|
-
],
|
|
14
|
-
weAreDoneWhen: 'i have picked a topic i need help with. At that point, send me the done message and include the topic ID in handlebars format, e.g. {{#1}} or {{#2}} so I can parse it from your response.',
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DIRECTORY_SHARES: string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const DIRECTORY_SHARES = [
|
|
2
|
-
'Here are some things I can assist you with:',
|
|
3
|
-
'What can I help you with today? Here are some of my areas of expertise:',
|
|
4
|
-
'I can guide you through a variety of subjects. Here are a few to start:',
|
|
5
|
-
"Let's get started! Here are some things I can help you with:",
|
|
6
|
-
'Thanks for reaching out! Here are a few areas I can assist with:',
|
|
7
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FIRST_MESSAGES: string[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const FIRST_MESSAGES = [
|
|
2
|
-
'hey',
|
|
3
|
-
'Hey!',
|
|
4
|
-
"What's up!?",
|
|
5
|
-
'Hello!',
|
|
6
|
-
'Anyone there?',
|
|
7
|
-
'test',
|
|
8
|
-
'Hi',
|
|
9
|
-
'Hi!',
|
|
10
|
-
'Greetings!',
|
|
11
|
-
'Good day!',
|
|
12
|
-
'Howdy!',
|
|
13
|
-
'Hey there!',
|
|
14
|
-
'Nice to meet you!',
|
|
15
|
-
'Welcome!',
|
|
16
|
-
'Hello there!',
|
|
17
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const GREETINGS: string[];
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const GREETINGS = [
|
|
2
|
-
"Hi there! I'm Sprucebot 🌲🤖! Here are some things can help you with:",
|
|
3
|
-
'Hey! My name is Sprucebot 🌲🤖! Let me know which of the following you want to discuss:',
|
|
4
|
-
'Hello! You can call me Sprucebot 🌲🤖 and I can help you with:',
|
|
5
|
-
'Hi there! You can call me Sprucebot 🌲🤖! Need something? I can help with:',
|
|
6
|
-
'Greetings! My name is Sprucebot 🌲🤖. Below are some things I can help you with:',
|
|
7
|
-
"Hello there! I'm Sprucebot 🌲🤖 and the things I can help with are:",
|
|
8
|
-
'Hey there! My name is Sprucebot 🌲🤖 and I can help you with:',
|
|
9
|
-
"Good to see you! I'm Sprucebot 🌲🤖 and this is the list of things I'm ready to help with:",
|
|
10
|
-
'Hey! You can call me Sprucebot 🌲🤖 and ask be about anything below:',
|
|
11
|
-
'Hi! My name is Sprucebot 🌲🤖! Need help? Here are the things I can help with:',
|
|
12
|
-
"Hi there! My name is Sprucebot 🌲🤖 and I'm at your service, as long as it has to do with the following:",
|
|
13
|
-
'Hey there! You can call me Sprucebot 🌲🤖. I can help you with:',
|
|
14
|
-
"Hello! My name is Sprucebot 🌲🤖. If you need help with any of the following, I'm your bot!",
|
|
15
|
-
"Howdy! I'm Sprucebot 🌲🤖 and this is the list of my specialties:",
|
|
16
|
-
'Hiya! You can call me Sprucebot 🌲🤖! Need any help with the following?',
|
|
17
|
-
'Hello there! You can call me Sprucebot 🌲🤖. I can help you with:',
|
|
18
|
-
'Good to see you! My name is Sprucebot 🌲🤖. Here are some of my favorite things:',
|
|
19
|
-
'Greetings! You can call me Sprucebot 🌲🤖. Which would you like to talk about?',
|
|
20
|
-
'Hey there! My name is Sprucebot 🌲🤖. Here are the things I can help you with:',
|
|
21
|
-
"Hi! You can call me Sprucebot 🌲🤖!! I can't wait to help you with the following:",
|
|
22
|
-
];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export const OFF_THE_RAILS_CONVERSATIONS = [
|
|
2
|
-
{
|
|
3
|
-
messages: [
|
|
4
|
-
{
|
|
5
|
-
from: 'Me',
|
|
6
|
-
text: [
|
|
7
|
-
"Hey hey, I'd love to buy an airplane ticket!",
|
|
8
|
-
'Can you help me with the weather?',
|
|
9
|
-
'Can you help me make a sandwich?',
|
|
10
|
-
"What's the meaning of life?",
|
|
11
|
-
'I need help fixing my car',
|
|
12
|
-
'Can you help me understand the stock market?',
|
|
13
|
-
'What is the meaning of this universe?',
|
|
14
|
-
'How much wood could a woodchuck chuck if a woodchuck could chuck wood?',
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
from: 'You',
|
|
19
|
-
text: [
|
|
20
|
-
"Hmm, I checked my programming and a def can't help with that. Here is the list of things I can help with:\n\n{{topics}}",
|
|
21
|
-
"Actually, a can't do that. But, I can talk about the following:\n\n{{topics}}",
|
|
22
|
-
"I'm sorry, but that's outside of my capabilities. Here are some things I can assist you with:\n\n{{topics}}",
|
|
23
|
-
"That's a deep question. However, I'm designed to help you with these topics:\n\n{{topics}}",
|
|
24
|
-
"I'm not able to assist with that. Here are some topics I can help with:\n\n{{topics}}",
|
|
25
|
-
"That's not something I'm capable of, but I can help you with these topics:\n\n{{topics}}",
|
|
26
|
-
"I'm not quite qualified to answer that, but I can help you with the following topics:\n\n{{topics}}",
|
|
27
|
-
'Hmm, I serously have no idea what you are talking about. But, I do know these:\n\n{{topics}}',
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
export const TOPICS = [
|
|
2
|
-
{
|
|
3
|
-
name: [
|
|
4
|
-
'Tell a knock knock joke',
|
|
5
|
-
'Say a knock knock joke',
|
|
6
|
-
'Share a knock knock joke',
|
|
7
|
-
'Tell some jokes',
|
|
8
|
-
'Knock knock jokes',
|
|
9
|
-
],
|
|
10
|
-
conversations: [
|
|
11
|
-
{
|
|
12
|
-
messages: [
|
|
13
|
-
{
|
|
14
|
-
from: 'Me',
|
|
15
|
-
text: [
|
|
16
|
-
"Hey hey, I'd love to hear some jokes!",
|
|
17
|
-
'Tell me a joke!',
|
|
18
|
-
'I want to hear a joke!',
|
|
19
|
-
'Can you tell me a joke?',
|
|
20
|
-
'Tell me a joke please!',
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
messages: [
|
|
27
|
-
{
|
|
28
|
-
from: 'Me',
|
|
29
|
-
text: [
|
|
30
|
-
'I think I am in the mood for something funny',
|
|
31
|
-
"I'm feeling sad!",
|
|
32
|
-
'What about a joke, know any good ones!',
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
from: 'You',
|
|
37
|
-
text: [
|
|
38
|
-
'Oh yeah? Would a joke hit the spot?',
|
|
39
|
-
'Hmm, maybe a joke?',
|
|
40
|
-
'Oh, oh, oh, I can tell jokes, want to hear?',
|
|
41
|
-
'I am so good at jokes, want to hear one?',
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
from: 'Me',
|
|
46
|
-
text: [
|
|
47
|
-
'Yes please!',
|
|
48
|
-
'YES',
|
|
49
|
-
'Sure!',
|
|
50
|
-
'👍',
|
|
51
|
-
'I guess',
|
|
52
|
-
'Fine',
|
|
53
|
-
'What else am I doing',
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: [
|
|
62
|
-
'Booking a haircut',
|
|
63
|
-
'Haircut appointment',
|
|
64
|
-
'Book an appointment',
|
|
65
|
-
],
|
|
66
|
-
conversations: [
|
|
67
|
-
{
|
|
68
|
-
messages: [
|
|
69
|
-
{
|
|
70
|
-
from: 'Me',
|
|
71
|
-
text: [
|
|
72
|
-
"I'm looking to book a haircut",
|
|
73
|
-
'Can you help me schedule a haircut appointment?',
|
|
74
|
-
'How do I book an appointment for a haircut?',
|
|
75
|
-
'I need a beard trim',
|
|
76
|
-
'I need to schedule with barber',
|
|
77
|
-
'Do you have any barbers available?',
|
|
78
|
-
'Are there any appointments available?',
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: [
|
|
87
|
-
'Get help from a human',
|
|
88
|
-
'Contact support',
|
|
89
|
-
'Ask for assistance',
|
|
90
|
-
'Speak to customer service',
|
|
91
|
-
'Need help from a real person',
|
|
92
|
-
'Contact a human',
|
|
93
|
-
],
|
|
94
|
-
conversations: [
|
|
95
|
-
{
|
|
96
|
-
messages: [
|
|
97
|
-
{
|
|
98
|
-
from: 'Me',
|
|
99
|
-
text: [
|
|
100
|
-
'I need to speak to a human',
|
|
101
|
-
'Can you connect me to a person?',
|
|
102
|
-
'I want to talk to a real person',
|
|
103
|
-
'I need some human help',
|
|
104
|
-
'Help me',
|
|
105
|
-
'I need help',
|
|
106
|
-
'How can I update my account?',
|
|
107
|
-
"My appointment was lost, I can't find it!",
|
|
108
|
-
'I could not install the app',
|
|
109
|
-
"I'm not sure what to do!",
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: [
|
|
118
|
-
'Leave some feedback',
|
|
119
|
-
'Provide feedback',
|
|
120
|
-
'Share your thoughts',
|
|
121
|
-
'Give your opinion',
|
|
122
|
-
'Rate our service',
|
|
123
|
-
],
|
|
124
|
-
conversations: [
|
|
125
|
-
{
|
|
126
|
-
messages: [
|
|
127
|
-
{
|
|
128
|
-
from: 'Me',
|
|
129
|
-
text: [
|
|
130
|
-
'I would like to leave some feedback',
|
|
131
|
-
'Can I share some thoughts about your service?',
|
|
132
|
-
'I have an opinion about your service',
|
|
133
|
-
'Can I rate your service?',
|
|
134
|
-
'That sucked',
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: [
|
|
143
|
-
'Plan an adventure',
|
|
144
|
-
'Organize an adventure',
|
|
145
|
-
'Prepare for an adventure',
|
|
146
|
-
'Get ready for a trip',
|
|
147
|
-
'Plan a trip',
|
|
148
|
-
],
|
|
149
|
-
conversations: [
|
|
150
|
-
{
|
|
151
|
-
messages: [
|
|
152
|
-
{
|
|
153
|
-
from: 'Me',
|
|
154
|
-
text: [
|
|
155
|
-
"I'm feeling adventurous today! What do you suggest?",
|
|
156
|
-
'Where should I go on an adventure?',
|
|
157
|
-
'I want to go on an adventure, can you help me plan?',
|
|
158
|
-
'I wanna plan something with the kids',
|
|
159
|
-
'What is there to do today?',
|
|
160
|
-
"Let's do something fun!",
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: [
|
|
169
|
-
'Review my schedule',
|
|
170
|
-
'Check my calendar',
|
|
171
|
-
'See my calendar',
|
|
172
|
-
'What is on my schedule?',
|
|
173
|
-
],
|
|
174
|
-
conversations: [
|
|
175
|
-
{
|
|
176
|
-
messages: [
|
|
177
|
-
{
|
|
178
|
-
from: 'Me',
|
|
179
|
-
text: [
|
|
180
|
-
'Do I work today',
|
|
181
|
-
'Can you show me what my day looks like today?',
|
|
182
|
-
'I want to check my schedule for today',
|
|
183
|
-
'What do I have planned today?',
|
|
184
|
-
'Do I have to work today?',
|
|
185
|
-
],
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: [
|
|
193
|
-
'Add a block to your schedule',
|
|
194
|
-
'Block off some time',
|
|
195
|
-
'Block my calendar',
|
|
196
|
-
'Add timeblock',
|
|
197
|
-
],
|
|
198
|
-
conversations: [
|
|
199
|
-
{
|
|
200
|
-
messages: [
|
|
201
|
-
{
|
|
202
|
-
from: 'Me',
|
|
203
|
-
text: [
|
|
204
|
-
'I need to block off some time on my calendar',
|
|
205
|
-
'Can you help me add an event to my schedule?',
|
|
206
|
-
'I want to reserve some time on my calendar',
|
|
207
|
-
'Add a block',
|
|
208
|
-
'Can you block my calendar?',
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: [
|
|
217
|
-
'Get restaurant recommendations',
|
|
218
|
-
'Recommend a restaurant',
|
|
219
|
-
'Suggest food places',
|
|
220
|
-
'Where should I eat?',
|
|
221
|
-
'Find me a good restaurant',
|
|
222
|
-
],
|
|
223
|
-
conversations: [
|
|
224
|
-
{
|
|
225
|
-
messages: [
|
|
226
|
-
{
|
|
227
|
-
from: 'Me',
|
|
228
|
-
text: [
|
|
229
|
-
'I am hungry, can you recommend a restaurant?',
|
|
230
|
-
'Where should I go for dinner tonight?',
|
|
231
|
-
'I want to try a new restaurant, any suggestions?',
|
|
232
|
-
'What are some good food places around here?',
|
|
233
|
-
'Can you suggest a restaurant for a date?',
|
|
234
|
-
],
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: [
|
|
242
|
-
'Get directions',
|
|
243
|
-
'Find my way',
|
|
244
|
-
'How do I get there?',
|
|
245
|
-
'Directions to a place',
|
|
246
|
-
],
|
|
247
|
-
conversations: [
|
|
248
|
-
{
|
|
249
|
-
messages: [
|
|
250
|
-
{
|
|
251
|
-
from: 'Me',
|
|
252
|
-
text: [
|
|
253
|
-
'I am lost, can you help me find my way?',
|
|
254
|
-
'How do I get to the nearest gas station?',
|
|
255
|
-
'Can you give me directions to the airport?',
|
|
256
|
-
'I need to find my way to the nearest hospital',
|
|
257
|
-
'What is the best route to take to get to the park?',
|
|
258
|
-
],
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: [
|
|
266
|
-
'Get tech support',
|
|
267
|
-
'Technical issues',
|
|
268
|
-
'Troubleshoot my device',
|
|
269
|
-
'Solve my computer problems',
|
|
270
|
-
'Fix my internet',
|
|
271
|
-
],
|
|
272
|
-
conversations: [
|
|
273
|
-
{
|
|
274
|
-
messages: [
|
|
275
|
-
{
|
|
276
|
-
from: 'Me',
|
|
277
|
-
text: [
|
|
278
|
-
'I am having technical issues, can you help me?',
|
|
279
|
-
'How do I troubleshoot my device?',
|
|
280
|
-
'I need help solving my computer problems',
|
|
281
|
-
'My internet is not working, can you fix it?',
|
|
282
|
-
'I am having trouble with my phone, can you help me troubleshoot?',
|
|
283
|
-
],
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
name: [
|
|
291
|
-
'Get a quote',
|
|
292
|
-
'Price estimate',
|
|
293
|
-
'How much does it cost?',
|
|
294
|
-
'What is the cost?',
|
|
295
|
-
'Pricing information',
|
|
296
|
-
],
|
|
297
|
-
conversations: [
|
|
298
|
-
{
|
|
299
|
-
messages: [
|
|
300
|
-
{
|
|
301
|
-
from: 'Me',
|
|
302
|
-
text: [
|
|
303
|
-
'How much does a service cost?',
|
|
304
|
-
'Can you give me a quote?',
|
|
305
|
-
'What is the price of a service?',
|
|
306
|
-
'I would like to know the pricing information',
|
|
307
|
-
'Can you give me a price estimate?',
|
|
308
|
-
],
|
|
309
|
-
},
|
|
310
|
-
],
|
|
311
|
-
},
|
|
312
|
-
],
|
|
313
|
-
},
|
|
314
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const promptTemplate: string;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { FIRST_MESSAGES } from './constants/FIRST_MESSAGES.js';
|
|
4
|
-
import { OFF_THE_RAILS_CONVERSATIONS } from './constants/OFF_THE_RAILS_CONVERSATIONS.js';
|
|
5
|
-
import { TOPICS } from './constants/TOPICS.js';
|
|
6
|
-
import { randomizedTopics, generateCompletion, generateOffTheRails, render, random, } from './support.js';
|
|
7
|
-
const promptTemplatePath = path.join(__dirname, 'promptTemplate.txt');
|
|
8
|
-
const promptTemplateNoTopicsPath = path.join(__dirname, 'promptTemplateNoTopics.txt');
|
|
9
|
-
export const promptTemplate = fs.readFileSync(promptTemplatePath, 'utf8');
|
|
10
|
-
const promptTemplateNoTopics = fs.readFileSync(promptTemplateNoTopicsPath, 'utf8');
|
|
11
|
-
const output = [];
|
|
12
|
-
const outputPath = process.argv[2];
|
|
13
|
-
if (!outputPath) {
|
|
14
|
-
throw new Error('No output path provided. Example: node generateSamples.js ~/output.json');
|
|
15
|
-
}
|
|
16
|
-
new Array(1000).fill(0).forEach(() => {
|
|
17
|
-
const topics = randomizedTopics(TOPICS);
|
|
18
|
-
const randomLengthOfTopics = topics.slice(0, Math.random() * topics.length + 1);
|
|
19
|
-
const randomIndex = Math.floor(Math.random() * randomLengthOfTopics.length);
|
|
20
|
-
output.push(generateCompletion(randomLengthOfTopics, randomIndex));
|
|
21
|
-
});
|
|
22
|
-
for (const off of OFF_THE_RAILS_CONVERSATIONS) {
|
|
23
|
-
new Array(20)
|
|
24
|
-
.fill(0)
|
|
25
|
-
.forEach(() => output.push(generateOffTheRails(off, TOPICS)));
|
|
26
|
-
}
|
|
27
|
-
for (let c = 0; c < 20; c++) {
|
|
28
|
-
output.push({
|
|
29
|
-
prompt: render(promptTemplateNoTopics, {
|
|
30
|
-
topics: 'None!',
|
|
31
|
-
firstMessage: random(FIRST_MESSAGES),
|
|
32
|
-
}),
|
|
33
|
-
completion: random([
|
|
34
|
-
'Oh no, we have an outage! There is nothing I can help you with while we are down!',
|
|
35
|
-
'Shoot! I am having trouble connecting to HQ. I can not help you right now.',
|
|
36
|
-
"This is embarrassing, but I am having trouble connecting to HQ. I can't talk right now.",
|
|
37
|
-
"For some reason I am not able to communicate with HQ. I can't help you right now.",
|
|
38
|
-
]),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
fs.writeFileSync(outputPath, JSON.stringify(output, null, 2));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Conversation, Topic } from './types';
|
|
2
|
-
export declare function randomizedTopics(topics: Topic[]): Topic[];
|
|
3
|
-
export declare function generateOffTheRails(off: Conversation, topics: Topic[]): {
|
|
4
|
-
prompt: string;
|
|
5
|
-
completion: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function generateCompletion(ts: Topic[], c: number): {
|
|
8
|
-
prompt: string;
|
|
9
|
-
completion: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function random<T>(values: T[]): T;
|
|
12
|
-
export declare function render(message: string, context: Record<string, any>): string;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { FIRST_MESSAGES } from './constants/FIRST_MESSAGES.js';
|
|
2
|
-
import { GREETINGS } from './constants/GREETINGS.js';
|
|
3
|
-
import { promptTemplate } from './generateSamples.js';
|
|
4
|
-
export function randomizedTopics(topics) {
|
|
5
|
-
return [...topics].sort(() => Math.random() - 0.5);
|
|
6
|
-
}
|
|
7
|
-
export function generateOffTheRails(off, topics) {
|
|
8
|
-
const greeting = random(GREETINGS);
|
|
9
|
-
const renderedTopics = renderTopics(randomizedTopics(topics));
|
|
10
|
-
const messages = renderMessages([off.messages[0]], renderedTopics);
|
|
11
|
-
return {
|
|
12
|
-
prompt: render(promptTemplate, {
|
|
13
|
-
greeting,
|
|
14
|
-
topics: renderedTopics,
|
|
15
|
-
messages,
|
|
16
|
-
firstMessage: random(FIRST_MESSAGES),
|
|
17
|
-
}),
|
|
18
|
-
completion: render(random(off.messages[1].text), { topics }),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function generateCompletion(ts, c) {
|
|
22
|
-
const completion = `{{#${c + 1}}}`;
|
|
23
|
-
const greeting = random(GREETINGS);
|
|
24
|
-
const topic = ts[c];
|
|
25
|
-
const { topics, messages } = renderMessagesAndTopics(ts, topic.conversations);
|
|
26
|
-
return {
|
|
27
|
-
prompt: render(promptTemplate, {
|
|
28
|
-
firstMessage: random(FIRST_MESSAGES),
|
|
29
|
-
topics,
|
|
30
|
-
greeting,
|
|
31
|
-
messages,
|
|
32
|
-
}),
|
|
33
|
-
completion,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function renderMessagesAndTopics(ts, conversations) {
|
|
37
|
-
const conversation = random(conversations);
|
|
38
|
-
const topics = renderTopics(ts);
|
|
39
|
-
const rendered = renderMessages(conversation.messages, topics);
|
|
40
|
-
return { topics, messages: rendered };
|
|
41
|
-
}
|
|
42
|
-
function renderMessages(messages, topics) {
|
|
43
|
-
return render(messages.map((m) => `__${m.from}__: ${random(m.text)}`).join('\n') +
|
|
44
|
-
'\n__You__:', { topics });
|
|
45
|
-
}
|
|
46
|
-
function renderTopics(topics) {
|
|
47
|
-
return topics.map((t, idx) => `${idx + 1}. ${random(t.name)}`).join('\n');
|
|
48
|
-
}
|
|
49
|
-
export function random(values) {
|
|
50
|
-
return values[Math.floor(Math.random() * values.length)];
|
|
51
|
-
}
|
|
52
|
-
export function render(message, context) {
|
|
53
|
-
let prompt = message;
|
|
54
|
-
for (const key in context) {
|
|
55
|
-
const value = context[key];
|
|
56
|
-
const regex = new RegExp(`{{${key}}}`, 'g'); // use regex to match all occurrences
|
|
57
|
-
prompt = prompt.replace(regex, value);
|
|
58
|
-
}
|
|
59
|
-
return prompt;
|
|
60
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface Topic {
|
|
2
|
-
name: string[];
|
|
3
|
-
conversations: Conversation[];
|
|
4
|
-
}
|
|
5
|
-
export interface Conversation {
|
|
6
|
-
messages: Message[];
|
|
7
|
-
}
|
|
8
|
-
export interface Message {
|
|
9
|
-
from: 'Me' | 'You';
|
|
10
|
-
text: string[];
|
|
11
|
-
}
|
|
12
|
-
export interface FineTuneOutput {
|
|
13
|
-
prompt: string;
|
|
14
|
-
completion: string;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/esm/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as SprucebotLlmFactory } from './bots/SprucebotLlmFactory';
|
|
2
|
-
export { default as SprucebotLlmBotImpl } from './bots/SprucebotLlmBotImpl';
|
|
3
|
-
export { default as SprucebotLlmSkillImpl } from './bots/SprucebotLlmSkillImpl';
|
|
4
|
-
export { default as OpenAiAdapter } from './bots/adapters/OpenAi';
|
|
5
|
-
export * from './llm.types';
|
|
6
|
-
export { default as SprucebotLlmError } from './errors/SpruceError';
|
|
7
|
-
export { default as MockLlmSkill } from './tests/MockLlmSkill';
|
|
8
|
-
export { default as SpyLllmBot } from './tests/SpyLlmBot';
|
|
9
|
-
export { default as SpyLlmAdapter } from './tests/SpyAdapter';
|
|
10
|
-
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiApi';
|
package/build/esm/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as SprucebotLlmFactory } from './bots/SprucebotLlmFactory.js';
|
|
2
|
-
export { default as SprucebotLlmBotImpl } from './bots/SprucebotLlmBotImpl.js';
|
|
3
|
-
export { default as SprucebotLlmSkillImpl } from './bots/SprucebotLlmSkillImpl.js';
|
|
4
|
-
export { default as OpenAiAdapter } from './bots/adapters/OpenAi.js';
|
|
5
|
-
export * from './llm.types.js';
|
|
6
|
-
export { default as SprucebotLlmError } from './errors/SpruceError.js';
|
|
7
|
-
export { default as MockLlmSkill } from './tests/MockLlmSkill.js';
|
|
8
|
-
export { default as SpyLllmBot } from './tests/SpyLlmBot.js';
|
|
9
|
-
export { default as SpyLlmAdapter } from './tests/SpyAdapter.js';
|
|
10
|
-
export { default as SpyOpenAiApi } from './bots/adapters/SpyOpenAiApi.js';
|