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:

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

EnvironmentRepository().geminiApiKey

Chatbot

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

GeminiComponent1()

The logic for the implemented chatbot can be found in class

GeminiRepository()

Last updated