Argumentimi me Google Maps

Argumentimi me Google Maps lidh aftësitë gjeneruese të Gemini me të dhënat e pasura, faktike dhe të përditësuara të Google Maps. Kjo veçori u mundëson zhvilluesve të integrojnë me lehtësi funksionalitetin e vetëdijes për vendndodhjen në aplikacionet e tyre. Kur një pyetje e përdoruesit ka një kontekst në lidhje me të dhënat e Maps, modeli i Gemini përdor Google Maps për të ofruar përgjigje të sakta dhe të përditësuara që janë të përshtatshme për vendndodhjen e specifikuar të përdoruesit ose zonën e përgjithshme.

  • Përgjigje të sakta që marrin parasysh vendndodhjen: Përdor të dhënat aktuale dhe të shumta të Google Maps për pyetje specifike gjeografike.
  • Personalizim i përmirësuar: Personalizo rekomandimet dhe informacionet bazuar në vendndodhjet e dhëna nga përdoruesit.

Fillo

Ky shembull demonstron se si të integrosh "Argumentimin me Google Maps" në aplikacionin tënd për të ofruar përgjigje të sakta dhe të përshtatshme për vendndodhjen për kërkesat e përdoruesve. Kërkesa kërkon rekomandime lokale me një vendndodhje opsionale të përdoruesit, duke bërë të mundur që modeli i Gemini të përdorë të dhënat e 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(""));
                }
              }
            }
          }
        }
      }
    }
  }
}

Go

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

Si funksionon argumentimi me Google Maps

"Argumentimi me Google Maps" integron Gemini API me ekosistemin e Google Geo duke përdorur Maps API si burim argumentimi. Kur kërkesa e një përdoruesi përfshin kontekst gjeografik, modeli i Gemini mund të përdorë veglën "Argumentimi me Google Maps". Më pas, modeli mund të gjenerojë përgjigje të bazuara në të dhënat e Google Maps që janë të përshtatshme për vendndodhjen e dhënë.

Procesi zakonisht përfshin:

  1. Kërkesa e përdoruesit: Një përdorues dërgon një kërkesë në aplikacionin tënd, duke përfshirë mundësisht kontekstin gjeografik (p.sh. "kafene pranë meje", "muze në San-Fransisko").
  2. Zbatimi i veglës: Modeli i Gemini, duke njohur synimin gjeografik, zbaton veglën "Argumentimi me Google Maps". Kjo vegël mund të ofrohet si opsion me latitude dhe longitude të përdoruesit. Vegla është një vegël kërkimi me tekst dhe funksionon në mënyrë të ngjashme me kërkimin në Maps, në atë që kërkesat lokale ("pranë meje") do të përdorin koordinatat, ndërsa kërkesat specifike ose jolokale ka të ngjarë që të mos ndikohen nga vendndodhja e qartë.
  3. Marrja e të dhënave: Shërbimi i "Kërkimit në terren" me Google Maps kërkon në Google Maps për informacione përkatëse (p.sh. vende, komente, fotografi, adresa, orare hapjeje).
  4. Gjenerimi i bazuar: Të dhënat e marra nga Maps përdoren për të informuar përgjigjen e modelit të Gemini, duke garantuar saktësinë faktike dhe përshtatshmërinë.
  5. Përgjigjja dhe shënimet: Modeli kthen një përgjigje me tekst me shënime të ndërfutura që lidhen me burimet e Google Maps, duke bërë të mundur që zhvilluesit të shfaqin citime.

Pse dhe kur duhet të përdorësh "Argumentimin me Google Maps"

"Vendosja në tokë" me Google Maps është ideale për aplikacionet që kërkojnë informacione të sakta, të përditësuara dhe specifike për vendndodhjen. Ai përmirëson përvojën e përdoruesit duke ofruar përmbajtje të personalizuara dhe të përshtatshme të mbështetura nga baza e gjerë e të dhënave e Google Maps me mbi 250 milionë vende në mbarë botën.

Duhet të përdorësh "Argumentimin me Google Maps" kur aplikacioni yt ka nevojë që:

  • Të japësh përgjigje të plota dhe të sakta për pyetjet specifike për vendndodhjen gjeografike.
  • Krijo planifikues udhëtimesh dhe udhëzues lokalë bisedorë.
  • Rekomando pika interesi bazuar në vendndodhjen dhe preferencat e përdoruesit, si p.sh. restorante ose dyqane.
  • Krijo përvoja të vetëdijshme për vendndodhjen për shërbimet sociale, të shitjes me pakicë ose të dërgesave të ushqimeve.

Argumentimi me Google Maps shkëlqen në rastet e përdorimit ku afërsia dhe të dhënat aktuale faktike janë kritike, si p.sh. gjetja e "kafeneja më e mirë pranë meje" ose marrja e udhëzimeve.

Rastet e përdorimit

"Argumentimi me Google Maps" mbështet një sërë rastesh përdorimi që përfshijnë vendndodhjen.

Trajtimi i pyetjeve specifike për vendin

Bëj pyetje të detajuara për një vend specifik për të marrë përgjigje bazuar në komentet e përdoruesve të Google dhe të dhëna të tjera të 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(""));
                }
              }
            }
          }
        }
      }
    }
  }
}

Go

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

Ofrojnë personalizim bazuar te vendndodhja

Merr rekomandime të personalizuara për preferencat e një përdoruesi dhe një zonë specifike gjeografike.

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

Go

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

Ndihmon për planifikimin e itinerarit

Gjenero plane shumëditore me udhëzime dhe informacione për vendndodhje të ndryshme, të përsosura për aplikacionet e udhëtimit.

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(""));

Go

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

Kërkesat për përdorimin e shërbimit

Ky seksion përshkruan kërkesat për përdorimin e shërbimit për "Argumentimin me Google Maps".

Informo përdoruesin për përdorimin e burimeve të Google Maps

Me çdo rezultat të bazuar në Google Maps, do të marrësh shënime të burimit në blloqet e përmbajtjes së hapit model_output që mbështesin çdo përgjigje. Metadatat e mëposhtme janë kthyer:

  • url-ja e burimit
  • emri

Kur paraqet rezultate nga "Argumentimi me Google Maps", duhet të specifikosh burimet përkatëse të Google Maps dhe të informosh përdoruesit e tu për sa më poshtë:

  • Burimet e Google Maps duhet të vijojnë menjëherë pas përmbajtjes së gjeneruar që mbështesin burimet. Kjo përmbajtje e gjeneruar njihet gjithashtu si "Rezultati i bazuar në Google Maps".
  • Burimet e Google Maps duhet të jenë të shikueshme brenda një ndërveprimi të përdoruesit.

Shfaq burimet e Google Maps me lidhjet e Google Maps

Për çdo shënim burimi, duhet të gjenerohet një pamje paraprake e lidhjes duke ndjekur këto kërkesa:

  • Atribuo çdo burim te Google Maps duke ndjekur udhëzimet e atribuimit të tekstit të Google Maps.
  • Shfaq emrin e burimit të dhënë në përgjigje.
  • Lidhja me burimin duke përdorur url nga shënimi.

Udhëzimet për atribuimin me tekst të Google Maps

Kur u atribuon burime Google Maps në tekst, ndiq këto udhëzime:

  • Mos e modifiko tekstin Google Maps në asnjë mënyrë:
    • Mos e ndrysho kapitalizimin e Google Maps.
    • Mos e mbështill Google Maps në disa rreshta.
    • Mos e lokalizo Google Maps në një gjuhë tjetër.
    • Parandalo përkthimin e Google Maps nga shfletuesit duke përdorur atributin translate="no" të HTML.

Për më shumë informacione për disa nga ofruesit e të dhënave të Google Maps dhe kushtet e tyre të licencës, shiko njoftimet ligjore të Google Maps dhe Google Earth.

Praktikat më të mira

  • Jep vendndodhjen e përdoruesit: Për përgjigjet më të përshtatshme dhe të personalizuara, përfshi gjithmonë latitude dhe longitude në konfigurimin e veglës sate të google_maps kur vendndodhja e përdoruesit është e njohur.
  • Informo përdoruesit fundorë: Informo në mënyrë të qartë përdoruesit fundorë që të dhënat e Google Maps po përdoren për t'iu përgjigjur pyetjeve të tyre, sidomos kur vegla është e aktivizuar.
  • Çaktivizoje kur nuk nevojitet: Argumentimi me Google Maps është joaktiv si parazgjedhje. Aktivizoje atë ("tools": [{"type": "google_maps"}]) vetëm kur një kërkesë ka një kontekst të qartë gjeografik, për të optimizuar performancën dhe koston.

Kufizimet

  • "Bazimi" me Google Maps aktualisht mbështet vetëm kërkesat dhe përgjigjet në anglisht.
  • Vegla mund të mos ofrohet në të gjitha rajonet.
  • Rezultatet mund të variojnë në bazë të saktësisë së vendndodhjes dhe të dhënave të disponueshme të Maps.
  • Shtrirja gjeografike: Argumentimi me Google Maps ofrohet në nivel global.
  • Gjendja e parazgjedhur: Vegla "Argumentimi me Google Maps" është joaktive si parazgjedhje. Duhet ta aktivizosh në mënyrë të qartë në kërkesat e tua të API-së.

Kufijtë e çmimeve dhe tarifave

Çmimi i "Argumentimit me Google Maps" ndryshon në varësi të gjeneratës së modelit:

  • Gemini 3 dhe modelet më të reja: Projekti yt faturohet për çdo kërkesë kërkimi që modeli vendos të ekzekutojë, me 5000 kërkesa falas në muaj të ndara në të gjitha modelet Gemini 3 dhe më të reja dhe më pas 14 USD për 1000 kërkesa kërkimi. Një kërkesë e vetme kërkimi (kërkesa jote e API-së për modelin) mund të bëjë që modeli të ekzekutojë disa kërkesa kërkimi për të gjetur informacionet e nevojshme. Secili nga këto kërkesa llogaritet si një përdorim i faturueshëm i veglës.
  • Gemini 2.5 dhe modelet më të vjetra: Projekti yt faturohet për çdo kërkesë kërkimi (25 USD për 1000 kërkesa të bazuara në kontekst). Një kërkesë faturohet vetëm nëse kërkesa kthen me sukses të paktën një rezultat të bazuar në Google Maps, pavarësisht se sa kërkesa individuale kërkimi ka kryer modeli në nivel të brendshëm për të marrë atë rezultat.

Kuota për "Argumentimin me Google Maps" zakonisht përputhet me kufijtë e normës së modelit bazë të Gemini. Për informacione të detajuara për çmimet, shiko faqen e çmimeve të Gemini API.

Modelet e mbështetura

Modelet e mëposhtme mbështesin "Argumentimin me Google Maps":

Modeli Argumentimi me Google Maps
Gemini 4 Argon ✔️
Gemini 3.8 Flash ✔️
Gemini 3.6 Flash ✔️
Gemini 3.5 Flash-Lite ✔️
Versioni paraprak i Gemini 3.1 Pro ✔️
Gemini 3.1 Flash-Lite ✔️
Gemini 3 Flash Preview ✔️
Gemini 2.5 Pro ✔️
Gemini 2.5 Flash ✔️
Gemini 2.5 Flash-Lite ✔️

Kombinimet e mbështetura të veglave

Mund të përdorësh "Argumentimin me Google Maps" me veglat e tjera të integruara, si p.sh. Argumentimi me "Kërko në Google" (mbështetet në Gemini 3.5 Flash-Lite dhe modelet e mëvonshme) për të mundësuar raste përdorimi më kompleks. Modelet e Gemini 3 mbështesin gjithashtu kombinimin e këtyre veglave të integruara me veglat e personalizuara (thirrja e funksionit). Mëso më shumë në faqen e kombinimeve të veglave.

Çfarë ka më pas