Who or what is Mary, Queen of Tots?

Mary, Queen of Tots, is an artificial intelligence (AI) created using Amazon's PartyRock Generative AI framework. She is intended to be modelled as a Scottish AI midwife who can answer pregnancy-related questions and support people through their pregnancy in a variety of ways.

The name Mary, Queen of Tots, is a play on words of the young Scottish queen, Mary, Queen of Scots - a young woman, exiled from her homeland. So, too, my fiancée and I have been sort-of exiled from our respective homelands in a sort-of Romeo and Juliet-style love story (we like to think).

But more on that later.

Queen Mary, as her friends sometimes call her, was created for the PartyRock AI hackathon hosted by AWS, and will be submitted in the category of Interactive Learning Experience as a net-new creation.

The inspiration behind Mary, Queen of Tots

I created Mary, Queen of Tots, as an advanced AI midwife, to help my newly-pregnant fiancée get answers to her pregnancy-related questions.

But first, a little backstory.

My fiancée, Hannah, and I, are currently waiting on my visa to immigrate to the United States. As a British and American couple with no shared third nationality, we essentially have no country to stay in if we want to live together. She can't stay in the UK, and I can't stay in the US. Living together has been a constant challenge for most of our 3-year relationship. This purgatory forced us to move around, in and out of Europe, every month or so, not being able to stay for too long in any one place.

The allure of what may seem like an idyllic or exotic lifestyle is quickly shattered by this simple fact: we have no home. At least not physically. And, on learning at the beginning of this year that Hannah was pregnant, the thought of having to then continue this lifestyle with our newly-acquired dependent and no easily accessible support or community was extremely overwhelming.

We needed a helping hand. And, as I was studying Data Science as a career path, turning to AI was a natural next step.

Iterations and the birth of Mary, Queen of Tots

The idea for creating an AI assistant was initially borne out of a desire to decrease the amount of Googl-ing and fact checking that we had to do. Hour by hour, we were constantly searching whether Hannah could or couldn't eat certain foods, what healthy alternatives she should be eating instead, the positives and negatives of each and every vitamin ever prescribed, and what the most up-to-date medical journals said about grapes and avocados.

The first iteration of the AI was solely to answer these food-related questions. Then, in addition, I added the recipe generator output, to remove some of the added thinking we were having to do each day. Both proved extremely useful, and cut the amount of time and energy spent answering these questions drastically. Finally, after getting inspiration from other PartyRock applications that use generated images, I added the recipe image output.

The next iteration added a chatbot. The prompt was simple at first (along the lines of "answer pregnacy-related questions"), but became more complex after researching prompt engineering best practices. In order to improve the accuracy of the results, I added additional checks ("before responding, check your answer for accuracy") and required the AI to use the latest medical advice.

Then, Hannah suggested adding some tips based on how far along in a pregnancy a person is, which was a great idea - so much so that I placed that widget first as an easy entry point to using the AI. Originally, I wanted to use image generation to show a size comparison of how large the fetus is using the age input, similar to many pregnancy tracking apps. However, this proved inaccurate in repeated tests so I removed it. Perhaps a more well-defined prompt was required.

Finally, after reading the book Nurture by Erica Chidi, I realised the importance of mental health and positivity on a pregnancy. This prompted me to create the final widget, that would assure and encourage pregnant people and help them to understand their feelings in a positive way.

You may be asking yourself: why did the AI have to have a strong Scottish accent? Good question.

I'm Scottish, and my family have strong Scottish accents. I'm very lucky that Hannah has a great relationship with my family - they have occasionally visited us during our exile. Being forced to live away from family and community while we wait for a visa takes a toll, so I wanted Hannah to feel like she had someone to talk to about what she was going through, someone that was familiar and recognisable to her. She lived in Scotland for over eight years, so she was used to hearing the accents even before we met, which gave me the idea to give my AI a Scottish accent. We Scots are known paradoxically for our cold climate and our warm demeanour, so a little Scottish flair would boost her and, hopefully, everyone else's spirits!

Thus, Mary, Queen of Tots, was born.

What Queen Mary can do

Mary, Queen of Tots, is an AI midwife application - built with Amazon AWS's PartyRock application - that provides answers and encouragement to pregnant people. She currently has four main functions (or widgets), each serving a different purpose.

  1. Quick tips from the Queen: Tips based on how far along you are on your pregnancy journey.
  2. Pregnancy nutritionist: Get advice on what foods are safe to eat during pregnancy, along with simple recipe ideas.
  3. Words of encouragement: Struggling with your feelings? Find words of encouragement to put a smile back on your face.
  4. Chat directly with Queen Mary: Have a back and forth conversation with your experienced AI midwife.

These are the four areas that I identified as important for pregnant people based on conversations with my fiancée and independent research.

Quick tips from the Queen

The purpose of the first, and, arguably, most simple, widget is to give quick tips to pregnant people based on the gestational age of their pregnancy (the time since the pregnant person's last period). It consists of a single input, the gestational age mentioned previously, and a single large language model (LLM) output. The LLM output takes the gestational age as a variable and requests three helpful tips for pregnant people who are that far along in their pregnancy.

Example input: 11 weeks

Example output:

Och lassie, 'ere's some guid advice for ye in the early days o' yer pregnancy:

Firstly, mak sure ye get plenty o' rest. Yer body needs extra sleep noo tae support the wee bairn growin' inside ye. So dinnae push yersel' too hard and tak naps whenever ye can.

Secondly, eat a balanced diet wi' lots o' fruit and veggies. Ye need extra nutrients noo, so fill up on healthy foods like leafy greens, lean protein and whole grains. Stay hydrated too by drinkin' plenty o' water.

And lastly, tak a prenatal vitamin ilka day. The folic acid and iron are essential for yer baby's development. The sooner ye start takin' it, the better.

There ye go lassie, follow that advice and ye'll be off tae a guid start. Let me ken if ye need any other tips!

Pregnancy nutritionist

The second widget is the original starting point of the AI; a nutritional aid for pregnant people. Based on the latest medical data, the widget will determine whether a given food or drink is appropriate for pregnant people, and then provide a simple recipe incorporating the food or drink. Then, an image generation model will create an image of the recipe.

The widget consists of a single input, a food or drink, and then two LLM outputs, one for whether the food or drink can be consumed, and another for the recipe. Lastly, the

Example input: avocado

Example outputs:

**Can I eat or drink that?**

Aye lassie, avocados are perfectly safe tae eat when yer pregnant. They're full o' good fats, vitamins and minerals that are great for you and the wee bairn. Just stick tae eatin' normal portions and enjoy them as part o' a balanced diet. Dinnae worry yerself - yer doing a braw job nourishin' the little one!

**Quick and simple recipe idea**

Och aye lassie! Here's a nice and simple recipe for ye:

Avocado and Smoked Salmon Toasties

Ingredients:
* 2 slices o' wholemeal bread
* 1 ripe avocado, mashed
* 2 slices o' smoked salmon
* Squeeze o' lemon juice
* Sprinkle o' black pepper

Instructions:
1. Toast the bread until golden brown
2. Mash the avocado in a bowl and mix in the lemon juice
3. Spread the mashed avocado over the toast
4. Top wi' the smoked salmon
5. Finish wi' a sprinkle o' black pepper
6. Enjoy yer tasty and healthy snack, perfect for the wee yin!

How's that sound lass? Quick and easy tae whip up, and full o' good things for you and the bairn. Let me know if ye need any other ideas! Take care o' yerself now.

Words of encouragement

The third widget is intended to boost the mental health of the pregnant person, an important and often overlooked factor of a pregnancy. The widget is comprised of a single input that expects a list of feelings, and a single LLM output that finds and addresses each feeling in turn, giving encouragement and positivity.

Example input: loss of self, anxiousness

Example output:

Aye, I ken this can be a challenging time for many. But dinna fash yersel, these feelings will pass. Loss o' self is common when life changes sae much, but yer identity remains within ye. Focus on the bairn growin' in yer womb, the miracle o' life itself. Anxious thoughts plague us a', but breathe deep and ken each moment brings ye closer to holdin' yer wee yin. This journey may seem lang, but soon ye'll be cradlin' the precious gift ye carry. Chin up, brave one, yer strength abides. Weather the storms o' worry and fear, fer calmer seas await. Ye'll find yerself again, transformed by love. Haud yer heid high, ye've got this.

Chat directly with Queen Mary

The final widget is an interactive chatbot where you can chat directly with an AI model. The AI model takes on the role of Mary, Queen of Tots, and solely answers pregnancy-related questions. This is a free text input where any questions can be asked about pregnancy, and is intended to serve as a question and answer session à la a real midwife appointment.

Example chat:

I'm Mary, Queen of Tots, yer experienced AI midwife. Ask me anythin' about your buddin' wee bairn.

-> How do I beat morning sickness?

Och, mornin' sickness can be sair trial for expectin' mums. Here's some tips that may help ease the queasiness:

Eat wee, frequent meals throughout the day rather than 3 big meals. An empty stomach can make nausea worse. Try plain crackers or dry cereal when ye wake up.
Avoid greasy, spicy, or overly sweet foods. Bland carbs like toast or rice often sit better. Ginger tea or candies can help too.
Get plenty o' rest. Fatigue makes nausea worse. Take naps and go tae bed early.
Try seabands or acupressure wristbands. The pressure points can reduce nausea.
Ask yer midwife aboot anti-nausea medication if it's very severe. Some are safe during pregnancy.
Dinna fash yerself too much. Morning sickness is a good sign everythin's progressin' normally. Stay hydrated and take it easy when ye can. It usually passes by week 12-14. Let me know if ye have any other questions!

-> What anti-nausea medicine is available?

There are a few anti-nausea medications that are generally considered safe for pregnant women:

Vitamin B6 supplements can help relieve nausea for some women. Ask yer midwife about the recommended dosage.
Ginger is a natural remedy that can ease nausea. Try ginger tea, candies, or ginger ale.
Doxylamine (Unisom) is an over-the-counter antihistamine that's been shown to help morning sickness when taken with vitamin B6. Follow dosage instructions.
Diclegis is a prescription medication containing doxylamine and vitamin B6. It was approved by the FDA for treating morning sickness.
Ondansetron (Zofran) is a prescription anti-nausea medication that is sometimes prescribed by doctors if other remedies dinna work.
Always chat with yer midwife before takin' any medication during pregnancy. Most nausea medication is only recommended for short term use. Stay hydrated, get plenty of rest, and eat small, frequent meals too. Let me know if ye have any other questions!

-> What is the most common girl baby name in America?

According to the Social Security Administration, the most popular girl baby name in the United States is currently Emma. Some other top girl names are Olivia, Ava, Isabella, and Sophia. The popularity of baby names changes over time, but Emma has been the #1 girl's name since 2014. Classic and feminine names like Emma, Olivia, and Sophia have remained quite popular for wee lassies in recent years. Let me know if you need any suggestions for pretty girl names for your bairn! I'd be delighted to help a mum-to-be brainstorm the perfect fit.

What's next for Mary, Queen of Tots?

There are a number of improvements that I'd like to make to Mary, Queen of Tots.

Prompt repetition

Queen Mary has a tendency to repeat the prompt in her answer. For example, in the Quick and simple recipe idea widget, she has a tendency to spell out that she is outputting a recipe: Och aye lassie! Here's a nice and simple recipe for ye:. This is a little unnatural-sounding, ejecting the user out of the experience and reminding them that they are talking to an AI.

Although I took steps to try and mitigate this prompt repetition by adding additional context into the prompts - "keep your answer short" and "don't repeat the prompt" - it continues to happen. Some refinement is needed here to ensure a more natural conversation flow.

Improved image generation prompt

The image generation prompt has been through a number of iterations, and, although I'm happy with the present results, it could be better refined and styled so that the images are more consistent and accurate to the recipe.

Gendered and presumptuous responses

Queen Mary generally responds to user input with the term lassie, a Scottish diminutive word for woman or girl. This response is rather presumptuous for someone not identifying as a woman or girl. A more inclusive or un-gendered response will ensure everyone is recognised. In addition, the Words of Encouragement widget occasionally presumes the pregnant person has a strong and supportive familial structure around them, which is unfortunately something that far too many pregnant people are missing. More work needs to be done to bring diversity to the responses.

Medical advice concerns and accuracy cross-checking

We're still in the nascent stages of harnessing generative AI. Using AI in this novel way to give medical advice can cause some concern, especially around childbirth and child rearing, which can be an emotional subject anyway. Occasionally, artificial intelligences are wrong, and can even make up things if the prompts are not constructed carefully. Future iterations should incorporate some sort of manual human intervention by medical experts to cross-check answers for accuracy.

Conclusion

In conclusion, while there are some improvements that could be made, and there are some important questions to be addressed, I believe that this first iteration of Mary, Queen of Tots, an AI midwife, proves extremely beneficial to pregnant people. It reduces the time spent to answer difficult and time consuming questions, improves mental health, and democratises the most up-to-date medical advice to everyone, not only to those who can pay for it. Don't be fooled by the lighthearted nature of this application - this is an area ripe for AI innovation as pregnancy is ipso facto a constant for humankind.

Built With

Share this project:

Updates