यूआरएल का कॉन्टेक्स्ट

यूआरएल कॉन्टेक्स्ट टूल की मदद से, मॉडल को यूआरएल के तौर पर अतिरिक्त कॉन्टेक्स्ट दिया जा सकता है. मॉडल, उन यूआरएल से कॉन्टेंट ऐक्सेस कर सकता है, ताकि वह जवाब देने के साथ-साथ उसे बेहतर भी बना सके.

यूआरएल के कॉन्टेक्स्ट से ये फ़ायदे मिलते हैं:

  • डेटा निकालना: किसी लेख या कई यूआरएल से, कीमत, नाम या मुख्य नतीजे जैसी जानकारी दें.

  • जानकारी की तुलना करना: अंतरों का पता लगाने और रुझानों को ट्रैक करने के लिए, कई रिपोर्ट, लेख या PDF का विश्लेषण करें.

  • कॉन्टेंट को आपस में जोड़ना और नया कॉन्टेंट बनाना: सटीक जवाब, ब्लॉग पोस्ट, रिपोर्ट या परीक्षा के सवाल जनरेट करने के लिए, कई सोर्स यूआरएल से मिली जानकारी को आपस में जोड़ें.

  • कोड और तकनीकी कॉन्टेंट का विश्लेषण करना: कोड के बारे में बताने, सेटअप करने के निर्देश जनरेट करने या सवालों के जवाब देने के लिए, GitHub रिपॉज़िटरी या तकनीकी दस्तावेज़ों के यूआरएल दें.

यूआरएल कॉन्टेक्स्ट टूल का इस्तेमाल करते समय, पक्का करें कि आपने सबसे सही तरीके और सीमाएं देख ली हों.

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

  • gemini-3-pro-preview
  • gemini-3-flash-preview
  • gemini-2.5-pro
  • gemini-2.5-flash
  • gemini-2.5-flash-lite

यह सुविधा इन भाषाओं में काम करती है

Gemini मॉडल के लिए, इस्तेमाल की जा सकने वाली भाषाएं देखें.

यूआरएल कॉन्टेक्स्ट टूल का इस्तेमाल करना

यूआरएल कॉन्टेक्स्ट टूल का इस्तेमाल दो मुख्य तरीकों से किया जा सकता है:

सिर्फ़ यूआरएल कॉन्टेक्स्ट टूल

इस पेज पर, Gemini API उपलब्ध कराने वाली कंपनी के हिसाब से कॉन्टेंट और कोड देखने के लिए, Gemini API उपलब्ध कराने वाली कंपनी पर क्लिक करें.

GenerativeModel इंस्टेंस बनाते समय, GenerativeModel को टूल के तौर पर उपलब्ध कराएं.UrlContext इसके बाद, सीधे अपने प्रॉम्प्ट में उन यूआरएल को डालें जिन्हें आपको मॉडल से ऐक्सेस और विश्लेषण कराना है.

यहां दिए गए उदाहरण में, अलग-अलग वेबसाइटों की दो रेसिपी की तुलना करने का तरीका बताया गया है:

Swift


import FirebaseAILogic

// Initialize the Gemini Developer API backend service
let ai = FirebaseAI.firebaseAI(backend: .googleAI())

// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
    modelName: "GEMINI_MODEL_NAME",
    // Enable the URL context tool.
    tools: [Tool.urlContext()]
)

// Specify one or more URLs for the tool to access.
let url1 = "FIRST_RECIPE_URL"
let url2 = "SECOND_RECIPE_URL"

// Provide the URLs in the prompt sent in the request.
let prompt = "Compare the ingredients and cooking times from the recipes at \(url1) and \(url2)"

// Get and handle the model's response.
let response = try await model.generateContent(prompt)
print(response.text ?? "No text in response.")

Kotlin


// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Enable the URL context tool.
    tools = listOf(Tool.urlContext())
)

// Specify one or more URLs for the tool to access.
val url1 = "FIRST_RECIPE_URL"
val url2 = "SECOND_RECIPE_URL"

// Provide the URLs in the prompt sent in the request.
val prompt = "Compare the ingredients and cooking times from the recipes at $url1 and $url2"

// Get and handle the model's response.
val response = model.generateContent(prompt)
print(response.text)

Java


// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Enable the URL context tool.
                        List.of(Tool.urlContext(new UrlContext())));

// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);

// Specify one or more URLs for the tool to access.
String url1 = "FIRST_RECIPE_URL";
String url2 = "SECOND_RECIPE_URL";

// Provide the URLs in the prompt sent in the request.
String prompt = "Compare the ingredients and cooking times from the recipes at " + url1 + " and " + url2 + "";

ListenableFuture response = model.generateContent(prompt);
  Futures.addCallback(response, new FutureCallback() {
      @Override
      public void onSuccess(GenerateContentResponse result) {
          String resultText = result.getText();
          System.out.println(resultText);
      }

      @Override
      public void onFailure(Throwable t) {
          t.printStackTrace();
      }
  }, executor);

Web


import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";

// TODO(developer) Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};

// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);

// Initialize the Gemini Developer API backend service
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });

// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Enable the URL context tool.
    tools: [{ urlContext: {} }]
  }
);

// Specify one or more URLs for the tool to access.
const url1 = "FIRST_RECIPE_URL"
const url2 = "SECOND_RECIPE_URL"

// Provide the URLs in the prompt sent in the request.
const prompt = `Compare the ingredients and cooking times from the recipes at ${url1} and ${url2}`

// Get and handle the model's response.
const result = await model.generateContent(prompt);
console.log(result.response.text());

Dart


import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';

// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Enable the URL context tool.
  tools: [
    Tool.urlContext(),
  ],
);

// Specify one or more URLs for the tool to access.
final url1 = "FIRST_RECIPE_URL";
final url2 = "SECOND_RECIPE_URL";

// Provide the URLs in the prompt sent in the request.
final prompt = "Compare the ingredients and cooking times from the recipes at $url1 and $url2";

// Get and handle the model's response.
final response = await model.generateContent([Content.text(prompt)]);
print(response.text);

Unity


using Firebase;
using Firebase.AI;

// Initialize the Gemini Developer API backend service
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());

// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Enable the URL context tool.
  tools: new[] { new Tool(new UrlContext()) }
);

// Specify one or more URLs for the tool to access.
var url1 = "FIRST_RECIPE_URL";
var url2 = "SECOND_RECIPE_URL";

// Provide the URLs in the prompt sent in the request.
var prompt = $"Compare the ingredients and cooking times from the recipes at {url1} and {url2}";

// Get and handle the model's response.
var response = await model.GenerateContentAsync(prompt);
UnityEngine.Debug.Log(response.Text ?? "No text in response.");

अपने इस्तेमाल के उदाहरण और ऐप्लिकेशन के लिए, सही मॉडल चुनने का तरीका जानें.

इस पेज पर, Gemini API उपलब्ध कराने वाली कंपनी के हिसाब से कॉन्टेंट और कोड देखने के लिए, Gemini API उपलब्ध कराने वाली कंपनी पर क्लिक करें.

यूआरएल के कॉन्टेक्स्ट और Google Search से मिली जानकारी का इस्तेमाल करने, दोनों को चालू किया जा सकता है. इस कॉन्फ़िगरेशन की मदद से, किसी यूआरएल के साथ या उसके बिना प्रॉम्प्ट लिखे जा सकते हैं.

Google Search से जानकारी पाने की सुविधा चालू होने पर, मॉडल सबसे पहले Google Search का इस्तेमाल करके काम की जानकारी ढूंढ सकता है. इसके बाद, यूआरएल के कॉन्टेक्स्ट टूल का इस्तेमाल करके, खोज नतीजों के कॉन्टेंट को पढ़ सकता है. इससे, जानकारी को ज़्यादा गहराई से समझने में मदद मिलती है. यह अप्रोच उन प्रॉम्प्ट के लिए कारगर है जिनमें ब्रॉड सर्चिंग और कुछ पेजों का बारीकी से विश्लेषण, दोनों की ज़रूरत होती है.

यहां इनके इस्तेमाल के कुछ उदाहरण दिए गए हैं:

  • आपने प्रॉम्प्ट में एक यूआरएल दिया है, ताकि जनरेट किए गए कुछ जवाबों में मदद मिल सके. हालांकि, सही जवाब जनरेट करने के लिए, मॉडल को अब भी अन्य विषयों के बारे में ज़्यादा जानकारी चाहिए. इसलिए, यह Google Search टूल के साथ ग्राउंडिंग का इस्तेमाल करता है.

    प्रॉम्प्ट का उदाहरण:
    Give me a three day event schedule based on YOUR_URL. Also what do I need to pack according to the weather?

  • आपने प्रॉम्प्ट में कोई यूआरएल नहीं दिया है. इसलिए, सही जवाब जनरेट करने के लिए मॉडल, Google Search के साथ ग्राउंडिंग टूल का इस्तेमाल करता है. इससे वह काम के यूआरएल ढूंढ पाता है. इसके बाद, वह यूआरएल कॉन्टेक्स्ट टूल का इस्तेमाल करके, उनके कॉन्टेंट का विश्लेषण करता है.

    प्रॉम्प्ट का उदाहरण:
    Recommend 3 beginner-level books to learn about the latest YOUR_SUBJECT.

यहां दिए गए उदाहरण में, यूआरएल कॉन्टेक्स्ट और Google Search की मदद से जवाब पाने की सुविधा, दोनों को चालू करने और इस्तेमाल करने का तरीका बताया गया है:


import FirebaseAILogic

// Initialize the Gemini Developer API backend service
let ai = FirebaseAI.firebaseAI(backend: .googleAI())

// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
    modelName: "GEMINI_MODEL_NAME",
    // Enable both the URL context tool and Google Search tool.
    tools: [
      Tool.urlContex(),
      Tool.googleSearch()
    ]
)

// Specify one or more URLs for the tool to access.
let url = "YOUR_URL"

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
let prompt = "Give me a three day event schedule based on \(url). Also what do I need to pack according to the weather?"

// Get and handle the model's response.
let response = try await model.generateContent(prompt)
print(response.text ?? "No text in response.")

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result


// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Enable both the URL context tool and Google Search tool.
    tools = listOf(Tool.urlContext(), Tool.googleSearch())
)

// Specify one or more URLs for the tool to access.
val url = "YOUR_URL"

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
val prompt = "Give me a three day event schedule based on $url. Also what do I need to pack according to the weather?"

// Get and handle the model's response.
val response = model.generateContent(prompt)
print(response.text)

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result


// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Enable both the URL context tool and Google Search tool.
                        List.of(Tool.urlContext(new UrlContext()), Tool.googleSearch(new GoogleSearch())));

// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);

// Specify one or more URLs for the tool to access.
String url = "YOUR_URL";

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
String prompt = "Give me a three day event schedule based on " + url + ". Also what do I need to pack according to the weather?";

ListenableFuture response = model.generateContent(prompt);
  Futures.addCallback(response, new FutureCallback() {
      @Override
      public void onSuccess(GenerateContentResponse result) {
          String resultText = result.getText();
          System.out.println(resultText);
      }

      @Override
      public void onFailure(Throwable t) {
          t.printStackTrace();
      }
  }, executor);

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result


import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";

// TODO(developer) Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};

// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);

// Initialize the Gemini Developer API backend service
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });

// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Enable both the URL context tool and Google Search tool.
    tools: [{ urlContext: {} }, { googleSearch: {} }],
  }
);

// Specify one or more URLs for the tool to access.
const url = "YOUR_URL"

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
const prompt = `Give me a three day event schedule based on ${url}. Also what do I need to pack according to the weather?`

// Get and handle the model's response.
const result = await model.generateContent(prompt);
console.log(result.response.text());

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result


import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';

// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Enable both the URL context tool and Google Search tool.
  tools: [
    Tool.urlContext(),
    Tool.googleSearch(),
  ],
);

// Specify one or more URLs for the tool to access.
final url = "YOUR_URL";

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
final prompt = "Give me a three day event schedule based on $url. Also what do I need to pack according to the weather?";

final response = await model.generateContent([Content.text(prompt)]);
print(response.text);

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result


using Firebase;
using Firebase.AI;

// Initialize the Gemini Developer API backend service
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());

// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Enable both the URL context tool and Google Search tool.
  tools: new[] { new Tool(new GoogleSearch()), new Tool(new UrlContext()) }
);

// Specify one or more URLs for the tool to access.
var url = "YOUR_URL";

// Provide the URLs in the prompt sent in the request.
// If the model can't generate a response using its own knowledge or the content in the specified URL,
// then the model will use the grounding with Google Search tool.
var prompt = $"Give me a three day event schedule based on {url}. Also what do I need to pack according to the weather?";

// Get and handle the model's response.
var response = await model.GenerateContentAsync(prompt);
UnityEngine.Debug.Log(response.Text ?? "No text in response.");

// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result

अपने इस्तेमाल के उदाहरण और ऐप्लिकेशन के लिए, सही मॉडल चुनने का तरीका जानें.

यूआरएल कॉन्टेक्स्ट टूल कैसे काम करता है

यूआरएल कॉन्टेक्स्ट टूल, जानकारी पाने के लिए दो चरणों वाली प्रोसेस का इस्तेमाल करता है. इससे तेज़ी से, कम लागत में, और नए डेटा को ऐक्सेस किया जा सकता है.

पहला चरण: जब कोई यूआरएल दिया जाता है, तो टूल सबसे पहले इंटरनल इंडेक्स कैश से कॉन्टेंट फ़ेच करने की कोशिश करता है. यह एक ऑप्टिमाइज़ की गई कैश मेमोरी के तौर पर काम करता है.

दूसरा चरण: अगर कोई यूआरएल इंडेक्स में उपलब्ध नहीं है (उदाहरण के लिए, अगर यह बहुत नया पेज है), तो टूल अपने-आप लाइव फ़ेच करने की सुविधा पर वापस चला जाता है. यह सीधे तौर पर यूआरएल को ऐक्सेस करता है, ताकि रीयल टाइम में उसका कॉन्टेंट वापस पाया जा सके.

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

  • खास यूआरएल दें: बेहतर नतीजे पाने के लिए, उस कॉन्टेंट के डायरेक्ट यूआरएल दें जिसका विश्लेषण आपको मॉडल से कराना है. मॉडल सिर्फ़ आपके दिए गए यूआरएल से कॉन्टेंट को वापस लाएगा. यह नेस्ट किए गए लिंक से कोई कॉन्टेंट वापस नहीं लाएगा.

  • सुलभता की जांच करें: पुष्टि करें कि आपके दिए गए यूआरएल, ऐसे पेजों पर रीडायरेक्ट न करें जिनके लिए लॉग इन करना ज़रूरी हो या जिनके लिए पैसे चुकाने पड़ते हों.

  • पूरा यूआरएल इस्तेमाल करें: पूरा यूआरएल दें. इसमें प्रोटोकॉल भी शामिल होना चाहिए. उदाहरण के लिए, सिर्फ़ example.com के बजाय https://www.example.com का इस्तेमाल करें.

जवाब को समझना

मॉडल का जवाब, यूआरएल से फ़ेच किए गए कॉन्टेंट पर आधारित होगा.

अगर मॉडल ने यूआरएल से कॉन्टेंट लिया है, तो जवाब में url_context_metadata शामिल होगा. इस तरह का जवाब कुछ ऐसा दिख सकता है (जवाब के कुछ हिस्सों को छोटा करने के लिए हटाया गया है):

{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "... \n"
          }
        ],
        "role": "model"
      },
      ...
      "url_context_metadata":
      {
          "url_metadata":
          [
            {
              "retrieved_url": "https://www.example.com",
              "url_retrieval_status": "URL_RETRIEVAL_STATUS_SUCCESS"
            },
            {
              "retrieved_url": "https://www.example.org",
              "url_retrieval_status": "URL_RETRIEVAL_STATUS_SUCCESS"
            },
          ]
        }
    }
  ]
}

सुरक्षा जांच

सिस्टम, यूआरएल पर कॉन्टेंट मॉडरेशन की जांच करता है. इससे यह पुष्टि की जाती है कि यूआरएल, सुरक्षा मानकों के मुताबिक है या नहीं. अगर आपके दिए गए यूआरएल की जांच में यह पता चलता है कि वह इस नीति का उल्लंघन करता है, तो आपको url_retrieval_status का URL_RETRIEVAL_STATUS_UNSAFE मिलेगा.

सीमाएं

यूआरएल कॉन्टेक्स्ट टूल की कुछ सीमाएं यहां दी गई हैं:

  • फ़ंक्शन कॉलिंग के साथ इस्तेमाल नहीं किया जा सकता: यूआरएल कॉन्टेक्स्ट टूल का इस्तेमाल, ऐसे अनुरोध में नहीं किया जा सकता जिसमें फ़ंक्शन कॉलिंग का इस्तेमाल किया गया हो.

  • हर अनुरोध में यूआरएल की सीमा: हर अनुरोध में ज़्यादा से ज़्यादा 20 यूआरएल शामिल किए जा सकते हैं.

  • यूआरएल के कॉन्टेंट के साइज़ की सीमा: किसी एक यूआरएल से लिए गए कॉन्टेंट का ज़्यादा से ज़्यादा साइज़ 34 एमबी हो सकता है.

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

  • यूआरएल को सार्वजनिक तौर पर ऐक्सेस किया जा सकता हो: दिए गए यूआरएल, वेब पर सार्वजनिक तौर पर ऐक्सेस किए जा सकते हों. इनके साथ काम नहीं करता: पेवॉल वाला कॉन्टेंट, ऐसा कॉन्टेंट जिसके लिए उपयोगकर्ता को साइन-इन करना पड़ता है, निजी नेटवर्क, लोकलहोस्ट पते (जैसे कि localhost या 127.0.0.1), और टनलिंग सेवाएं (जैसे कि ngrok या pinggy).

इस्तेमाल किए जा सकने वाले और इस्तेमाल न किए जा सकने वाले कॉन्टेंट टाइप

काम करता है: यह टूल, इन तरह के कॉन्टेंट वाले यूआरएल से कॉन्टेंट निकाल सकता है:

  • टेक्स्ट (text/html, application/json, text/plain, text/xml, text/css, text/javascript, text/csv, text/rtf)

  • इमेज (image/png, image/jpeg, image/bmp, image/webp)

  • PDF (application/pdf)

काम नहीं करता: यह टूल, इस तरह के कॉन्टेंट के साथ काम नहीं करता:

  • YouTube वीडियो (इसके बजाय, वीडियो का विश्लेषण करें देखें)

  • वीडियो और ऑडियो फ़ाइलें (इसके बजाय, वीडियो का विश्लेषण करें या ऑडियो का विश्लेषण करें देखें)

  • Google Workspace की फ़ाइलें, जैसे कि Google दस्तावेज़ या स्प्रेडशीट

  • (अगर Vertex AI Gemini API का इस्तेमाल किया जा रहा है) Cloud Storage यूआरएल
    इस तरह के यूआरएल, Gemini Developer API के साथ काम नहीं करते. भले ही, इसे किसी भी तरीके से ऐक्सेस किया जाए.

  • ऐसा कॉन्टेंट जिसे सार्वजनिक तौर पर ऐक्सेस नहीं किया जा सकता. इनके साथ काम नहीं किया जा सकता: पेमेंट के बाद ऐक्सेस किया जाने वाला कॉन्टेंट, ऐसा कॉन्टेंट जिसे ऐक्सेस करने के लिए उपयोगकर्ता को साइन इन करना पड़ता है, निजी नेटवर्क, लोकलहोस्ट पते (जैसे कि localhost या 127.0.0.1) और टनलिंग सेवाएं (जैसे कि ngrok या pinggy).

कीमत और गिनती करने वाले टूल के टोकन

यूआरएल से फ़ेच किए गए कॉन्टेंट को इनपुट टोकन के तौर पर गिना जाता है.

आपको अपने प्रॉम्प्ट के लिए टोकन की संख्या और टूल के इस्तेमाल की जानकारी, मॉडल के आउटपुट के usage_metadata ऑब्जेक्ट में दिख सकती है. यहां आउटपुट का एक उदाहरण दिया गया है:

'usage_metadata': {
  'candidates_token_count': 45,
  'prompt_token_count': 27,
  'prompt_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>,
    'token_count': 27}],
  'thoughts_token_count': 31,
  'tool_use_prompt_token_count': 10309,
  'tool_use_prompt_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>,
    'token_count': 10309}],
  'total_token_count': 10412
  }

रेट लिमिट और कीमत, इस्तेमाल किए गए मॉडल पर आधारित होती है. चुने गए Gemini API के यूआरएल कॉन्टेक्स्ट टूल की कीमत के बारे में ज़्यादा जानें. इसके लिए, Gemini API के दस्तावेज़ देखें: Gemini Developer API | Vertex AI Gemini API.