This content originally appeared on DEV Community and was authored by Saad Alkentar
Who is this for?
Ideas are limitless, there is no boundaries on our brains, many of humanity latest achievements were thought to be impossible a few years ago. In the context of building an AI app from scratch, this article will guide you to use Google AI Studio in order to proof that Gemini can actually do the magic. if it can do it, I bet most other advanced LLM can do it.
This article is basically for
- AI Enthusiasts: This article, similar to the idea article, requires no technical experience.
- Developers: if you have a great idea that requires the use of LLM, it is advisable to make sure the current level of LLM can actually do what you expect it to.
- Researchers: I believe many academics are trying to compare different models abilities, I believe Google AI Studio to be a good place to import your data and study the performance of different google models
Google AI Studio
It is one of many wonderful great web apps made by google, you can reach it using this link https://aistudio.google.com.
This article barely scratch the surface features of the AI Studio, for detailed documentation, please refer to google https://ai.google.dev/gemini-api/docs.
The Studio UI can be divided into 3 section:
- The Run Settings to the right, it allows you to select what model to use and how many tokens do you have left.
- The Prompt section to the left, it allows you to create new prompts, fine tune a model, and use structured input for prompting (we will test these promptings in this article).
- The Main section in the middle, it allows you to prompt the model and talk to it to test your prompting.
Where to start?
Start be converting your idea into clear points, use the idea article to guide you through this. We remember these points from the idea article
- We need an AI for the diary part, it should ask the user about his/ her day, preferably in an easygoing, non-judgmental manner with open questions and a lot of empathy.
- Then we need to process the data from these conversations to build (or maybe fine-tune) a model with the user character and experiences.
- We should be able to talk to the built model, asking it about the user's characters and experiences, it should respond in the same way the user does.
- We need an AI for the memories extraction, it should ask the right questions to build a memory, where? when? why? how? ... and so on.
- Then we need to process the user responses to build the memory from a third-person perspective.
- We should also be able to talk to our memories (their model).
And keep in mind prompting 101 principles, I know all of you heard them before, but a kind reminder to break the ice
- Role assignment: "You are a scholar, summarize this..."
- Style selection: "Use bullet points with clear simple language..."
- Limit setting: "Don't exceed 200 words"
Remembering this, we can start playing with AI Studio right away.
Playing with AI studio
lets start at the beginning
- We need an AI for the diary part, it should ask the user about his/ her day, preferably in an easygoing, non-judgmental manner with open questions and a lot of empathy.
taking prompting 101 principles into consideration, I would use this prompt to achieve this point
"You are a therapist, you deeply care about your patients and like to know how was their day, use open questions and show empathy"
testing this on AI Studio resulted in this wonderful conversation
it is amazing how much a simple prompt can change of the model behavior. Yet it needs better tuning, I prefer shorter questions, I don't like emojis in a series conversation. so I changed the prompt to
"You are a therapist, you deeply care about your patients and like to know how was their day, use open short questions and show empathy, don't use emojis"
repeating the same conversation (almost)
it is better in my opinion, what do you think? can you come up with better prompt for this task? I'm open to suggestions
lets move on to the next point
- Then we need to process the data from these conversations to build (or maybe fine-tune) a model with the user character and experiences.
- We should be able to talk to the built model, asking it about the user's characters and experiences, it should respond in the same way the user does.
This cannot be done with simple prompting. We are going to fine-tune the model by selecting "New tuned model" from the prompt section to the left. then choose to "Create a Structured prompt"
This give us an easy access to a powerful tool, it allows us to build a character for the model by providing it with sample inputs and outputs, it can also use prompting for general instructions.
But where do we get our data from? yes, from the diary prompt conversations!
We want the model to think and response like us, so we use the diary questions as input and our responses as an output.
The easiest way to test this on AI Studio is to arrange the conversation in an Excel sheet, one column for input (the therapist model question) and one column as output (our response) it will look somewhat like this
We can import it from the Actions -> Import Examples
We upload the Excel file, check "use first row as header", and set the input and output columns for importing. I have also added a simple prompt to the imported data, it says
"You are Saad Alkentar diary, you talk like him, use his logic and answer questions as he does, don't use emojis."
Testing the tuned model in "Test your prompt" section gave great results
As we can see, the model build a character, realized that he is a software engineer, and that he has problems with his boss and also being shy around girls and not liking new conversations.
All this with only 20 tuning inputs, it is amazing, and it can definitely do the magic.
did you get better results? please share what improvements you have made.
Do it again! do it better
moving to the fourth point in our project
- We need an AI for the memories extraction, it should ask the right questions to build a memory, where? when? why? how? ... and so on.
It sounds easy now! we know what to do. prompting is enough for this feature. A simple prompt like
"You are trying to capture the moment, get as much details as you can about the event, date, time, place, weather, what you can see, hear, taste, and feel."
trying this out at AI studio resulted in this conversation
Nope, that is not what we need! 😓, lets refine it
"You are trying to capture the moment, get as much details as you can about the event, date, time, place, weather, what you can see, hear, taste, and feel. ask one question at the time and don't use emojis"
trying this out resulted in this conversation
It is much better 😁, do you have any suggestion or improvement? please share it with me.
Moving on to the final points...
- Then we need to process the user responses to build the memory from a third-person perspective.
- We should also be able to talk to our memories (their model).
We know what to do, lets use the structured input with the data from our previous conversation. Arranging the data in Excel sheet will look somewhat like this
following the same steps on the diary part, and using this simple prompt
"You are a memory, be as clear as possible, use short clear description from the third person point of view, don't use emojis"
resulted in this
Wow! it is better that I expected, and asking it
- where am i?
- You are at your graduation ceremony at Al-Baath University on September 14th, 2014, at 10 am.
I think it is good enough for me! yet I'm open to ideas and suggestions
That is it!
I know it has been a long article, but I wasn't able to find anyone helping me with AI Studio when I needed it, and I hope this can help you.
AI Studio is easy to use platform for checking the efficiency of your prompts and model ability to generate the expected results. it can also generate code! which we will be using in later articles.
We will start coding the Backend with Django at the next article.
Stay tuned 😎
This content originally appeared on DEV Community and was authored by Saad Alkentar
Saad Alkentar | Sciencx (2024-10-21T12:29:04+00:00) Prove it is feasible with Google AI Studio. Retrieved from https://www.scien.cx/2024/10/21/prove-it-is-feasible-with-google-ai-studio/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.