# Gemini (Google)

If you want to integrate Gemini (Google) in your app you need an Gemini API key. You can get a Gemini API key here <https://aistudio.google.com/prompts/new_chat>. To use your own own API key in the app you can store it in the `.env` file in the `secrets/` folder, which lays in the root folder of the project. The `secrets/.env` file must be created by you. In the `.env` file add this line with your own Gemini API key:

```properties
gemini_api_key=[YOUR GEMINI API KEY]
```

If you build an app where users sign up and must use their own Gemini API key, there is no need to store your Gemini API key in the `.env` file. Rather access the users API key form their user data in the database. Storing your Gemini API key is only needed when you want to provide a Gemini function that users can use without having to insert their own API key.

Afterwards the API key from the `.env` file can be accessed via

```dart
EnvironmentRepository().geminiApiKey
```

### Chatbot

There is already an implementation for a basic chatbot powered by Gemini in the widget

```dart
GeminiComponent1()
```

The logic for the implemented chatbot can be found in class

```dart
GeminiRepository()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flutter-boilerplate.gitbook.io/flutter-boilerplate-docs/features/ai/gemini-google.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
