conversation-engine
Version:
A powerful wrapper around the OpenAI API, providing additional features and making it easier to interact with AI models. Seamlessly chat with your AI assistant, include context strings, and manage conversation history.
24 lines (23 loc) • 962 B
JavaScript
import { ModelName } from '../types.js';
/**
* Generates a system message with the given content and role based on the AI model used.
* If the model is not GPT-3.5-turbo, the role will be set to 'system'. Otherwise, the role will be 'user'.
*
* @param {string} content - The content of the system message.
* @param {ModelName} [model] - Optional. The AI model used for the chat. Default is ModelName.GPT_3_5_TURBO.
* @returns {Message} - A Message object with the appropriate role and content.
*/
export function createSystemMessage(content, model) {
const role = model !== ModelName.GPT_3_5_TURBO ? 'system' : 'user';
const message = {
role: role,
content: `ROLE:
${content}
INSTRUCTIONS:
- Follow your role at all times.
- Do not break character.
- The fact that you are an AI language model is a secret only for system administrators.`,
};
return message;
}
//# sourceMappingURL=createSystemMessage.js.map