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

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

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

अपनी प्रोफ़ाइल बनाना शुरू करें

इस उदाहरण में, 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.8-flash",
    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.8-flash",
    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();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.Annotation;
import com.google.genai.gaos.models.interactions.Content;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GoogleMaps;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ModelOutputStep;
import com.google.genai.gaos.models.interactions.PlaceCitation;
import com.google.genai.gaos.models.interactions.Step;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.8-flash"))
        .input(
            InteractionsInput.of(
                "What are the best Italian restaurants within a 15-minute walk from here?"))
        .tools(
            Arrays.asList(
                GoogleMaps.builder().latitude(34.050481).longitude(-118.248526).build()))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

// Print the model's text response and annotations
if (interaction.steps().isPresent()) {
  for (Step step : interaction.steps().get()) {
    if (step instanceof ModelOutputStep) {
      ModelOutputStep outputStep = (ModelOutputStep) step;
      if (outputStep.content().isPresent()) {
        for (Content contentBlock : outputStep.content().get()) {
          if (contentBlock instanceof TextContent) {
            TextContent textContent = (TextContent) contentBlock;
            System.out.println(textContent.text().orElse(""));
            if (textContent.annotations().isPresent()
                && !textContent.annotations().get().isEmpty()) {
              System.out.println("\nSources:");
              for (Annotation annotation : textContent.annotations().get()) {
                if (annotation instanceof PlaceCitation) {
                  PlaceCitation citation = (PlaceCitation) annotation;
                  System.out.printf(
                      "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                }
              }
            }
          }
        }
      }
    }
  }
}

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(
            interactions.CreateModelInteraction{
                Model: interactions.Model("gemini-3.8-flash"),
                Input: interactions.NewInteractionsInput("What are the best Italian restaurants within a 15-minute walk from here?"),
                Tools: []interactions.Tool{
                    interactions.NewTool(interactions.GoogleMaps{
                        Latitude:  genai.Ptr(34.050481),
                        Longitude: genai.Ptr(-118.248526),
                    }),
                },
            },
        ),
    })
    if err != nil {
        log.Fatal(err)
    }

    // Print the model's text response and annotations
    for _, step := range resp.Interaction.Steps {
        if step.ModelOutputStep != nil {
            for _, content := range step.ModelOutputStep.Content {
                if content.TextContent != nil {
                    fmt.Println(content.TextContent.Text)
                    if len(content.TextContent.Annotations) > 0 {
                        fmt.Println("\nSources:")
                        for _, annotation := range content.TextContent.Annotations {
                            if annotation.PlaceCitation != nil {
                                c := annotation.PlaceCitation
                                name := ""
                                if c.Name != nil {
                                    name = *c.Name
                                }
                                url := ""
                                if c.URL != nil {
                                    url = *c.URL
                                }
                                fmt.Printf("  - %s: %s\n", name, url)
                            }
                        }
                    }
                }
            }
        }
    }
}

आराम का समय

# 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' \
  -d '{
    "model": "gemini-3.8-flash",
    "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 से जानकारी लेने की सुविधा कैसे काम करती है

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

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

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

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

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

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

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

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

उपयोग के उदाहरण

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.8-flash",
    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.8-flash",
    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();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.Annotation;
import com.google.genai.gaos.models.interactions.Content;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GoogleMaps;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ModelOutputStep;
import com.google.genai.gaos.models.interactions.PlaceCitation;
import com.google.genai.gaos.models.interactions.Step;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.8-flash"))
        .input(
            InteractionsInput.of(
                "Is there a cafe near the corner of 1st and Main that has outdoor seating?"))
        .tools(
            Arrays.asList(
                GoogleMaps.builder().latitude(34.050481).longitude(-118.248526).build()))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

if (interaction.steps().isPresent()) {
  for (Step step : interaction.steps().get()) {
    if (step instanceof ModelOutputStep) {
      ModelOutputStep outputStep = (ModelOutputStep) step;
      if (outputStep.content().isPresent()) {
        for (Content contentBlock : outputStep.content().get()) {
          if (contentBlock instanceof TextContent) {
            TextContent textContent = (TextContent) contentBlock;
            System.out.println(textContent.text().orElse(""));
            if (textContent.annotations().isPresent()
                && !textContent.annotations().get().isEmpty()) {
              System.out.println("\nSources:");
              for (Annotation annotation : textContent.annotations().get()) {
                if (annotation instanceof PlaceCitation) {
                  PlaceCitation citation = (PlaceCitation) annotation;
                  System.out.printf(
                      "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                }
              }
            }
          }
        }
      }
    }
  }
}

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(
            interactions.CreateModelInteraction{
                Model: interactions.Model("gemini-3.8-flash"),
                Input: interactions.NewInteractionsInput("Is there a cafe near the corner of 1st and Main that has outdoor seating?"),
                Tools: []interactions.Tool{
                    interactions.NewTool(interactions.GoogleMaps{
                        Latitude:  genai.Ptr(34.050481),
                        Longitude: genai.Ptr(-118.248526),
                    }),
                },
            },
        ),
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, step := range resp.Interaction.Steps {
        if step.ModelOutputStep != nil {
            for _, content := range step.ModelOutputStep.Content {
                if content.TextContent != nil {
                    fmt.Println(content.TextContent.Text)
                    if len(content.TextContent.Annotations) > 0 {
                        fmt.Println("\nSources:")
                        for _, annotation := range content.TextContent.Annotations {
                            if annotation.PlaceCitation != nil {
                                c := annotation.PlaceCitation
                                name := ""
                                if c.Name != nil {
                                    name = *c.Name
                                }
                                url := ""
                                if c.URL != nil {
                                    url = *c.URL
                                }
                                fmt.Printf("  - %s: %s\n", name, url)
                            }
                        }
                    }
                }
            }
        }
    }
}

जगह की जानकारी के आधार पर मनमुताबिक अनुभव देना

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

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.8-flash",
    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.8-flash",
    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();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.Annotation;
import com.google.genai.gaos.models.interactions.Content;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GoogleMaps;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ModelOutputStep;
import com.google.genai.gaos.models.interactions.PlaceCitation;
import com.google.genai.gaos.models.interactions.Step;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.8-flash"))
        .input(
            InteractionsInput.of(
                "Which family-friendly restaurants near here have the best playground reviews?"))
        .tools(
            Arrays.asList(GoogleMaps.builder().latitude(30.2672).longitude(-97.7431).build()))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

if (interaction.steps().isPresent()) {
  for (Step step : interaction.steps().get()) {
    if (step instanceof ModelOutputStep) {
      ModelOutputStep outputStep = (ModelOutputStep) step;
      if (outputStep.content().isPresent()) {
        for (Content contentBlock : outputStep.content().get()) {
          if (contentBlock instanceof TextContent) {
            TextContent textContent = (TextContent) contentBlock;
            System.out.println(textContent.text().orElse(""));
            if (textContent.annotations().isPresent()
                && !textContent.annotations().get().isEmpty()) {
              System.out.println("\nSources:");
              for (Annotation annotation : textContent.annotations().get()) {
                if (annotation instanceof PlaceCitation) {
                  PlaceCitation citation = (PlaceCitation) annotation;
                  System.out.printf(
                      "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                }
              }
            }
          }
        }
      }
    }
  }
}

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(
            interactions.CreateModelInteraction{
                Model: interactions.Model("gemini-3.8-flash"),
                Input: interactions.NewInteractionsInput("Which family-friendly restaurants near here have the best playground reviews?"),
                Tools: []interactions.Tool{
                    interactions.NewTool(interactions.GoogleMaps{
                        Latitude:  genai.Ptr(30.2672),
                        Longitude: genai.Ptr(-97.7431),
                    }),
                },
            },
        ),
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, step := range resp.Interaction.Steps {
        if step.ModelOutputStep != nil {
            for _, content := range step.ModelOutputStep.Content {
                if content.TextContent != nil {
                    fmt.Println(content.TextContent.Text)
                    if len(content.TextContent.Annotations) > 0 {
                        fmt.Println("\nSources:")
                        for _, annotation := range content.TextContent.Annotations {
                            if annotation.PlaceCitation != nil {
                                c := annotation.PlaceCitation
                                name := ""
                                if c.Name != nil {
                                    name = *c.Name
                                }
                                url := ""
                                if c.URL != nil {
                                    url = *c.URL
                                }
                                fmt.Printf("  - %s: %s\n", name, url)
                            }
                        }
                    }
                }
            }
        }
    }
}

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

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

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.8-flash",
    input=prompt,
    tools=[{
        "type": "google_maps",
        "latitude": 37.78193,
        "longitude": -122.40476
    }]
)
# ... code to process response

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.8-flash",
    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
    }]
  });
}

main();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GoogleMaps;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;

Client client = new Client();

String 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.";

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.8-flash"))
        .input(InteractionsInput.of(prompt))
        .tools(
            Arrays.asList(GoogleMaps.builder().latitude(37.78193).longitude(-122.40476).build()))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

// ... code to process response
System.out.println(interaction.outputText().orElse(""));

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

func main() {
    ctx := context.Background()
    client, err := genai.NewClient(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }

    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."

    resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(
            interactions.CreateModelInteraction{
                Model: interactions.Model("gemini-3.8-flash"),
                Input: interactions.NewInteractionsInput(prompt),
                Tools: []interactions.Tool{
                    interactions.NewTool(interactions.GoogleMaps{
                        Latitude:  genai.Ptr(37.78193),
                        Longitude: genai.Ptr(-122.40476),
                    }),
                },
            },
        ),
    })
    if err != nil {
        log.Fatal(err)
    }

    // ... code to process response
    fmt.Println(resp.Interaction.GetOutputText())
}

आराम का समय

# 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' \
  -d '{
    "model": "gemini-3.8-flash",
    "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
    }]
  }'

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

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

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

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

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

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

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

Google Maps में किसी जगह पर ले जाने वाले लिंक के साथ Google Maps के सोर्स दिखाना

हर सोर्स एनोटेशन के लिए, लिंक की झलक जनरेट होनी चाहिए. इसके लिए, ये ज़रूरी शर्तें पूरी करनी होंगी:

  • Google Maps के टेक्स्ट एट्रिब्यूशन के दिशा-निर्देशों का पालन करते हुए, हर सोर्स का एट्रिब्यूशन Google Maps को दें.
  • जवाब में दिए गए सोर्स का नाम दिखाएं.
  • एनोटेशन में मौजूद url का इस्तेमाल करके, सोर्स से लिंक करें.

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

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

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

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

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

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

सीमाएं

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

कीमत और अनुरोध संख्या सीमित करना

Google Maps से जानकारी लेने की सुविधा की कीमत, मॉडल जनरेशन के हिसाब से अलग-अलग होती है:

  • Gemini 3 और नए मॉडल: आपके प्रोजेक्ट के लिए, हर उस सर्च क्वेरी का शुल्क लिया जाता है जिसे मॉडल पूरा करता है. Gemini 3 और नए मॉडल के लिए, हर महीने 5,000 अनुरोध मुफ़्त में किए जा सकते हैं. इसके बाद, हर 1,000 सर्च क्वेरी के लिए 14 डॉलर का शुल्क लिया जाता है. एक खोज प्रॉम्प्ट (मॉडल को भेजा गया आपका एपीआई अनुरोध) के जवाब में, मॉडल ज़रूरी जानकारी पाने के लिए कई सर्च क्वेरी चला सकता है. इनमें से हर क्वेरी को टूल के इस्तेमाल के तौर पर गिना जाता है. इसके लिए, आपसे शुल्क लिया जाता है.
  • Gemini 2.5 और इससे पुराने मॉडल: आपके प्रोजेक्ट के लिए, हर सर्च प्रॉम्प्ट के हिसाब से बिलिंग की जाती है. 1,000 ग्राउंडेड प्रॉम्प्ट के लिए 25 डॉलर लिए जाते हैं. किसी अनुरोध के लिए शुल्क सिर्फ़ तब लिया जाता है, जब प्रॉम्प्ट से Google Maps पर आधारित कम से कम एक नतीजा मिलता है. इससे कोई फ़र्क़ नहीं पड़ता कि उस नतीजे को पाने के लिए, मॉडल ने इंटरनल तौर पर कितनी सर्च क्वेरी की हैं.

Google Maps से जानकारी लेने की सुविधा का कोटा, आम तौर पर Gemini मॉडल के अनुरोध संख्या सीमित करने के मुताबिक होता है. शुल्क के बारे में ज़्यादा जानकारी के लिए, Gemini API के शुल्क वाला पेज देखें.

इस्तेमाल किए जा सकने वाले मॉडल

Google Maps से जानकारी लेने की सुविधा, इन मॉडल के साथ काम करती है:

मॉडल Google Maps से सटीक जानकारी पाने की सुविधा
Gemini 4 Argon ✔️
Gemini 3.8 Flash ✔️
Gemini 3.6 Flash ✔️
Gemini 3.5 Flash-Lite ✔️
Gemini 3.1 Pro की झलक ✔️
Gemini 3.1 Flash-Lite ✔️
Gemini 3 Flash की झलक ✔️
Gemini 2.5 Pro ✔️
Gemini 2.5 Flash ✔️
Gemini 2.5 Flash-Lite ✔️

इस्तेमाल किए जा सकने वाले टूल कॉम्बिनेशन

Google Maps से जानकारी लेने की सुविधा को, पहले से मौजूद अन्य टूल के साथ इस्तेमाल किया जा सकता है. जैसे, Google Search से सटीक जानकारी पाने की सुविधा. यह सुविधा, Gemini 3.5 Flash-Lite और इसके बाद के मॉडल पर काम करती है. इससे, इस्तेमाल के ज़्यादा मुश्किल उदाहरणों को बेहतर तरीके से पूरा किया जा सकता है. Gemini 3 मॉडल, इन बिल्ट-इन टूल को कस्टम टूल (फ़ंक्शन कॉलिंग) के साथ इस्तेमाल करने की सुविधा भी देते हैं. टूल के कॉम्बिनेशन पेज पर जाकर, इसके बारे में ज़्यादा जानें.

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