Python with Gemini (Gen AI) using Google Colab
Introduction
Models
Input
Follow This 5 Simple Steps To Get Started With Gemini Pro
In this article, we’ll be dealing with Gemini Pro that services text and chat by taking text as an input. So let’s get started with these 5 simple steps .
Step 1 – Obtain an API key to use Gemini API:
APIs are necessary for smooth data sharing among the applications involved. But before that, we need to get an API key. So, visit the Google AI Studio, create an API key and just copy it. For security purpose, the key has to be kept secret and should not be shared publicly.
Step 2 – Save the API key:
Open Google Colab and click on the Secrets tab.
Paste the copied API key under the Value tab and assign a name under the Name tab. Here, we have named it as ‘Google_Studio’.
This is how we will interact with the API using Google Colab.
Step 3 – In order to use Gemini, install the required libraries and setup the model:
Step 4 –Check the list of models from Google AI Studio:
Step 5 – Model configuration using Gemini Pro:
In case you just want to check how the chat has been between the user and the model..
Here’s another way the chat can be done:
Finally, it is important to note that the more specific and exact the prompt given is, the more satisfying the result will be. Following example substantiates this.
It’s all about giving the exact prompts to get the most right output. However, one must keep in mind that GeminiAI is prone to the following limitations:
1. Bias
2. Hallucination
3. Inconsistency
In the evolving world of GenAI, it becomes imperative to maintain the prompts and output that are privacy driven, ethical, fair, rational, reliable and free from any biases.
More AI coding features like code completions, natural language to code generation and even a code-assisting chatbot are on the way from Colab. Colab will use Codey, a family of code models built on PaLM, as it was fine-tuned on a large dataset of high quality and permissively licensed code from external sources to improve performance on coding tasks. These Codey versions have been customized especially for Python and for Colab-specific uses.
Tasks like generating larger blocks of code, writing whole functions from comments or prompts can be achieved from the Natural Language through code generation. This will reduce the need for writing repetitive code, so that you can focus on the more interesting parts of programming and data science. As of now, a new “Generate” button will be available in the notebook for the unsubscribed users for a limited time allowing them to enter any text prompt to generate code.
Soon, you’ll be able to ask questions directly in Colab like, “How do I import data from Google Sheets?” or “How do I filter a Pandas DataFrame? The chatbot developed will enable this facility. As of now, Colab AI is available for a limited time for unsubscribed users.
Auto-complete suggestions are made available for the eligible paid users.
Interesting..right? The Codey models inside Colab will help increase programming speed, quality, and comprehension. Initial features will majorly focus on code generation.
Tags In
Recent Comments
Archives
Categories
Categories
- Inspiration (1)
- Style (1)
- Technical Blog (12)
- Tips & tricks (2)
- Uncategorized (17)