Google Maps-এর মাধ্যমে গ্রাউন্ডিং

Grounding with Google Maps, Gemini-র জেনারেটিভ ক্ষমতাকে Google Maps-এর সমৃদ্ধ, ফ্যাকচুয়াল এবং আপ-টু-ডেট ডেটার সাথে কানেক্ট করে। এই ফিচার ডেভেলপারদের তাদের অ্যাপ্লিকেশনে লোকেশন-অ্যাওয়ার কার্যকারিতা সহজেই অন্তর্ভুক্ত করতে দেয়। ব্যবহারকারীর কোয়েরিতে Maps ডেটা সম্পর্কিত কোনও প্রসঙ্গ থাকলে, Gemini মডেল 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.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 মডেল Grounding with Google Maps টুল চালু করতে পারে। মডেলটি তখন Google Maps-এর ডেটার উপর ভিত্তি করে উত্তর তৈরি করতে পারে যা প্রদত্ত লোকেশনের সাথে প্রাসঙ্গিক।

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

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

Grounding with Google Maps কখন এবং কেন ব্যবহার করবেন

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

আপনার অ্যাপ্লিকেশনের এগুলি প্রয়োজন হলে, আপনাকে 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.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 অ্যাট্রিবিউট translate="no" ব্যবহার করে ব্রাউজারকে Google Maps অনুবাদ করা থেকে আটকান।

আমাদের কিছু Google Maps ডেটা পরিষেবা প্রদানকারী এবং তাদের লাইসেন্সের শর্তাবলী সম্পর্কে আরও তথ্যের জন্য, Google Maps এবং Google Earth আইনি বিজ্ঞপ্তি দেখুন।

পেশাদার পদ্ধতি

  • ব্যবহারকারীর লোকেশন প্রদান করুন: সবচেয়ে প্রাসঙ্গিক ও পছন্দমতো উত্তর পেতে, ব্যবহারকারীর লোকেশন জানা থাকলে, সবসময় আপনার google_maps টুল কনফিগারেশনে latitude ও longitude অন্তর্ভুক্ত করুন।
  • গ্রাহকদের জানান: আপনার গ্রাহকদের স্পষ্টভাবে জানান যে তাদের প্রশ্নের উত্তর দিতে Google Maps ডেটা ব্যবহার করা হচ্ছে, বিশেষ করে যখন টুলটি চালু থাকে।
  • প্রয়োজন না থাকলে টগল বন্ধ করুন: Grounding with Google Maps ডিফল্ট হিসেবে বন্ধ থাকে। পারফর্ম্যান্স ও খরচ অপ্টিমাইজ করতে, কোনও কোয়েরিতে স্পষ্ট ভৌগোলিক প্রসঙ্গ থাকলে তবেই এটি চালু করুন ("tools": [{"type": "google_maps"}])।

সীমাবদ্ধতা

  • Grounding with Google Maps বর্তমানে শুধু ইংরেজি ভাষায় প্রম্পট ও উত্তর সাপোর্ট করে।
  • টুলটি সব অঞ্চলে উপলভ্য নাও হতে পারে।
  • লোকেশন অ্যাকুরেসি ও উপলভ্য Maps ডেটার উপর ভিত্তি করে ফলাফল আলাদা হতে পারে।
  • ভৌগোলিক পরিধি: Grounding with Google Maps বিশ্বব্যাপী উপলভ্য।
  • ডিফল্ট স্টেট: Grounding with Google Maps টুল ডিফল্ট হিসেবে বন্ধ থাকে। আপনার API অনুরোধে এটি স্পষ্টভাবে চালু করতে হবে।

দাম ও রেটের সীমা

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

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

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

মানানসই মডেল

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

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