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}")

জাভাস্ক্রিপ্ট

// 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)
                            }
                        }
                    }
                }
            }
        }
    }
}

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' \
  -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-এর মাধ্যমে গ্রাউন্ডিং কীভাবে কাজ করে

Google Maps-এর সাথে গ্রাউন্ডিং, গ্রাউন্ডিং সোর্স হিসেবে Maps API ব্যবহার করে Google Geo ইকোসিস্টেমের সাথে Gemini API ইন্টিগ্রেট করে। ব্যবহারকারীর কোয়েরিতে ভৌগোলিক প্রসঙ্গ থাকলে, Gemini মডেল Google Maps টুলের মাধ্যমে গ্রাউন্ডিং ইনভোক করতে পারে। মডেলটি তখন Google Maps-এর ডেটার উপর ভিত্তি করে উত্তর তৈরি করতে পারে যা প্রদত্ত লোকেশনের সাথে প্রাসঙ্গিক।

এই প্রসেসে সাধারণত এগুলি অন্তর্ভুক্ত থাকে:

  1. ব্যবহারকারীর কোয়েরি: কোনও ব্যবহারকারী আপনার অ্যাপ্লিকেশনে কোয়েরি জমা দেন, এতে সম্ভাব্যভাবে ভৌগোলিক প্রসঙ্গ (যেমন, "আমার কাছাকাছি কফি শপ", "সান ফ্রান্সিসকোর মিউজিয়াম") অন্তর্ভুক্ত থাকে।
  2. টুল ইনভোকেশন: Gemini মডেল, ভৌগোলিক উদ্দেশ্য শনাক্ত করে, Google Maps টুলের সাথে গ্রাউন্ডিং ইনভোক করে। এই টুলটি ঐচ্ছিকভাবে ব্যবহারকারীর latitude ও longitude-এর সাথে প্রদান করা যেতে পারে। টুলটি একটি টেক্সচুয়াল সার্চ টুল এবং এটি Maps-এ সার্চ করার মতোই কাজ করে, অর্থাৎ লোকাল কোয়েরি ("আমার কাছাকাছি") কোঅর্ডিনেট ব্যবহার করবে, তবে নির্দিষ্ট বা নন-লোকাল কোয়েরি এক্সপ্লিসিট লোকেশন দ্বারা প্রভাবিত হওয়ার সম্ভাবনা কম।
  3. ডেটা রিট্রিভাল: Grounding with Google Maps পরিষেবা প্রাসঙ্গিক তথ্যের জন্য Google Maps-কে কোয়েরি করে (যেমন, জায়গা, রিভিউ, ফটো, ঠিকানা, খোলা থাকার সময়)।
  4. গ্রাউন্ডেড জেনারেশন: Gemini মডেলের উত্তর দেওয়ার সময় Maps থেকে পাওয়া ডেটা ব্যবহার করা হয়, এর ফলে উত্তরটি ফ্যাকচুয়ালি সঠিক ও প্রাসঙ্গিক হয়।
  5. উত্তর ও অ্যানোটেশন: মডেলটি ইনলাইন অ্যানোটেশন সহ একটি টেক্সট উত্তর রিটার্ন করে যা Google Maps সোর্সের সাথে লিঙ্ক করে, এর ফলে ডেভেলপাররা সাইটেশন দেখাতে পারেন।

Google Maps-এর সাথে গ্রাউন্ডিং কেন ও কখন ব্যবহার করতে হয়

যেসব অ্যাপ্লিকেশনের জন্য সঠিক, আপ-টু-ডেট এবং লোকেশন-নির্দিষ্ট তথ্য প্রয়োজন, সেগুলির জন্য Google Maps-এর মাধ্যমে গ্রাউন্ডিং আদর্শ। এটি ব্যবহারকারীর অভিজ্ঞতাকে আরও উন্নত করে কারণ এটি প্রাসঙ্গিক ও পছন্দমতো কন্টেন্ট প্রদান করে। এই কন্টেন্ট Google Maps-এর বিশ্বজুড়ে ২৫০ মিলিয়নেরও বেশি জায়গার বিশাল ডেটাবেস থেকে নেওয়া হয়।

আপনার অ্যাপ্লিকেশনের এগুলি প্রয়োজন হলে, আপনাকে Grounding with 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}")

জাভাস্ক্রিপ্ট

// 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}")

জাভাস্ক্রিপ্ট

// 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

জাভাস্ক্রিপ্ট

// 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())
}

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' \
  -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
    }]
  }'

পরিষেবা ব্যবহারের প্রয়োজনীয়তা

এই বিভাগে Grounding with Google Maps-এর পরিষেবা ব্যবহারের প্রয়োজনীয়তা বর্ণনা করা হয়েছে।

Google Maps সোর্সের ব্যবহার সম্পর্কে ব্যবহারকারীকে জানানো

Google Maps-এর প্রতিটি গ্রাউন্ডেড ফলাফলের সাথে, আপনি model_output ধাপের কন্টেন্ট ব্লকে সোর্স সংক্রান্ত অ্যানোটেশন পাবেন যা প্রতিটি উত্তরকে সমর্থন করে। নিম্নলিখিত মেটাডেটা ফেরত দেওয়া হয়:

  • সোর্স URL
  • নাম

Google Maps-এর মাধ্যমে গ্রাউন্ডিং থেকে পাওয়া ফলাফল দেখানোর সময়, আপনাকে অবশ্যই সম্পর্কিত Google Maps সোর্স উল্লেখ করতে হবে এবং আপনার ব্যবহারকারীদের নিম্নলিখিত বিষয়গুলি জানাতে হবে:

  • Google Maps সোর্সকে অবশ্যই জেনারেট করা কন্টেন্ট অনুসরণ করতে হবে যা সোর্স সমর্থন করে। এই জেনারেট করা কন্টেন্টকে Google Maps গ্রাউন্ডেড রেজাল্টও বলা হয়।
  • Google Maps সোর্স অবশ্যই একটি ব্যবহারকারীর ইন্টার‍্যাকশনের মধ্যে দৃশ্যমান হতে হবে।

Google Maps লিঙ্ক সহ Google Maps সোর্স ডিসপ্লে করা

প্রতিটি সোর্স অ্যানোটেশনের জন্য, এইসব প্রয়োজনীয়তা মেনে লিঙ্ক প্রিভিউ তৈরি করতে হবে:

  • Google Maps টেক্সট অ্যাট্রিবিউশন নির্দেশিকা মেনে Google Maps-এ প্রতিটি সোর্সকে অ্যাট্রিবিউট করুন।
  • উত্তরে উল্লেখ করা সোর্সের নাম দেখাও।
  • অ্যানোটেশন থেকে url ব্যবহার করে সোর্সে লিঙ্ক করুন।

Google Maps টেক্সট অ্যাট্রিবিউশন নির্দেশিকা

টেক্সটে Google Maps-এ সোর্স অ্যাট্রিবিউট করার সময়, এইসব নির্দেশিকা মেনে চলুন:

  • Google Maps-এর টেক্সট কোনওভাবেই পরিবর্তন করবেন না:
    • Google Maps-এর ক্যাপিটালাইজেশন পরিবর্তন করবেন না।
    • Google Maps-কে একাধিক লাইনে র‍্যাপ করবেন না।
    • Google Maps-কে অন্য ভাষায় লোকালাইজ করবেন না।
    • HTML attribute 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-এ কী কী ডেটা উপলভ্য আছে তার উপর ভিত্তি করে ফলাফল আলাদা হতে পারে।
  • ভৌগোলিক পরিধি: Grounding with Google Maps বিশ্বব্যাপী উপলভ্য।
  • ডিফল্ট স্টেট: Grounding with Google Maps টুল ডিফল্ট হিসেবে বন্ধ থাকে। আপনার API অনুরোধে আপনাকে এটি স্পষ্টভাবে চালু করতে হবে।

মূল্য ও রেট সীমা

মডেল জেনারেশনের উপর নির্ভর করে Google Maps-এর সাথে গ্রাউন্ডিংয়ের দাম আলাদা হয়:

  • Gemini 3 ও এর পরের যেকোনও মডেল: মডেলটি এক্সিকিউট করার সিদ্ধান্ত নিয়েছে এমন প্রতিটি সার্চ কোয়েরির জন্য আপনার প্রোজেক্টকে বিল করা হয়। সব Gemini 3 ও এর পরের যেকোনও মডেল জুড়ে প্রতি মাসে ৫,০০০টি ফ্রি অনুরোধ শেয়ার করা হয় এবং তারপরে ১,০০০টি সার্চ কোয়েরি পিছু$১৪ চার্জ করা হয়। একটি সার্চ প্রম্পট (মডেলের কাছে আপনার API অনুরোধ) থেকে প্রয়োজনীয় তথ্য খুঁজে পেতে মডেলটি একাধিক সার্চ কোয়েরি এক্সিকিউট করতে পারে। এইসব কোয়েরির প্রতিটিকেই টুলের বিলযোগ্য ব্যবহার হিসেবে গণ্য করা হয়।
  • Gemini 2.5 ও তার আগের মডেল: আপনার প্রোজেক্টে প্রতিটি সার্চ প্রম্পট পিছু বিল করা হয় (১,০০০টি গ্রাউন্ডেড প্রম্পট পিছু $২৫)। কোনও প্রম্পট সফলভাবে অন্তত একটি Google Maps গ্রাউন্ডেড ফলাফল রিটার্ন করলে তবেই অনুরোধের জন্য বিল করা হয়। এটি সেই ফলাফল পাওয়ার জন্য মডেল ইন্টার্নালি কতগুলি স্বতন্ত্র সার্চ কোয়েরি পারফর্ম করেছে তার উপর নির্ভর করে না।

Grounding with Google Maps-এর কোটা সাধারণত অন্তর্নিহিত Gemini মডেলের রেট লিমিটের সাথে সামঞ্জস্যপূর্ণ হয়। মূল্য সংক্রান্ত বিস্তারিত তথ্য পেতে, Gemini API মূল্য পৃষ্ঠা দেখুন।

মানানসই মডেল

নিম্নলিখিত মডেলগুলি Google Maps-এর মাধ্যমে গ্রাউন্ডিংয়ের সুবিধা দেয়:

মডেল Google Maps-এর মাধ্যমে গ্রাউন্ডিং
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 মডেল কাস্টম টুলের (ফাংশন কলিং) সাথে এইসব বিল্ট-ইন টুল একত্রিত করার সুবিধা দেয়। টুলের কম্বিনেশন পৃষ্ঠা থেকে আরও জানুন।

এর পরে কী করতে হবে