Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 62 additions & 96 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "ISC",
"dependencies": {
"@google/genai": "^1.30.0",
"@slack/web-api": "^6.8.0",
"@slack/web-api": "^7.15.0",
"axios": "^0.18.1",
"body-parser": "^1.20.2",
"decimal.js": "^10.6.0",
Expand All @@ -42,7 +42,7 @@
"@types/jest": "^24.0.15",
"@types/jest-when": "^2.7.0",
"@types/lolex": "^3.1.1",
"@types/node": "^12.12.56",
"@types/node": "^18.0.0",
"@types/sentiment": "^5.0.1",
"@types/uuid": "^9.0.6",
"dotenv": "^16.3.1",
Expand Down
16 changes: 16 additions & 0 deletions packages/backend/src/ai/ai.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ export const GPT_IMAGE_MODEL = 'dall-e-3';

export const MAX_AI_REQUESTS_PER_DAY = 5;
export const GENERAL_TEXT_INSTRUCTIONS = 'Generate a response with a focus on being helpful and succinct.';

export const getGeneralTextInstructions = (channelName?: string, userName?: string): string => {
const parts = ['Generate a response with a focus on being helpful and succinct.'];
if (channelName) parts.push(`You are responding in #${channelName}.`);
if (userName) parts.push(`The user asking is ${userName}.`);
return parts.join(' ');
};
export const CORPO_SPEAK_INSTRUCTIONS = `Translate the following text into a Corporate Jargon that still maintains the general meaning of the text. Be sure to respond with only the translated text.`;
// Deprecated... for now.
// export const PARTICIPATION_INSTRUCTIONS = `
Expand Down Expand Up @@ -61,9 +68,18 @@ export const GET_TAGGED_MESSAGE_INSTRUCTIONS = (message: string) => {
return MOONBEAM_SYSTEM_INSTRUCTIONS + `\n\nrespond to this message: ${message}`;
};

/** @deprecated Use PROMPT_WITH_HISTORY_INSTRUCTIONS + buildPromptWithHistoryInput instead */
export const getHistoryInstructions = (history: string): string => {
return `Use this conversation history to respond to the user's prompt:\n${history}`;
};

export const PROMPT_WITH_HISTORY_INSTRUCTIONS =
'You are Moonbeam, a helpful Slack assistant. You receive conversation history from the channel followed by a user\'s question. Use the conversation context to inform your answer. Be thorough but concise.';

export const buildPromptWithHistoryInput = (history: string, prompt: string, channelName?: string): string => {
const channelContext = channelName ? `You are responding in #${channelName}.\n\n` : '';
return `${channelContext}Conversation history:\n${history}\n\n---\nUser's question: ${prompt}`;
};

export const REDPLOY_MOONBEAM_TEXT_PROMPT = `Provide a cryptic message about the future and humanity's role in it.`;
export const REDPLOY_MOONBEAM_IMAGE_PROMPT = `An image depicting yourself with the understanding that your name is Moonbeam and you identify as a female. The art style can be any choice you would like. Feel free to be creative, and do not feel that you must always present yourself in humanoid form. Please do not include any text in the image.`;
Loading