Beyond Chatbots_ Unlocking Gemini's Potential through Flutter.pdf

gdgsurrey 1,264 views 48 slides Aug 24, 2024
Slide 1
Slide 1 of 48
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48

About This Presentation

This talk will dive into the exciting world of Gemini, Google's next-generation large language model (LLM), and its transformative potential for Flutter app development. We'll explore how Gemini can be integrated into Flutter projects to create personalized content, intelligent assistants, a...


Slide Content

Beyond Chatbots:
Unlocking Gemini's
Potential through Flutter
Roman Jaquez
he/him
Flutter GDE / GDG Lawrence Organizer

Building
Next-Generation,
Gemini-Powered
Flutter Apps

What is Gemini?
●Google's cutting-edge family of large language models (LLMs).
●Designed for diverse tasks, from text generation to code
completion and more.
●Offers advanced capabilities like reasoning, translation, and
creative content generation.

How many years did each take to get
to 50 million users?
Airplanes Internet Facebook Gen AI

How many years did each take to get
to 50 million users?
Airplanes Internet Facebook Gen AI
68 Years

How many years did each take to get
to 50 million users?
Airplanes Internet Facebook Gen AI
68 Years 7 Years

How many years did each take to get
to 50 million users?
Airplanes Internet Facebook Gen AI
68 Years 7 Years 3 Years

How many years did each take to get
to 50 million users?
Airplanes Internet Facebook Gen AI
68 Years 7 Years 3 Years5 weeks

Why Gemini for Flutter?
●Enhance your apps with AI-powered features.
●Deliver personalized and dynamic user experiences.
●Unlock new possibilities for engagement and user
satisfaction.

Use Google AI Studio
For ideation and proving out your ideas
https://aistudio.google.com

Gemini for Flutter Apps: Use Cases
Personalized Content:
●Dynamically generate tailored
content for users based on their
preferences and behavior.
●Recommend relevant products,
services, or information.
●Create interactive learning
experiences.

Collect User Data
and Preferences
Prompt
[
{
“type”: “video”,
“link”: “http://url_to_video”,
“name”:”Learn Flutter”,
“description”: “video desc…”
},

]
fromJSON
VideoResource
UrlResource
UrlResource

VideoWidget
UrlWidget
Google AI SDK
For Dart

Integrating Gemini
with Flutter

// collect user options
class UserOptions {
final String subject; // Python
final String level; // Beginner
final List<String> contentOptions; // videos, links
}

import 'package:google_generative_ai/google_generative_ai.dart';

const apiKey = ...;

void generateLearningProgram(UserOptions options) async {
final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

final prompt = ```
I am a ${options.level} and want to learn ${options.subject} and I want
the content as ${options.contentOptions}.
```;
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
final jsonResponse = json.decode(response.text!);
}

import 'package:google_generative_ai/google_generative_ai.dart';

const apiKey = ...;

void generateLearningProgram(UserOptions options) async {
final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

final prompt = ```
I am a ${options.level} and want to learn ${options.subject} and I want
the content as ${options.contentOptions}.
```;
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
final jsonResponse = json.decode(response.text!);
}

import 'package:google_generative_ai/google_generative_ai.dart';

const apiKey = ...;

void generateLearningProgram(UserOptions options) async {
final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

final prompt = ```
I am a ${options.level} and want to learn ${options.subject} and I want
the content as ${options.contentOptions}.
```;
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
final jsonResponse = json.decode(response.text!);
}

final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig(
responseMimeType: 'application/json',
responseSchema: Schema.object(properties: {
"subject": Schema.string(description: “topic of learning program”),
"level": Schema.string(description: “user level”),
"contentOptions": Schema.string(description: “content options”),
}
)
)
);

import 'package:google_generative_ai/google_generative_ai.dart';

const apiKey = ...;

void generateLearningProgram(UserOptions options) async {
final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

final prompt = ```
I am a ${options.level} and want to learn ${options.subject} and I want
the content as ${options.contentOptions}.
```;
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
final jsonResponse = json.decode(response.text!);
}

import 'package:google_generative_ai/google_generative_ai.dart';

const apiKey = ...;

void generateLearningProgram(UserOptions options) async {
final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

final prompt = ```
I am a ${options.level} and want to learn ${options.subject} and I want
the content as ${options.contentOptions}.
```;
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
final jsonResponse = json.decode(response.text!);
}

Integrating Gemini with Flutter
Flutter Packages to Access Gemini
google_generative_ai*
(*for prototyping only)

firebase_vertexai

import 'package:google_generative_ai/google_generative_ai.dart';
import 'package:firebase_vertexai/firebase_vertexai.dart';
import 'package:firebase_core/firebase_core.dart';

final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

await Firebase.initializeApp()
final model = FirebaseVertexAI.instance.generativeModel(
model: 'gemini-1.5-flash'
);

model.generateContent(..);

import 'package:google_generative_ai/google_generative_ai.dart';
import 'package:firebase_vertexai/firebase_vertexai.dart';
import 'package:firebase_core/firebase_core.dart';

final model = GenerativeModel(
model: 'gemini-1.5-flash-latest',
apiKey: apiKey,
generationConfig: GenerationConfig({...})
);

await Firebase.initializeApp()
final model = FirebaseVertexAI.instance.generativeModel(
model: 'gemini-1.5-flash-latest'
);

model.generateContent(..);

Gemini for Flutter Apps: Use Cases
Intelligent Assistants:
●Provide conversational support and
guidance within your app.
●Automate tasks and streamline
workflows.
●Offer personalized
recommendations and insights.

How many platforms can Flutter
compile into?
789

How many platforms can Flutter
compile into?
Use the WWIMWALER pneumonic:
WINDOWS, WEB, IOS, MACOS, WASM,
ANDROID, LINUX, EMBEDDED, RISC-V
Different
Platforms
789

Parsed Text
From Speech
Prompt
{
“sentiment”: “happy”
}
fromJSON
Sentiment
Response
HappyAnimation
SleepyAnimation
Google AI SDK
For Dart
0011010101
0010101010
0011101010
It is sunny
today!
2.1”
LCD
Screen

Parsed Text
From Speech
Prompt
{
“sentiment”: “happy”
}
fromJSON
Sentiment
Response
HappyAnimation
SleepyAnimation
Google AI SDK
For Dart
0011010101
0010101010
0011101010
It is sunny
today!

Gemini for Flutter Apps: Use Cases
Enhanced User Interfaces:
●Adaptive Interfaces
●Dynamic Visualizations & Interactive
Elements
●The Power of AI-Driven UI

Ethical Considerations and Best Practices
Responsible AI:
●Transparency & Explainability
●Fairness & Bias Mitigation
●Privacy & Data Security

Ethical Considerations and Best Practices
Security and Privacy:
●Secure Data Handling
●Privacy by Design
●User Empowerment
●Trust Through Security

The Future of Gemini and Flutter
Emerging Technologies
●Evolving AI Capabilities
●Multi-modal interactions
●Contextual Understanding
●Real-time Adaptation
●Edge Computing Integration

The Future of Gemini and Flutter
Opportunities for Innovation:
●Seamless Integration
●New Frontiers of App Development
●Limitless Potential

{
"name": "Drawing Challenge",
"videoDescription": "Drawing a house",
"challengeComplete": true,
"challengeDescription": "Draw a house on a piece of paper"
}
Vertex AI
For Firebase
Firebase
Firebase SDK
For Flutter
Video.mp4
Prompt
IMG FRAME

AI Generative UI (Preview)
Ability for Gemini to generate UI components to be fed and rendered by your UI
```
Text(
“Canada”,
textAlign: TextAlign.center,
Style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
)
),

ElevatedButton(
child: Text(“Show Place”),
onPress: () {...},
)

Text
Button
Google AI SDK
For Dart
Prompt: “Show me places
To visit in the fall”

Get Started with Gemini
Google AI Studio
https://aistudio.google.com/
Gemini API SDK Packages
○google_generative_ai
○firebase_vertexai
Flutter and AI
https://flutter.dev/ai

Codelabs
●https://developers.google.com/learn/pathways/solution-ai-gemini-getting-started-dart-flutter
●https://gdglawrence-team.github.io/buildwithai-gdglawrence/#0
●https://gdglawrence-team.github.io/buildwithai-gdglawrence2/#0

The uture is Here!

Thank You!