Gemini is an advanced artificial intelligence (AI) system designed to intelligently respond to diverse prompts, including pictures, text, speech, music, and code.
To utilize Gemini Pro, configure your environment with the necessary API key and service account credentials. Follow these steps to get started:
google-generativeai
GOOGLE_API_KEY
and GOOGLE_APPLICATION_CREDENTIALS
?️Install the required dependencies, ensuring Python 3.9 or higher:
pip install google-generativeai
Set the Google API key as an environment variable:
set GOOGLE_API_KEY=<your-api-key>
Replace <your-api-key>
with your actual Google API key.
Set the path to the service account credentials as an environment variable:
set GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceaccount.json
Replace /path/to/serviceaccount.json
with the actual path to your service account JSON file.
Create a Google Cloud Platform (GCP) service account and download the JSON key file. Follow these steps:
Obtain a Google API key by following the link here.
Explore the capabilities of Gemini Pro by running the provided script. It demonstrates how to configure the API key, list available models, and generate content based on text input.
python gemini.py
Feel free to reach out if you have any questions or feedback.