Welcome to the episode 2 of AI Tribe 1-1-1 : A Biweekly newsletter designed to spark your interest in AI tools, concepts, applications and research !
My last post on generative AI and ChatGPT got a good response. I believe you could make most out of it. This post will be aligned towards mastering prompts.
Getting the best result from a Generative AI model is mostly about guiding your LLM the right way with proper instructions. Well that’s our article for today. This guide will also be a starter for anyone who want to build their own chatbots, using ChatGPT API → OpenAI. In fact in almost every tech startups nowadays the engineers are encouraged to learn this technology for building innovative chatbots. Are you one ? I will look for you in comments :P
Let's dive right in and see what we've got.
⚙️ Tool : Perplexity - for Online research
Perplexity is a chatbot similar to ChatGPT.
Except it can search internet, Cites its sources , is powered by GPT-4 and is completely free . Wow that’s super cool !
In copilot mode, it learns your preferences and can make recommendations based on what you like.
Try the prompt in copilot mode :
Personal travel guide.
" Create a 10-day itinerary for a solo trip to Europe. Include favorite restaurants, activities, and must-see sights. "
😇 Today’s Recipe : Prompt Engineering .
So how do we guide LLM response in a desired direction ? Are there any techniques involved for crafting the input prompts that are given to the LLM ? 🤔
Prompt engineering is a set of techniques that can be used to improve the performance of large language models (LLMs) on a variety of tasks. I have attached an article down below if you want to know more and apply the knowledge for building your very own chatbot.
✨ 5 step Iterative approach - Here you start with a basic prompt and then based on the results of your experiments refine it . The framework I will be sharing today works perfectly for text-to-text generation tasks that are mostly non-creative. We will look at prompt engineering for other tasks in our upcoming posts .
Limit the length of response : “ Use at most 50 [words/ characters] ”
Tone of response : “Rephrase in [Creative/Professional] Tone ”
Focus : “ focus on any aspect that [mention / is relevant to] ”
Task : “Summarize” , “extract [links]” , “Infer [sentiment/mood] ”,
“proofread and correct”, “ Translate into [English] ”
Format : “ format into [table / list / JSON object/ HTML ] ”
👌 Here is a much more detailed guide for you ninjas : promptingguide.ai
P.S : Refer a friend and unlock exclusive offers waiting for you !
🔗Article : Guide your LLM the right way !
Most of these LLM’s are based on Reinforcement learning that can take human feedback. The first prompt you write is unlikely to be the one you end up using in the final application.
Instead, the first step is to come up with an idea for what you want to do. Once you have an idea, you can then write a prompt and run an experiment. The results of the experiment will tell you how well the prompt worked. If the prompt didn't work well, you can then refine it and run another experiment. This process can be repeated until you find a prompt that works well for your application. Asking right questions will be helpful too. Infact guiding an AI model with follow-up questions is actually a technique that can be applied to any creative tasks. A best example would be poetry, where complex emotions and ideas are conveyed.
Note - For building chatbots the first thing is to have a perfect prompt template. A prompt template can be considered as an input to LLM that can solve a specific problem. Chatbots with novel capabilities can involve multiple LLM’s. LangChain is an open source software development framework designed to simplify the creation of applications using LLMs. We will look at Langchain in detail in our next post.
Using OpenAI’s LLM for chatbot - Once your desired prompt is ready, you can build custom chatbots with only a modest amount of effort using OpenAI package in python . Did you just say you have zero knowledge of the framework? Take LLM help again :P. Not kidding, There are some code completion LLMs out there that might give you the exact code that works, when you ask right questions. If not, they can atleast suggest some code improvements. You can call it a virtual pair programmer 🔥. I instead recommend going through a short course that is linked below, taught by our legendary guru Andrew NG.
🤖 Now that you got the secret recipe , I encourage you to build your own chatbot by heading over to the playground → deeplearning.io
Thanks for reading 😄.
I really enjoyed making this for you and sincerely hope you find it useful.