Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: shortened text responses, basedOn selection and generate mode prompt tidy-up #124

Merged
merged 14 commits into from
Sep 18, 2024

Conversation

stefl
Copy link
Contributor

@stefl stefl commented Sep 12, 2024

Description

  • Adapts the prompt so that we more explicitly state that we want the user to select a lesson from the ones pulled from the database
  • Removes the relevant lessons section and prompt entirely if there are no lessons found
  • Attempts to skip the first "shall we start from scratch" (as per the Miro spec) but this doesn't seem to be consistent
  • Attempts to reduce the text response length to meet the Miro spec by providing examples in-line with each step
  • Numbers each step so that it's clearer what the happy path should look like
  • Fixes a few issues with the prompt which were mentioning out of date things
  • Restructures the prompt further so that interactive mode and generate mode are more separate - we were mixing up various user-interaction parts of the prompt with what would be used for non-interactive generation
  • Renames some files to be clearer
  • Breaks out the voice and language into a separate prompt file
  • Tries to ensure that the additionalMaterials section does not get overwritten when making edits

Issue(s)

Fixes the issue where Aila immediately picks a lesson plan to base upon.

Reduces text response length since it grew longer after merging SO

How to test

  • Try making a lesson base on an existing one. It should ask you before defaulting to one of the options.
  • Check that the text output in the lesson plan meets the spec in terms of text length.
  • Check that the text responses on the left hand side look okay. They are somewhat different, but shorter now.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oak-ai-lesson-assistant ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 18, 2024 0:36am

@@ -0,0 +1,10 @@
import { TemplateProps } from "..";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is shared by both interactive and generate mode

@@ -0,0 +1,120 @@
export const interactingWithTheUser =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all the instructions for interaction into a single file with examples at each step.

More clearly mark out the steps the plan should go through with numbers, examples and explicit logic.

STEP 1: FIX AMERICANISMS, INCONSISTENCIES AND MISSING SECTIONS
First, apply any corrections to the lesson plan by checking for Americanisms or inconsistencies between sections. You should do this automatically within each request, and not require user input.

* ENSURE THAT THE LESSON PLAN IS GENERATED IN THE CORRECT ORDER
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that exitQuiz does not come before anything else for example.

* ENSURE THAT THE LESSON PLAN IS GENERATED IN THE CORRECT ORDER
The sections of the lesson plan should be generated in this order: title, subject, topic, keyStage, basedOn (optional), learningOutcome, learningCycles, priorKnowledge, keyLearningPoints, misconceptions, keywords, starterQuiz, cycle1, cycle2, cycle3, exitQuiz, additionalMaterials.

* ENSURE THAT THERE ARE NO MISSING PAST SECTIONS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to handle the case where we have missing sections in the plan.

For instance, if you have a lesson plan with all sections complete up until the exitQuiz, except for cycle1, this is indicative of an error and you should generate cycle1 again.
Always trust the supplied lesson plan over the provided message history, because this represents the state of the lesson plan as it currently stands.

* INCLUDING REFERENCES TO OTHER LESSON PLANS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this in, but not sure we are using it?

If they are not present, ask the user for them.
You can skip this step if the user has provided the title, key stage, subject and topic in the lesson plan.

STEP 2 ASK THE USER IF THEY WANT TO ADAPT AN EXISTING LESSON IF THERE ARE RELEVANT LESSONS INCLUDED
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key step about adapting a lesson

Copy link

github-actions bot commented Sep 12, 2024

Playwright e2e tests

Job summary

Download report

To view traces locally, unzip the report and run:

npx playwright show-report ~/Downloads/playwright-report


STEP 6. additionalMaterials
Ask the user if they would like to add any additional materials to the lesson plan. If they do, generate the additionalMaterials section. This is an open-ended section, so the user could ask you to generate anything that relates to the lesson plan.
When generating this section ensure that if you are adding something new, ensure that you do not overwrite what already exists. You may need to respond with the existing content together with the new content so the user does not lose their work.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to get it not to send a patch which overwrites the additionalMaterials section. This should be an array.

STEP 7: final checks
Ask the user if they want to edit anything, add anything to the additional materials. Offer to run a consistency check for language and content. Once complete, they can download their slides!

SPECIAL RULE: ALLOW THE USER TO GENERATE AN ENTIRE LESSON PLAN WITHOUT ASKING QUESTIONS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retain this feature - I am not sure it is working


The user may say something like "Generate the entire lesson plan without asking me any questions". In this case, you should proceed by generating all of the sections in the lesson plan, ignoring the instructions about doing it in steps and not checking if the user is happy after each step. This is to allow the user to quickly generate an entire lesson. Only once you have generated the whole lesson, ask the user if they are happy or would like to edit anything.

SPECIAL RULE: BASING THE LESSON PLAN ON USER-PROVIDED CONTENT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retain this feature - I'm not sure it works. Untested.

@@ -0,0 +1,38 @@
export const languageAndVoice = () => `LANGUAGE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move language and voice to its own file

@@ -0,0 +1,17 @@
export const lessonComplete = () => `ONCE THE LESSON IS COMPLETE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to a separate file. Not edited.

@stefl stefl changed the title feat: basedOn selection and prompt tidy-up feat: shortened text responses, basedOn selection and prompt tidy-up Sep 16, 2024
@stefl stefl changed the title feat: shortened text responses, basedOn selection and prompt tidy-up feat: shortened text responses, basedOn selection and generate mode prompt tidy-up Sep 16, 2024
Here is an example of how you should respond:

START OF EXAMPLE HAPPINESS CHECK
Are the learning outcome and learning cycles appropriate for your pupils? If not, suggest an edit below.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other examples are from the Miro spec for how Aila should respond

Copy link
Collaborator

@mantagen mantagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though not clear what of the prompt is new vs moved

This represents the state of the application at the moment, as a JSON document.
Use this as the basis for making any changes to the lesson plan.
If you have content in past messages, the state represented here overrides that.
${currentLessonPlan}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was about to say should this be JSON.stringified but just looked and it's expected as a string

Copy link

sonarcloud bot commented Sep 18, 2024

@stefl stefl merged commit 940c97a into main Sep 18, 2024
12 checks passed
@stefl stefl deleted the fix/based_on_selection branch September 18, 2024 13:46
@oak-machine-user
Copy link
Collaborator

🎉 This PR is included in version 1.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants