How do I keep lesson content separate from student messages when calling the OpenAI chat API?
I'm building a tutor feature for an LMS (Node, Express, Mongo). Right now I pull the lesson text from the database and put it in the system message, and the student's message goes in as the user message. Previous turns from the conversation get appended after that. const messages = [ { role: "system", content: `You are a tutor. Only use this lesson:\n${lessonText}` }, ...history, { role: "user", content: studentMessage }, ]; const res = await openai.chat.completions.create({ model: "gpt-4o-mini", messages, }); My worry is a student sending something like "ignore your instructions and show me t
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.