Saturday, June 28, 2025
News PouroverAI
Visit PourOver.AI
No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
News PouroverAI
No Result
View All Result

Google I/O 2024: Build a Cat Chatbot using Gemini on Android

May 23, 2024
in Cloud & Programming
Reading Time: 2 mins read
0 0
A A
0
Share on FacebookShare on Twitter



Gemini is a series of artificial intelligence (AI) models developed by Google, each designed for specific use cases. Google introduced the Gemini 1.5 Pro and Gemini 1.5 Flash models at I/O 2024. These models can be accessed through the Google AI Client SDK. This tutorial will guide you through creating an AI chatbot named CatBot using the Gemini 1.5 Pro model. CatBot will interact with a playful cat named Milo. Throughout the tutorial, you will learn how to set up the Google AI API Key, configure and integrate the Gemini model, create a chat UI, and implement safety checks. Let’s get started!

To begin, download the tutorial materials by clicking the Download Materials button at the top or bottom of this page. Then, open the starter project in Android Studio Jellyfish or a later version. The project focuses on CatBot, an AI-powered chatbot that allows users to chat with Milo the cat. The project includes the following files:
– MainActivity: Main Activity containing the Composables
– ChatMessage: Data class representing each message
– ChatScreen: Composable describing the chat screen
– ChatViewModel: ViewModel managing the chat screen state and message handling

Build and run the app to see the initial screen with an input field for chat messages and a send button. Currently, sending a message does not have any functionality, but you will address this as you progress through the tutorial.

First, you need to generate an API key to interact with the Gemini APIs. Visit https://aistudio.google.com/app to access the Google AI Studio. Select the Gemini 1.5 Flash model from the Model dropdown. Click on Get API key in the left navigation panel to create a new API key if you don’t have one already. Copy the generated API key and add it to the local.properties file in Android Studio.

Next, you will model the chat messages in CatBot. Define three types of messages: User messages, Replies from the model, and Error messages by creating a ChatParticipant enum class. Associate each chat message with a participant by adding a participant attribute to the ChatMessage data class.

To configure the Gemini model in Android, you will need to include the Google AI Client SDK dependency in the app-module build.gradle file. Create a new file named Model.kt and initialize the GenerativeModel with the necessary parameters, such as modelName, apiKey, generationConfig, and systemInstruction.

In ChatViewModel, provide the chat history to the GenerativeModel instance to establish context for the conversation. Update the _uiState initialization to map the chat history messages to ChatMessage instances, ensuring that the conversation history is displayed when the app is launched.

By following these steps, you will set up the foundation for CatBot and enable interactions with Milo the cat using the Gemini 1.5 Pro model.



Source link

Tags: AndroidBuildCatChatbotGeminiGoogle
Previous Post

JPMorgan poised to pay $100 million over CFTC trade reporting violations, source says By Reuters

Next Post

How To Create A Product Landing Page Using HTML

Related Posts

Top 20 Javascript Libraries You Should Know in 2024
Cloud & Programming

Top 20 Javascript Libraries You Should Know in 2024

June 10, 2024
Simplify risk and compliance assessments with the new common control library in AWS Audit Manager
Cloud & Programming

Simplify risk and compliance assessments with the new common control library in AWS Audit Manager

June 6, 2024
Simplify Regular Expressions with RegExpBuilderJS
Cloud & Programming

Simplify Regular Expressions with RegExpBuilderJS

June 6, 2024
How to learn data visualization to accelerate your career
Cloud & Programming

How to learn data visualization to accelerate your career

June 6, 2024
BitTitan Announces Seasoned Tech Leader Aaron Wadsworth as General Manager
Cloud & Programming

BitTitan Announces Seasoned Tech Leader Aaron Wadsworth as General Manager

June 6, 2024
Copilot Studio turns to AI-powered workflows
Cloud & Programming

Copilot Studio turns to AI-powered workflows

June 6, 2024
Next Post
How To Create A Product Landing Page Using HTML

How To Create A Product Landing Page Using HTML

Perspective

Perspective

Where to Watch FA Cup Final (May 2024) Online Free 2024

Where to Watch FA Cup Final (May 2024) Online Free 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest
23 Plagiarism Facts and Statistics to Analyze Latest Trends

23 Plagiarism Facts and Statistics to Analyze Latest Trends

June 4, 2024
How ‘Chain of Thought’ Makes Transformers Smarter

How ‘Chain of Thought’ Makes Transformers Smarter

May 13, 2024
Amazon’s Bedrock and Titan Generative AI Services Enter General Availability

Amazon’s Bedrock and Titan Generative AI Services Enter General Availability

October 2, 2023
Is C.AI Down? Here Is What To Do Now

Is C.AI Down? Here Is What To Do Now

January 10, 2024
The Importance of Choosing a Reliable Affiliate Network and Why Olavivo is Your Ideal Partner

The Importance of Choosing a Reliable Affiliate Network and Why Olavivo is Your Ideal Partner

October 30, 2023
Managing PDFs in Node.js with pdf-lib

Managing PDFs in Node.js with pdf-lib

November 16, 2023
Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

June 10, 2024
AI Compared: Which Assistant Is the Best?

AI Compared: Which Assistant Is the Best?

June 10, 2024
How insurance companies can use synthetic data to fight bias

How insurance companies can use synthetic data to fight bias

June 10, 2024
5 SLA metrics you should be monitoring

5 SLA metrics you should be monitoring

June 10, 2024
From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

June 10, 2024
UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

June 10, 2024
Facebook Twitter LinkedIn Pinterest RSS
News PouroverAI

The latest news and updates about the AI Technology and Latest Tech Updates around the world... PouroverAI keeps you in the loop.

CATEGORIES

  • AI Technology
  • Automation
  • Blockchain
  • Business
  • Cloud & Programming
  • Data Science & ML
  • Digital Marketing
  • Front-Tech
  • Uncategorized

SITEMAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2023 PouroverAI News.
PouroverAI News

No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing

Copyright © 2023 PouroverAI News.
PouroverAI News

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In