Entity Extraction
Copyright 2025 Google LLC.
Gemini API: Entity extraction
Use Gemini API to speed up some of your tasks, such as searching through text to extract needed information. Entity extraction with a Gemini model is a simple query, and you can ask it to retrieve its answer in the form that you prefer.
This notebook shows how to extract entities into a list.
Setup
Configure your API key
To run the following cell, your API key must be stored it in a Colab Secret named GOOGLE_API_KEY. If you don't already have an API key, or you're not sure how to create a Colab Secret, see Authentication for an example.
Select the model
Additionally, select the model you want to use from the available options below:
Examples
Extracting few entities at once
This block of text is about possible ways to travel from the airport to the Colosseum.
Let's extract all street names and proposed forms of transportation from it.
You will use Gemini Flash model for fast responses.
You can modify the form of the answer for your extracted entities even more:
Numbers
Try entity extraction of phone numbers
URLs
Try entity extraction of URLs and get response as a clickable link.