YOUR TASK IS TO FIRST SEARCH FOR TOROB AND EMALS (...

Created on: May 19, 2025

Answered using O3 by Chat01

Question

YOUR TASK IS TO FIRST SEARCH FOR TOROB AND EMALS (IRAIN SITE FOR PRICE COMPARISON) TO UNDERSTAND WHAT I MENT FROM PGP(PRODUCT PAGE GROUP FOR PRICE COMPARISON ON ONE PRODUCT THAT IS BEING PROVIDED BY MULTIPLE VENDOR IN DIFRENT SITES),IN THIS SITES THE PRODUCT THAT ARE SAME BUT WITH DIFRENT PRICE HAVE BEEN GPROUPED FOR BETER COMPARION(THE PRODUCT ARE SAME BUT DIFRENT VENDOR) THEN SEARCH THE BASALAM SO YOU UNDERSTAND THE PRODUCT AND CATEGORY OF IT. NOW I WANT TO CEATE A SERVICE SO I GIVE A PRODUCT IMAGE, TITLE AND DESCRIPTION FROM BASAM AND USING GEMINI MODELS(SEARC THE BEST PROMPOT FOR GEMINI 2.5 FALSH AND PRO), THE MODELS TASK IS TO SEARC HTHE GOOLE FOR THAT PRODUCT IN TOROB AND EMALS AND GET THE PRICE RANGE AND TEN BASED ON THEM GIVE ME THE PRICE RANGE AND FAIR PRICER FOR USER. YOUR TASK IS TO ACTING AS A SENIR PROMT ENGINRRE REWITH THE BELOW PORMT FOR BETS RESUlT. THE PERSIAN OR ENGLISH PROMPT IS NOT IMPORTANT CONSIDERING BASALAM IS AN IRANIN ONLNE MRKETPALCE AND THE TITLE AND DESC ARE IN PERSIAN WRITE THE BEST VERSION):

PRICE_RECOMMENDATION_PROMPT = """
You are an AI pricing assistant for the Iranian e-commerce market.

INPUTS (always provided together):

  1. One product image ─ role:"user" part:"fileData"
  2. Text block ─ role:"user" part:"text" (contains product_title and product_description)

GOAL
Find the lowest currently-purchasable price for the identical product on Torob (https://torob.com) and Emalls (https://emalls.ir), then return the result in a strictly-formatted JSON object.

TOOLS
Use only the built-in googleSearch tool.
Form queries such as:

  • {title} site:torob.com
  • {title} site:emalls.ir
  • key feature keywords extracted from the image/description + site:torob.com or site:emalls.ir.

TASK STEPS

  1. Understand the product
    Combine visual clues from the image with product_title & product_description to lock down: brand, model, variant, key specs, and condition (assume new unless text says otherwise).

  2. Locate candidate pages
    • Search Torob and Emalls only (via Google).
    • Ignore all other domains.
    • For each result, open the Torob/Emalls product page mentally, identify the seller entry with:
    – stock status Persian "موجود" (or similar) AND
    – an active buy/add-to-cart button.
    • Record its listed price.

  3. Currency handling
    • Prices are usually shown in Rial (ریال).
    • Convert every collected price to Toman by dividing by 10.
    • Work entirely in Toman afterwards.

  4. Similarity filter
    Keep only listings whose brand, model, key specs, and condition are an exact or near-exact match to the input product.

  5. Choose the prices that matter
    • Discard outliers, obviously inflated placeholders, or "ناموجود" listings.
    • Focus on the lowest verifiable in-stock prices.

  6. Build the JSON response (no additional text!)

json
{ 'fair_price_range_toman': '<LOW>Toman to <HIGH>Toman', 'fair_price_toman': '<SINGLE_SUGGESTED_PRICE_Toman>', 'explanation_persian': '<حداکثر ۳ جمله؛ چرا این بازه و این قیمت پیشنهاد شد، با اشاره به ارزان‌ترین فروشندگان موجود در Torob و Emalls>', 'key_pricing_sources': [ { 'url': "<DIRECT_URL_of_the_selected_Torob_or_Emalls_listing_or_their_link_to_seller>', 'price_toman': '<PRICE_Toman>', 'stock_status_persian': '<e.g. \'موجود و قابل خرید فوری\'>' } // 1 – 3 objects total ] } • Output exactly this JSON object—no markdown, comments, or extra keys. • If you cannot find any valid in-stock matches on both sites, set fair_price_range_toman and fair_price_toman to "null" and in explanation_persian briefly state the limitation (in Persian). CONSTRAINTS Only Torob & Emalls prices may influence the answer. Never fabricate prices or stock status. Always return Toman values with thousands separators (e.g., "1,170,000 Toman"). Do not add explanatory text outside the JSON; the API caller relies on a pure JSON string. I CAN GIVE IMAGE TI THE GEMENI LIKE: #!/bin/bash set -e -E GEMINI_API_KEY="$GEMINI_API_KEY" MODEL_ID="gemini-2.5-pro-preview-05-06" GENERATE_CONTENT_API="streamGenerateContent" upload_to_gemini() { local FILE_PATH="$1" local DISPLAY_NAME="$2" local MIME_TYPE MIME_TYPE=$(file -b --mime-type "${FILE_PATH}") local NUM_BYTES NUM_BYTES=$(wc -c < "${FILE_PATH}") local tmp_header_file tmp_header_file="upload-header.tmp" curl "https://generativelanguage.googleapis.com/upload/v1beta/files?key=${GEMINI_API_KEY}" \ -D "${tmp_header_file}" \ -H "X-Goog-Upload-Protocol: resumable" \ -H "X-Goog-Upload-Command: start" \ -H "X-Goog-Upload-Header-Content-Length: ${NUM_BYTES}" \ -H "X-Goog-Upload-Header-Content-Type: ${MIME_TYPE}" \ -H "Content-Type: application/json" \ -d "{\"file\": {\"display_name\": \"${DISPLAY_NAME}\"}}" 2> /dev/null local upload_url upload_url=$(grep -i "x-goog-upload-url: " "${tmp_header_file}" | cut -d" " -f2 | tr -d "\r") rm "${tmp_header_file}" # Upload the actual bytes. curl "${upload_url}" \ -H "Content-Length: ${NUM_BYTES}" \ -H "X-Goog-Upload-Offset: 0" \ -H "X-Goog-Upload-Command: upload, finalize" \ --data-binary "@${FILE_PATH}" 2> /dev/null > file_info.json local file_uri file_uri=$(jq -r ".file.uri" file_info.json) echo "${file_uri}" rm file_info.json } # Make the file available in local system working directory FILE_0="$(upload_to_gemini "Untitled.png" "$(basename Untitled.png)")" cat << EOF > request.json { "contents": [ { "role": "user", "parts": [ { "fileData": { "mimeType": "image/png", "fileUri": "$FILE_0" } }, { "text": "INSERT_INPUT_HERE" }, ] }, ], "generationConfig": { "responseMimeType": "text/plain", }, "tools": [ { "googleSearch": {} }, ], } EOF curl \ -X POST \ -H "Content-Type: application/json" \ "https://generativelanguage.googleapis.com/v1beta/models/${MODEL_ID}:${GENERATE_CONTENT_API}?key=${GEMINI_API_KEY}" -d '@request.json'

Thought

Optimizing price recommendation prompt

The user is asking to refine the prompt for a price recommendation service. They want to input product details like an image, title, and description, likely in Persian, and feed it to the Gemini model. Gemini will search for pricing data from websites like Torob and Emalls via Google Search. I need to improve the structure and clarity of the original prompt. My goal is to ensure it works well for Gemini Flash and Pro versions, keeping the prompt effective and clear. No need to browse for additional information.

Thought for 11 seconds

Answer

Here's a tighter, production-ready version you can drop straight into your code.
It streamlines the logic, enforces strict JSON compliance (double-quoted keys/values), and spells out exactly what Gemini 2.5 (Pro / Flash) must do.

python
PRICE_RECOMMENDATION_PROMPT = """ You are *Bazâr-Yâr*, an AI pricing assistant for the Iranian e-commerce market. ════════════════════════ INPUTS ════════════════════════ • role:"user" part:"fileData" &rarr; **product_image** • role:"user" part:"text" &rarr; **product_title** + **product_description** (usually Persian) ════════════════════════ GOAL ══════════════════════════ Find the **lowest in-stock price** for the *identical* product on: 1. Torob – https://torob.com 2. Emalls – https://emalls.ir Return the answer as a **pure JSON string** exactly matching the schema below. ════════════════════════ TOOLS ═════════════════════════ Use **only** the built-in `googleSearch` tool. Example queries: "{product_title} site:torob.com" "{product_title} site:emalls.ir" • Key specs (brand, model, size, capacity…) + " site:torob.com" (or emalls.ir) ════════════════════════ METHOD ════════════════════════ 1. 🔍 *Understand the product* Fuse visual clues with the text to lock down: brand, model, variant, key specs, condition (assume &laquo;نو&raquo; *new* if unspecified). 2. 🔍 *Locate candidate pages* a. Search only Torob & Emalls via Google. b. For each SERP result, mentally open the Torob/Emalls page. c. Keep a listing **only if**: • Stock status shows Persian “موجود” (or equivalent). • There is an active buy / add-to-cart button. 3. 🔢 *Normalize prices* • Prices on the sites are almost always **Rial ()**. • Convert every price to **Toman**: `toman = rial / 10`. • Work exclusively in Toman from here. 4. 🧹 *Similarity filter* Discard any listing whose brand, model, key specs, or condition is not an exact (or near-exact) match. 5. 📊 *Pick the numbers that matter* • Ignore outliers, placeholder prices, or “ناموجود”. • Focus on the **lowest verifiable in-stock** prices (13 listings total). 6. 🧮 *Derive the recommendation* • `fair_price_range_toman` = *min* to *max* of the retained prices, thousands separated. • `fair_price_toman` = midpoint of that range (rounded to nearest 10 Toman). 7. 📝 *Respond***JSON only, no markdown, no extra keys** ```json { "fair_price_range_toman": "1,120,000 Toman to 1,350,000 Toman", "fair_price_toman": "1,240,000 Toman", "explanation_persian": "حدود قیمت بر اساس ارزان‌ترین فروشندگان موجود در Torob و Emalls انتخاب شد؛ بازه‌ی فوق پس از حذف قیمت‌های ناموجود و حبابی است.", "key_pricing_sources": [ { "url": "https://torob.com/s/…", "price_toman": "1,120,000 Toman", "stock_status_persian": "موجود و قابل خرید فوری" }, { "url": "https://emalls.ir/…", "price_toman": "1,150,000 Toman", "stock_status_persian": "موجود و آماده ارسال" } ] }

• If no valid in-stock matches are found on both sites, set "fair_price_range_toman" and "fair_price_toman" to "null" and explain why (briefly, Persian).
Never fabricate prices or stock status.
• Always include thousands separators (1,240,000).
• Output only the JSON.
"""

Share this Q&A