URL প্রসঙ্গ

ইউআরএল কনটেক্সট টুল আপনাকে ইউআরএল-এর আকারে মডেলগুলিতে অতিরিক্ত কনটেক্সট যোগ করার সুযোগ দেয়। আপনার অনুরোধে ইউআরএল অন্তর্ভুক্ত করার মাধ্যমে, মডেলটি তার প্রতিক্রিয়াকে সমৃদ্ধ ও উন্নত করার জন্য সেই পৃষ্ঠাগুলির বিষয়বস্তু অ্যাক্সেস করবে (যতক্ষণ না এটি সীমাবদ্ধতা বিভাগে তালিকাভুক্ত কোনো ইউআরএল প্রকারের অন্তর্ভুক্ত হয়)।

ইউআরএল কনটেক্সট টুলটি নিম্নলিখিত কাজগুলোর জন্য উপযোগী:

  • ডেটা নিষ্কাশন করুন : একাধিক URL থেকে মূল্য, নাম বা মূল তথ্যের মতো নির্দিষ্ট তথ্য সংগ্রহ করুন।
  • নথি তুলনা করুন : একাধিক প্রতিবেদন, প্রবন্ধ বা পিডিএফ বিশ্লেষণ করে পার্থক্য শনাক্ত করুন এবং প্রবণতা অনুসরণ করুন।
  • বিষয়বস্তু সংশ্লেষণ ও তৈরি করুন : নির্ভুল সারসংক্ষেপ, ব্লগ পোস্ট বা প্রতিবেদন তৈরি করতে একাধিক উৎস URL থেকে তথ্য একত্রিত করুন।
  • কোড ও ডকুমেন্টেশন বিশ্লেষণ করুন : কোড ব্যাখ্যা করতে, সেটআপ নির্দেশাবলী তৈরি করতে বা প্রশ্নের উত্তর পেতে একটি গিটহাব রিপোজিটরি বা প্রযুক্তিগত ডকুমেন্টেশন নির্দেশ করুন।

নিচের উদাহরণটিতে দেখানো হয়েছে কীভাবে ভিন্ন ভিন্ন ওয়েবসাইট থেকে দুটি রেসিপির তুলনা করতে হয়।

পাইথন

# This will only work for SDK newer than 2.0.0
from google import genai

client = genai.Client()

url1 = "https://www.foodnetwork.com/recipes/ina-garten/perfect-roast-chicken-recipe-1940592"
url2 = "https://www.allrecipes.com/recipe/21151/simple-whole-roast-chicken/"

interaction = client.interactions.create(
    model="gemini-3.7-flash",
    input=f"Compare the ingredients and cooking times from the recipes at {url1} and {url2}",
    tools=[{"type": "url_context"}]
)

# Print the model's text response and its source 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 == "url_citation":
                            print(f"  - {annotation.title}: {annotation.url}")

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

// This will only work for SDK newer than 2.0.0
import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

async function main() {
  const interaction = await client.interactions.create({
    model: "gemini-3.7-flash",
    input: "Compare the ingredients and cooking times from the recipes at https://www.foodnetwork.com/recipes/ina-garten/perfect-roast-chicken-recipe-1940592 and https://www.allrecipes.com/recipe/21151/simple-whole-roast-chicken/",