Begin Your AI Journey Today

Every business process has unique challenges, and we build focused tools that solve real problems for real teams.

Contact Info
2810 N Church St PMB 616455
Wilmington, Delaware 19802-4447
support@sagaiq.ai
Follow Us

Everybody Needs a Friend – Prompt Engineering – for us beginners

Did you have an imaginary friend growing up? I did. His name was Barney. (No, he was not a purple dinosaur, that is several years after my youth.) I am not sure when he started or when he left but he was around for a while and he was a good friend. While having an imaginary friend might seem a bit childish, no matter what our age, we could all use a good friend right? As we get older, we are hoping for better conversations from our friends and maybe they can bring some knowledge or expertise to our interactions. I don’t remember any specific advice from Barney but we did seem to agree on a lot of things especially when my older sister was mean to me. So what does all of this have to do with GenAI?

Imagine having a friend who can answer any question, provide insights on any topic, and even offer personalized advice. Sounds too good to be true? Well, it’s not, thanks to the power of prompt engineering and LLM’s! In this article, we’ll delve into the world of creating a virtual friend using AI Assistants) and explore how to refine them using context, variables, and feedback.

What is Prompt Engineering?

Prompt engineering is the art of crafting requests for AI that elicit desired responses. These requests are sent to LLMs which are trained on vast amounts of data and can generate human-like text based on the input they receive. By carefully designing these requests, called prompts, we can influence the output to be more accurate, relevant, or even creative.

Creating a Virtual Friend

Back to our imaginary friend scenario. Let’s create an imaginary friend – we will call them “Jane” – an AI friend designed specifically for you. With JaneAI, you can ask any question, and they will respond with an answer that’s tailored to your interests and needs. But how do we make JaneAI more intelligent, empathetic, and helpful to us? The key lies in prompts and using context, variables and feedback in our prompts. Let’s work through an example.

Create "imaginary firends" with AI Assistants

Let’s start off with an example of something we want to ask JaneAI. Ok, my in-laws are coming over for dinner, I need to make a meal and I am all out of ideas. Let’s see how JaneAI could help us.

Start with Context

Context is essential when interacting with LLMs like our friend JaneAI. By providing a specific background or situation, you can help her understand the nuances of your question. For our example, I wish Jane was an expert chef. So for the first line of my prompt I would type:

Context: You are a world renowned chef.

Asking the Ask

The Prompt is what you are actually asking your friend to do. It’s important to be as clear and specific as possible. This one is pretty easy.

Prompt: Create a flavorful meal for 4 people.

Using Variables

So far so good but it’s never that simple with in-laws is it? My mother-in-law happens to be a vegetarian and my father-in-law is slightly diabetic. How can I let JaneAI know? I could write out a longer prompt explaining but I prefer to use Variables. Variables allow you to control specific parameters that influence the output. Here is how they work. I’ve added a few requirements for my meal that I now need. I would list them out in my prompt as:

Requirements:

  1. One person is vegetarian.
  2. One person is slightly diabetic.
  3. Make the meal as healthy as possible.

And I would also have to adjust my prompt to use the requirements. So it would now look like:

Prompt: Create a flavorful meal for 4 people. Using the "Requirements" below.

By putting it in quotes, JaneAI will now understand. So my full prompt looks like this:

Context: You are a world renowned chef.
Prompt: Create a flavorful meal for 4 people. Using the "Requirements" below.
Requirements:

  1. One person is vegetarian.
  2. One person is slightly diabetic.
  3. Make the meal as healthy as possible.

Depending on your LLM your results might vary but here is the beginning on the response I got from my friend JaneAI:

Sun-Kissed Mediterranean Feast

As a world-renowned chef, I'm excited to create a delicious and healthy meal that caters to everyone's dietary needs. For this 4-person dinner party, I've carefully crafted a Sun-Kissed Mediterranean Feast that will delight both vegetarians and those with dietary restrictions.

Menu:

  • Starter: Grilled Vegetable Skewers with Lemon-Herb Quinoa
  • Main Course: Herb-Crusted Salmon (for the non-vegetarian) paired with Roasted Vegetables and Quinoa Pilaf
  • Side Dish: Sautéed Spinach with Garlic and Lemon
  • Dessert: Fresh Fruit Tart with a hint of Honey

with recipes that follow. Jane even told me the precautions they took.

Diabetic Considerations:

For the slightly diabetic individual, I've taken the following precautions:

  • Used herbs and spices to add flavor instead of salt and sugar.
  • Selected vegetables that are naturally low in carbohydrates and sugars.
  • Excluded high-carb ingredients like bread and potatoes from the menu.
  • Paired protein sources with complex carbohydrates like quinoa and whole grains.

Vegetarian Delight:

For our vegetarian friend, I've created a separate dish featuring grilled vegetable skewers with lemon-herb quinoa. This meal is not only delicious but also packed with nutrients and fiber.

All is looking good…until my wife reminds me that her father doesn’t like Garlic. (Damn vampires are everywhere.)

Ask your Virtual Friend for more

So, now I have to tell JaneAI to adjust. The secret lies in giving feedback. LLMs like JaneAI learn from the interactions they have with you. By providing feedback on their responses, you can help them improve their accuracy and relevance.

Here is what I would tell JaneAI to adjust the menu (I didn’t mention vampires).

Great menu! Please adjust it to not use any garlic.

Once again my new chef friend comes up with an outstanding menu.

Garlic-Free Sun-Kissed Mediterranean Feast

As a world-renowned chef, I'm happy to modify the menu to accommodate a garlic-free diet for everyone's enjoyment. Here are the adjusted recipes:

Menu:

  • Starter: Grilled Vegetable Skewers with Lemon-Herb Quinoa
  • Main Course: Herb-Crusted Salmon (for the non-vegetarian) paired with Roasted Vegetables and Quinoa Pilaf
  • Side Dish: Sautéed Spinach with Lemon and Olive Oil
  • Dessert: Fresh Fruit Tart with a hint of Honey


Recipes:

  1. Grilled Vegetable Skewers with Lemon-Herb QuinoaIngredients:1 cup mixed vegetables (bell peppers, zucchini, cherry tomatoes)2 tablespoons olive oil1 tablespoon lemon juice

...and so on.

By following these steps, you can create a virtual friend like JaneAI that’s intelligent, empathetic, and helpful. Whether it’s answering questions, providing insights, or simply chatting with you, prompt engineering has the power to revolutionize your interactions with LLMs. So go ahead, give JaneAI some feedback, and watch her evolve into an even more amazing virtual friend!

NB: Like with all friends – don’t take LLM’s advice blindly. They aren’t perfect but they can help greatly and we all could use a little help from a friend.

Now for my next prompt:

Context: Your name is Barney and you are the best friend of a two-year-old boy

Post a Comment