After you
set up Gemini in Firebase
, you can
start using it to enhance your Firebase developer experience.
To open the Gemini pane:
The Gemini pane opens and persists across all pages in the Firebase console.
You can now
chat with Gemini
and explore all of the features
available in the
Gemini pane
.
If
spark
Gemini in Firebase
doesn't
appear in the Firebase console, follow the steps in
Set up Gemini in Firebase for a project
to enable it.
Chat with Gemini
After you've opened the Gemini pane, you can immediately start
a conversation with Gemini and begin asking questions using
natural language.
The following steps demonstrate a conversation you might have with
Gemini about
Cloud Firestore
. In this example, you
ask
Gemini to provide you with a basic set of
Firestore rules and refine them together as you add requirements:
In the
Ask me anything about Firebase
field, enter the following
prompt, and then click
send
Send
:
Can you provide a short, secure set of Firestore rules for a chat app?
Gemini displays its response, which will typically contain the
rules it suggests and a complete description of how the rules work.
Next, ask Gemini to expand and enhance the rules. For example, if
Gemini responded with a basic set of rules that allowed any
authenticated user to read and write to chats, you might want to ask
for a more restrictive set of rules. Enter the following prompt in the
Ask me anything about Firebase
field and then click
send
Send
:
Can you update the rules so that only the sender and recipient can access chats and supports image storage?
Gemini should respond with more restrictive rules that
include image storage, fully explaining each component of the rule
set. It should also provide links to useful resources, like the
Cloud Firestore documentation or relevant code labs.
In addition, you can paste rules into the field and ask for advice.
Markdown syntax is supported, so you can enter a query like the following:
What can you tell me about this Firestore rule set?
```
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth.uid == userId;
}
match /chats/{chatId} {
function isParticipant() {
return request.auth.uid in resource.data.participants;
}
allow read, create: if isParticipant();
allow update, delete: if false;
}
match /chats/{chatId}/messages/{messageId} {
allow read, create: if isParticipant();
}
}
}
```
You can continue the conversation, and continue sharing the rules you're working
on as you troubleshoot and Gemini will suggest improvements and
optimizations.
Explore the Gemini pane in the Firebase console
The Gemini pane in the Firebase console has a number of features that
simplify working collaboratively with the Gemini model.
Option
|
Action
|
delete
|
Clear the conversation. When you clear the conversation,
all previous context is cleared and a new conversation session
begins.
|
text_select_start
|
Dock the Gemini pane to a specific location on the
console. You can choose to dock the pane to the left, top,
right, or bottom.
|
text_select_move_back_word
|
Undock the Gemini pane to return it to its original
state.
|
fullscreen
|
Maximize the Gemini pane to take up the entire console.
|
fullscreen_exit
|
Restore the Gemini pane to its original size.
|
bug_report
|
Report an issue to the Firebase team about your experience
with Gemini in Firebase. We encourage you to report bugs,
suggest improvements, or provide general feedback.
|
close
|
Close the Gemini pane.
|