Gemini API and Google AI Studio now offer Grounding with Google Search

Grounding with Google Search for the Gemini API and Google AI Studio enhances the accuracy and freshness of Gemini's responses by leveraging Google Search data.

Shrestha Basu Mallick, Logan Kilpatrick
4 min readbeginner
--
View Original

Overview

The article discusses the rollout of Grounding with Google Search in the Gemini API and Google AI Studio, which enhances the accuracy and relevance of responses generated by AI models. It highlights the benefits of using grounding, including reduced hallucinations, access to real-time information, and enhanced trustworthiness through supporting links.

What You'll Learn

1

How to enable Grounding with Google Search in the Gemini API

2

Why using grounding can reduce hallucinations in AI responses

3

When to apply dynamic retrieval for optimizing costs in grounding

Prerequisites & Requirements

  • Basic understanding of AI model responses and API usage
  • Access to Google AI Studio and Gemini API

Key Questions Answered

How does Grounding with Google Search improve AI responses?
Grounding with Google Search allows AI models to access up-to-date information from Google, resulting in more accurate and relevant responses. It provides in-line grounding sources and search suggestions, enhancing the user's experience by ensuring that the information is factual and timely.
What are the costs associated with using the Gemini API for grounding?
Developers can access the grounding tool in the Gemini API with a paid tier costing $35 per 1,000 grounded queries. This allows for more accurate responses but incurs additional costs compared to standard queries.
What is dynamic retrieval in the context of grounding?
Dynamic retrieval allows developers to assign a prediction score to queries, determining whether grounding should be applied based on the likelihood of benefiting from it. This helps manage costs and latency by only using grounding when necessary.
When should developers consider using grounding in their applications?
Developers should enable grounding for applications that require reduced hallucinations, more up-to-date information, enhanced trustworthiness, and richer responses. This is particularly useful in scenarios where accuracy and relevance are critical.

Technologies & Tools

Backend
Gemini API
Used to enable grounding capabilities for AI model responses.
Frontend
Google AI Studio
Platform for developers to test and implement grounding features.

Key Actionable Insights

1
Enable Grounding with Google Search for applications that require high accuracy.
This feature can significantly reduce the chances of AI-generated hallucinations, ensuring users receive factual information, which is crucial for applications in fields like healthcare or finance.
2
Utilize dynamic retrieval to optimize costs when using grounding.
By setting a threshold for prediction scores, developers can control when grounding is applied, reducing unnecessary expenses and improving response times.
3
Incorporate supporting links in AI responses to enhance user trust.
Providing users with sources for the information presented can lead to increased engagement and credibility, particularly in content-driven applications.

Common Pitfalls

1
Overusing grounding can lead to increased costs and latency.
Developers should be mindful of applying grounding only when necessary, as it can incur additional charges and slow down response times if used indiscriminately.