Google Maps की मदद से ग्राउंडिंग करना

Grounding with Google Maps की मदद से, Gemini की जनरेटिव क्षमताओं को Google Maps के सटीक, अप-टू-डेट, और काम के डेटा से जोड़ा जा सकता है. इस सुविधा की मदद से, डेवलपर अपने ऐप्लिकेशन में जगह की जानकारी के आधार पर काम करने वाली सुविधाएं आसानी से जोड़ सकते हैं. जब किसी उपयोगकर्ता की क्वेरी में Maps के डेटा से जुड़ा कॉन्टेक्स्ट होता है, तो Gemini मॉडल, Google Maps का इस्तेमाल करके सटीक और अप-टू-डेट जवाब देता है. ये जवाब, उपयोगकर्ता की बताई गई जगह या सामान्य इलाके के हिसाब से होते हैं.

  • जगह की जानकारी के आधार पर सटीक जवाब: भौगोलिक तौर पर खास क्वेरी के लिए, Google Maps के मौजूदा और बड़े डेटा का इस्तेमाल करें.
  • बेहतर तरीके से मनमुताबिक अनुभव: उपयोगकर्ता की बताई गई जगहों के आधार पर, सुझाव और जानकारी को अपने हिसाब से बनाएं.
  • कॉन्टेक्चुअल जानकारी और विजेट: जनरेट किए गए कॉन्टेंट के साथ, इंटरैक्टिव Google Maps विजेट दिखाने के लिए, कॉन्टेक्स्ट टोकन का इस्तेमाल करें.

शुरू करें

इस उदाहरण में, Grounding with Google Maps को अपने ऐप्लिकेशन में इंटिग्रेट करने का तरीका बताया गया है. इससे उपयोगकर्ता की क्वेरी के सटीक और जगह की जानकारी के आधार पर जवाब दिए जा सकते हैं. प्रॉम्प्ट में, उपयोगकर्ता की जगह की जानकारी के साथ-साथ, आस-पास की जगहों के सुझाव मांगे जाते हैं. इससे Gemini मॉडल, Google Maps के डेटा का इस्तेमाल कर पाता है.

Python

# This will only work for SDK newer than 2.0.0
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="What are the best Italian restaurants within a 15-minute walk from here?",
    tools=[{
        "type": "google_maps",
        "latitude": 34.050481,
        "longitude": -118.248526
    }]
)

# Print the model's text response and annotations
for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)
                if content_block.annotations:
                    print("\nSources:")
                    for annotation in content_block.annotations:
                        if annotation.type == "place_citation":
                            print(f"  - {annotation.name}: {annotation.url}")

JavaScript

// This will only work for SDK newer than 2.0.0
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

async function main() {
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "What are the best Italian restaurants within a 15-minute walk from here?",
    tools: [{
      type: "google_maps",
      latitude: 34.050481,
      longitude: -118.248526
    }]
  });

  // Print the model's text response and annotations
  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.type === 'text') {
          console.log(contentBlock.text);
          if (contentBlock.annotations) {
            console.log("\nSources:");
            for (const annotation of contentBlock.annotations) {
              if (annotation.type === 'place_citation') {
                console.log(`  - {annotation.name}: {annotation.url}`);
              }
            }
          }
        }
      }
    }
  }
}

main();

REST

# Specifies the API revision to avoid breaking changes when they become default
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3-flash-preview",
    "input": "What are the best Italian restaurants within a 15-minute walk from here?",
    "tools": [{
      "type": "google_maps",
      "latitude": 34.050481,
      "longitude": -118.248526
    }]
  }'

Google Maps से जानकारी लेने की सुविधा कैसे काम करती है

Maps API को, Grounding with Google Maps के सोर्स के तौर पर इस्तेमाल करके, Gemini API को Google Geo इकोसिस्टम के साथ इंटिग्रेट किया जाता है. जब किसी उपयोगकर्ता की क्वेरी में भौगोलिक कॉन्टेक्स्ट होता है, तो Gemini मॉडल, Grounding with Google Maps टूल को कॉल कर सकता है. इसके बाद, मॉडल, दी गई जगह के हिसाब से Google Maps के डेटा के आधार पर जवाब जनरेट कर सकता है.

इस प्रोसेस में आम तौर पर ये चरण शामिल होते हैं:

  1. उपयोगकर्ता की क्वेरी: कोई उपयोगकर्ता आपके ऐप्लिकेशन में क्वेरी सबमिट करता है.इसमें भौगोलिक कॉन्टेक्स्ट भी शामिल हो सकता है. जैसे, "मेरे आस-पास की कॉफ़ी शॉप" या "सैन फ़्रांसिस्को में मौजूद म्यूज़ियम".
  2. टूल को कॉल करना: Gemini मॉडल, भौगोलिक मकसद को पहचानकर, Grounding with Google Maps टूल को कॉल करता है. इस टूल को, उपयोगकर्ता की latitude और longitude की जानकारी भी दी जा सकती है. यह टूल, टेक्स्ट के आधार पर खोज करने वाला टूल है. यह Maps पर खोज करने की तरह ही काम करता है. जैसे, लोकल क्वेरी ("मेरे आस-पास") के लिए, निर्देशांकों का इस्तेमाल किया जाएगा. वहीं, खास या नॉन-लोकल क्वेरी पर, साफ़ तौर पर बताई गई जगह का असर नहीं पड़ेगा.
  3. डेटा वापस पाना: Grounding with Google Maps सेवा, Google Maps से काम की जानकारी (जैसे, जगहें, समीक्षाएं, फ़ोटो, पते, खुलने का समय) के लिए क्वेरी करती है.
  4. डेटा के आधार पर जवाब जनरेट करना: वापस पाए गए Maps के डेटा का इस्तेमाल, Gemini मॉडल के जवाब के लिए किया जाता है. इससे यह पक्का किया जाता है कि जवाब सटीक और काम के हों.
  5. जवाब और एनोटेशन: मॉडल, Google Maps के सोर्स से लिंक किए गए इनलाइन एनोटेशन के साथ टेक्स्ट जवाब देता है. इससे डेवलपर, सोर्स के बारे में जानकारी दिखा सकते हैं. साथ ही, वे चाहें, तो कॉन्टेक्चुअल Google Maps विजेट भी दिखा सकते हैं.

Google Maps से जानकारी लेने की सुविधा का इस्तेमाल कब और क्यों करना चाहिए

Grounding with Google Maps, उन ऐप्लिकेशन के लिए सबसे सही है जिनमें सटीक, अप-टू-डेट, और जगह के हिसाब से जानकारी की ज़रूरत होती है. यह सुविधा, उपयोगकर्ता को काम का और मनमुताबिक कॉन्टेंट देकर, उनके अनुभव को बेहतर बनाती है. यह कॉन्टेंट, Google Maps के दुनिया भर में 25 करोड़ से ज़्यादा जगहों के डेटाबेस पर आधारित होता है.

Grounding with Google Maps का इस्तेमाल तब करें, जब आपके ऐप्लिकेशन को:

  • जगह से जुड़े सवालों के सटीक और पूरे जवाब देने हों.
  • बातचीत के ज़रिए यात्रा की योजना बनाने वाले टूल और लोकल गाइड बनाने हों.
  • जगह और उपयोगकर्ता की प्राथमिकताओं (जैसे, रेस्टोरेंट या दुकानें) के आधार पर, दिलचस्पी की जगहों के सुझाव देने हों.
  • सोशल, खुदरा या फ़ूड डिलीवरी सेवाओं के लिए, जगह की जानकारी के आधार पर काम करने वाले अनुभव बनाने हों.

Grounding with Google Maps, उन मामलों में सबसे अच्छा काम करता है जहां आस-पास की जगहों और मौजूदा सटीक डेटा की ज़रूरत होती है. जैसे, "मेरे आस-पास की सबसे अच्छी कॉफ़ी शॉप" ढूंढना या दिशा-निर्देश पाना.

इस्तेमाल के उदाहरण

Grounding with Google Maps, जगह की जानकारी के आधार पर काम करने वाले कई मामलों में इस्तेमाल किया जा सकता है.

जगह से जुड़े सवालों को मैनेज करना

Google पर मौजूद उपयोगकर्ता की समीक्षाओं और Maps के अन्य डेटा के आधार पर जवाब पाने के लिए, किसी खास जगह के बारे में ज़्यादा जानकारी वाले सवाल पूछें.

Python

# This will only work for SDK newer than 2.0.0
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Is there a cafe near the corner of 1st and Main that has outdoor seating?",
    tools=[{
        "type": "google_maps",
        "latitude": 34.050481,
        "longitude": -118.248526
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)
                if content_block.annotations:
                    print("\nSources:")
                    for annotation in content_block.annotations:
                        if annotation.type == "place_citation":
                            print(f"  - {annotation.name}: {annotation.url}")

JavaScript

// This will only work for SDK newer than 2.0.0
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

async function main() {
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Is there a cafe near the corner of 1st and Main that has outdoor seating?",
    tools: [{
      type: "google_maps",
      latitude: 34.050481,
      longitude: -118.248526
    }]
  });

  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.type === 'text') {
          console.log(contentBlock.text);
          if (contentBlock.annotations) {
            console.log("\nSources:");
            for (const annotation of contentBlock.annotations) {
              if (annotation.type === 'place_citation') {
                console.log(`  - ${annotation.name}: ${annotation.url}`);
              }
            }
          }
        }
      }
    }
  }
}

main();

जगह के हिसाब से मनमुताबिक अनुभव देना

किसी उपयोगकर्ता की प्राथमिकताओं और किसी खास इलाके के हिसाब से सुझाव पाएं.

Python

# This will only work for SDK newer than 2.0.0
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Which family-friendly restaurants near here have the best playground reviews?",
    tools=[{
        "type": "google_maps",
        "latitude": 30.2672,
        "longitude": -97.7431
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)
                if content_block.annotations:
                    print("\nSources:")
                    for annotation in content_block.annotations:
                        if annotation.type == "place_citation":
                            print(f"  - {annotation.name}: {annotation.url}")

JavaScript

// This will only work for SDK newer than 2.0.0
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

async function main() {
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Which family-friendly restaurants near here have the best playground reviews?",
    tools: [{
      type: "google_maps",
      latitude: 30.2672,
      longitude: -97.7431
    }]
  });

  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.type === 'text') {
          console.log(contentBlock.text);
          if (contentBlock.annotations) {
            console.log("\nSources:");
            for (const annotation of contentBlock.annotations) {
              if (annotation.type === 'place_citation') {
                console.log(`  - ${annotation.name}: ${annotation.url}`);
              }
            }
          }
        }
      }
    }
  }
}

main();

यात्रा की योजना बनाने में मदद करना

कई दिनों की यात्रा की योजनाएं जनरेट करें. इनमें दिशा-निर्देश और अलग-अलग जगहों के बारे में जानकारी शामिल होती है. यह सुविधा, यात्रा से जुड़े ऐप्लिकेशन के लिए सबसे सही है.

Python

# This will only work for SDK newer than 2.0.0
from google import genai

client = genai.Client()

prompt = "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner."

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input=prompt,
    tools=[{
        "type": "google_maps",
        "latitude": 37.78193,
        "longitude": -122.40476,
        "enable_widget": True
    }]
)
# ... code to process response and widget token

JavaScript

// This will only work for SDK newer than 2.0.0
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

async function main() {
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner.",
    tools: [{
      type: "google_maps",
      latitude: 37.78193,
      longitude: -122.40476,
      enable_widget: true
    }]
  });
}

main();

REST

# Specifies the API revision to avoid breaking changes when they become default
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3-flash-preview",
    "input": "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner.",
    "tools": [{
      "type": "google_maps",
      "latitude": 37.78193,
      "longitude": -122.40476,
      "enable_widget": true
    }]
  }'

सेवा के इस्तेमाल से जुड़ी ज़रूरी शर्तें

इस सेक्शन में, Grounding with Google Maps के इस्तेमाल से जुड़ी ज़रूरी शर्तों के बारे में बताया गया है.

उपयोगकर्ता को Google Maps के सोर्स के इस्तेमाल के बारे में बताना

Google Maps से मिले हर जवाब के साथ, आपको model_output चरण के कॉन्टेंट ब्लॉक पर सोर्स के एनोटेशन मिलेंगे. ये एनोटेशन, हर जवाब के लिए सोर्स की जानकारी देते हैं. ये मेटाडेटा वापस मिलते हैं:

  • सोर्स यूआरएल
  • नाम

Grounding with Google Maps से मिले जवाब दिखाते समय, आपको Google Maps के सोर्स की जानकारी देनी होगी. साथ ही, अपने उपयोगकर्ताओं को यह जानकारी देनी होगी:

  • Google Maps के सोर्स, जनरेट किए गए उस कॉन्टेंट के तुरंत बाद दिखने चाहिए जिसके लिए सोर्स की जानकारी दी गई है. जनरेट किए गए इस कॉन्टेंट को, Google Maps से मिला जवाब भी कहा जाता है.
  • Google Maps के सोर्स, उपयोगकर्ता के एक इंटरैक्शन में दिखने चाहिए.

Google Maps के लिंक के साथ, Google Maps के सोर्स दिखाना

सोर्स के हर एनोटेशन के लिए, लिंक का प्रीव्यू इन ज़रूरी शर्तों के मुताबिक जनरेट किया जाना चाहिए:

Google Maps के टेक्स्ट एट्रिब्यूशन के दिशा-निर्देश

टेक्स्ट में सोर्स को Google Maps से एट्रिब्यूट करते समय, इन दिशा-निर्देशों का पालन करें:

  • Google Maps के टेक्स्ट में किसी भी तरह का बदलाव न करें:
    • Google Maps के केस में बदलाव न करें.
    • Google Maps को एक से ज़्यादा लाइनों में न दिखाएं.
    • Google Maps को किसी दूसरी भाषा में स्थानीय भाषा में अनुवाद न करें.
    • HTML एट्रिब्यूट translate="no" का इस्तेमाल करके, ब्राउज़र को Google Maps का अनुवाद करने से रोकें.

Google Maps के कुछ डेटा देने वाले पार्टनर और उनकी लाइसेंस की शर्तों के बारे में ज़्यादा जानने के लिए, Google Maps और Google Earth के कानूनी नोटिस देखें.

सबसे सही तरीके

  • उपयोगकर्ता की जगह की जानकारी देना: सबसे काम के और मनमुताबिक जवाब पाने के लिए, उपयोगकर्ता की जगह की जानकारी मिलने पर, हमेशा google_maps टूल के कॉन्फ़िगरेशन में latitude और longitude शामिल करें.
  • Google Maps का कॉन्टेक्चुअल विजेट दिखाना: कॉन्टेक्चुअल विजेट, कॉन्टेक्स्ट टोकन google_maps_widget_context_token का इस्तेमाल करके दिखाया जाता है. यह टोकन, Gemini API के जवाब में मिलता है. इसका इस्तेमाल, Google Maps से विज़ुअल कॉन्टेंट दिखाने के लिए किया जा सकता है.
  • आखिरी उपयोगकर्ताओं को जानकारी देना: अपने आखिरी उपयोगकर्ताओं को साफ़ तौर पर बताएं कि उनकी क्वेरी के जवाब देने के लिए, Google Maps के डेटा का इस्तेमाल किया जा रहा है. खास तौर पर, तब जब टूल चालू हो.
  • ज़रूरत न होने पर बंद करना: Grounding with Google Maps, डिफ़ॉल्ट रूप से बंद होता है. इसे सिर्फ़ तब चालू करें ("tools": [{"type": "google_maps"}]), जब किसी क्वेरी में भौगोलिक कॉन्टेक्स्ट मौजूद हो. इससे परफ़ॉर्मेंस और लागत को ऑप्टिमाइज़ किया जा सकता है.

सीमाएं

  • फ़िलहाल, Grounding with Google Maps सिर्फ़ अंग्रेज़ी भाषा में प्रॉम्प्ट और जवाब देने की सुविधा देता है.
  • ऐसा हो सकता है कि यह टूल सभी इलाकों में उपलब्ध न हो.
  • नतीजे, जगह की सटीक जानकारी और Maps के उपलब्ध डेटा के आधार पर अलग-अलग हो सकते हैं.
  • भौगोलिक दायरा: Grounding with Google Maps, दुनिया भर में उपलब्ध है.
  • डिफ़ॉल्ट स्थिति: Grounding with Google Maps टूल, डिफ़ॉल्ट रूप से बंद होता है. आपको एपीआई के अनुरोधों में इसे साफ़ तौर पर चालू करना होगा.

कीमत और दर की सीमाएं

Grounding with Google Maps की कीमत, क्वेरी के आधार पर तय की जाती है. फ़िलहाल, दर 25 डॉलर / 1,000 ग्राउंडेड प्रॉम्प्ट है. मुफ़्त टियर में, हर दिन 500 अनुरोध किए जा सकते हैं. किसी अनुरोध को कोटा में सिर्फ़ तब गिना जाता है, जब कोई प्रॉम्प्ट, Google Maps से मिला कम से कम एक जवाब देता है. इसका मतलब है कि नतीजों में Google Maps का कम से कम एक सोर्स शामिल हो. अगर किसी एक अनुरोध से Google Maps को कई क्वेरी भेजी जाती हैं, तो इसे दर की सीमा के हिसाब से एक अनुरोध के तौर पर गिना जाता है.

कीमत की ज़्यादा जानकारी के लिए, Gemini API की कीमत वाला पेज देखें.

काम करने वाले मॉडल

ये मॉडल, Grounding with Google Maps के साथ काम करते हैं:

मॉडल Grounding with Google Maps
Gemini 3.1 Pro का प्रीव्यू ✔️
Gemini 3.1 Flash-Lite ✔️
Gemini 3.1 Flash-Lite का प्रीव्यू ✔️
Gemini 3 Flash का प्रीव्यू ✔️
Gemini 2.5 Pro ✔️
Gemini 2.5 Flash ✔️
Gemini 2.5 Flash-Lite ✔️
Gemini 2.0 Flash ✔️

टूल के काम करने वाले कॉम्बिनेशन

Gemini 3 मॉडल, बिल्ट-इन टूल (जैसे, Grounding with Google Maps) को कस्टम टूल (फ़ंक्शन कॉलिंग) के साथ मिलाकर इस्तेमाल करने की सुविधा देते हैं. ज़्यादा जानने के लिए, टूल के कॉम्बिनेशन वाला पेज देखें.

आगे क्या करना है