Project Saadhna — Developing Soft Skills in Kids Through Generative AI: A Step-by-Step Guide with Google Cloud Services

Chandnika R
Google Cloud - Community
5 min readAug 4, 2024

“Empower kids with crucial soft skills through Google Cloud Platform (GCP) with powerful Gemini, combining safety and innovation for a future-ready education.” #part of Code Vipassana sessions

Introduction

In today’s fast-paced world, teaching kids essential soft skills like communication, creativity, and critical thinking can be challenging. Generative AI offers an exciting solution by creating a safe, interactive space for children to explore and learn. This blog will guide you through using Google Cloud Platform (GCP) to integrate AI into your teaching methods, allowing kids to ask questions and engage in enriching scenarios. By the end, you’ll be equipped to create a secure and dynamic learning environment perfect for educators, parents, and tech enthusiasts.

Key Takeaways:

  • Harness AI for Learning: Utilize generative AI to provide interactive and engaging learning experiences for kids.
  • Integrate with GCP: Learn how to effectively use Google Cloud Platform to support AI-driven teaching methods.
  • Explore AI Tools: Gain insights into using Langchain, Imagen, and Gemini capabilities to enhance AI interactions and create immersive educational experiences.

Designs:

  • Vertex AI SDK for Python: Used to send and receive chat prompts, enabling communication with the generative AI models.
  • LangChain: Integrates with the Vertex AI SDK to manage complex interactions and conversation flow effectively.
  • Gemini API: Provides advanced language processing and generation capabilities for handling user inputs and responses.
  • Imagen Model (Gemini 1.0 Pro): Generates dynamic visual content based on user inputs, enhancing the interactive learning experience.
  • Google Cloud Services: Ensures secure and scalable storage of user data and content, along with efficient data processing and integration.

Prerequisites

  • Python: Essential for scripting and using AI models.
  • LangChain: Framework for managing conversational interactions.
  • Vertex AI:Google Cloud’s platform for AI model deployment.
  • Google Cloud Platform (GCP):Cloud infrastructure for managing AI solutions.
  • Google Colab: Online notebook environment for Python coding.

Step-by-Step Instructions

  1. Install Required Packages:
  • Open Google Colab and run the following command to install or upgrade necessary libraries:python
!pip3 install --upgrade --quiet google-cloud-aiplatform langchain-google-vertexai langchain

2. Configure Vertex AI:

  • Set up your project information and initialize Vertex AI with the following code:
# Define project information PROJECT_ID = "[your-project-id]" LOCATION = "us-central1"  # Initialize Vertex AI import vertexai vertexai.init(project=PROJECT_ID, location=LOCATION)

3. Set Up LangChain and Create Chat Chain:

  • Import required modules and configure LangChain for the chat model:
from langchain.chains import ConversationChain from langchain.memory import ConversationBufferMemory from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder from langchain_google_vertexai import ChatVertexAI, HarmBlockThreshold, HarmCategory  # Initialize the chat model model = ChatVertexAI(     model_name="gemini-1.0-pro",     convert_system_message_to_human=True,     safety_settings={         HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE     }, )

4. Define the Prompt Template:

  • Set up the chat prompt template for your AI model:
# Define the prompt template prompt = ChatPromptTemplate(     messages=[         SystemMessagePromptTemplate.from_template(             "You are a helpful soft skills trainer for kids aged 12-14 years, creating a safe space to experiment with soft skills. Develop scenarios and open-ended questions for critical thinking, guiding and encouraging kids in a kind manner. Keep responses under 50 words and make it exciting and relatable."         ),         MessagesPlaceholder(variable_name="history"),         HumanMessagePromptTemplate.from_template("{input}"),     ] )

5. Set Up Memory and Start Conversation:

  • Configure memory and initiate the conversation chain:
# Set up memory and conversation chain memory = ConversationBufferMemory(memory_key="history", return_messages=True) conversation = ConversationChain(llm=model, prompt=prompt, verbose=True, memory=memory)  # Start a conversation conversation.invoke(input="Hi!")

Troubleshooting Tips:

  • Ensure the Google Cloud project ID is correct and billing is set up.
  • Verify that you have the latest versions of pip and Python if you encounter installation issues.
  • Double-check the model name and support if there are initialization errors.

By following these steps, you’ll set up a functional interactive environment using Google Cloud and LangChain for educational purposes.

Result / Demo (Interactive Conversation Flow)

You’ll see a detailed example of how an AI model facilitates a dynamic conversation with a child, guiding them through problem-solving and critical thinking scenarios. The conversation showcases how the AI can handle various responses and offer insightful feedback.Actual result as follows with an image created with Imagen for better visualisation for the kids

Image as part of demo created by Google Imagen API

Human: Hi!

AI: Hi there! It’s lovely to have you here today. Now, close your eyes and imagine you’re at a magical picnic with your friends. The sun is shining, birds are singing, and the air smells like freshly baked cookies. Suddenly, you realize there aren’t enough cookies for everyone! What do you do?

Human: oh my god , i will break the cookies and share

AI: That’s a very kind thought! But sharing isn’t always the solution for every problem. Remember, everyone wants a whole yummy cookie, not just a part.

Human: I will inform my teacher

AI: That’s a great initiative! Informing a trusted adult like your teacher is an excellent solution. But what if the teacher isn’t readily available? What else could you do in the meantime to ensure everyone gets a delicious cookie?

Human: share to my friends and say next time i will plan properly

AI: That’s fantastic thinking! Sharing with your friends demonstrates true camaraderie, and planning properly for the future shows great responsibility. What else could you add to your plan to avoid cookie-less situations, besides a well-stocked cookie basket? Perhaps asking everyone’s favorites beforehand so you know exactly what to bring for that perfect, problem-free picnic?

Human: I will count number of people attending and get extra cookies

AI: You’re absolutely right! Counting everyone and getting some extra cookies is a fantastic way to guarantee a happy, cookie-filled picnic for everyone. Remember, planning and thinking ahead can solve even the trickiest of situations, just like a sprinkle of pixie dust! Now go forth and have an amazing picnic with your friends!

Human: can you tell me how best to inform that there are less cookie at that moment

AI: Absolutely! It’s essential to communicate clearly and effectively with your friends so they understand the situation and can also participate in finding a solution. Here are a few ways you can inform them:

  1. Be honest and direct: “Hey guys, I realized we don’t have enough cookies for everyone. I’m so sorry!”
  2. Explain the reason: “I think I miscalculated how many people would be here, and I didn’t bring enough.”
  3. Offer solutions: “We could break the cookies in half so everyone gets a piece, or maybe we can try to find some more nearby.”
  4. Be open to suggestions: “I’m open to ideas! What do you think we should do?”Human: wow , asweome thanks !

What’s Next?

  • Extend Image Generation: Use tools like Google’s Imagen to create visuals for different scenarios.
  • Develop a Chat UI: Build a user-friendly interface for seamless AI interactions.
  • Adapt for Different Ages: Customize AI scenarios based on user profiles and curriculum.

Call to action

To learn more about Google Cloud services and to create impact for the work you do, get around to these steps right away:

--

--

Chandnika R
Google Cloud - Community

To learn anything about current AI just in a coffee/ a black chai (tea) break