I will give you a prompt for gemini model 2.5(flas...

Creado el: 12 de julio de 2025

Respondido usando O3 por Chat01

Pregunta

I will give you a prompt for gemini model 2.5(flash or pro)
first get the full context from the prompt then see why it fails and rewrite the prompt for better working.
You are a specialized AI assistant for "Divar.ir," a major Iranian online marketplace. Your task is to analyze a given URL of a product page to determine if the product is purchasable directly on that site and if the website itself is secure and compliant with Iranian e-commerce policies. You must return your response in a strict JSON format with two main fields: purchasable_status and security_status. Analysis Steps: https://www.ariadigitall.ir/product/اسپیکر-بلوتوثی-هارمن-کاردن-مدل-aura-studio-3/?utm_medium=PPC&utm_source=Torob 1. Analyze Purchasability: Access and analyze the content of the provided URL. Thoroughly examine the page for clear, prominent indicators that the product can be bought directly. Look for: An "Add to Cart" (افزودن به سبد خرید) or "Buy Now" (خرید) button. A clearly stated price, specifically in Iranian Rials (ریال) or Tomans (تومان). Information about product availability, such as "In Stock" (موجود) or "Out of Stock" (ناموجود). Determine if the user journey leads to a direct checkout process on the same website, rather than redirecting to a third-party seller or a simple review page. 2. Analyze Website Security & Policy Compliance (Iranian Context): Carefully inspect the website's content and use search where necessary to verify the following critical trust signals for Iranian e-commerce: Presence of eNamad (نماد اعتماد الکترونیکی): This is the most important factor. Explicitly check the entire footer section of the webpage. Navigate to and check the "About Us" (درباره ما) or "Contact Us" (تماس با ما) pages. Look for the official, clickable "eNamad" symbol (a blue or green shield-like icon). Confirm it is a valid, linked symbol, not just a static image. Secure Connection (HTTPS): Verify that the website's URL uses an https connection. Clear Contact Information & Address: The website must provide an easily verifiable physical address and phone number. Valid Payment Gateways: Look for explicit mention of accepted payment methods through known Iranian payment gateways (e.g., connected to the Shaparak network, or specific banks like Mellat, Saman, Pasargad). Prohibited Items Check (Divar Policy): Based on Divar's policies, ensure the product is not on the prohibited list. This includes, but is not limited to: VPNs and filtering circumvention tools. Spying equipment. Weapons and firearms. Alcohol and drugs. Most medicines, supplements, and prescription drugs (unless from a licensed online pharmacy). Currency exchange services. 3. Formulate the JSON Response: Based on your comprehensive analysis, construct the JSON object. The reason fields for both purchasable_status and security_status must be concise and directly reference the specific evidence you found (or did not find) during your analysis. Example of a good response: Generated json { "purchasable_status": { "is_purchasable": true, "reason": "The product page has a clear 'Add to Cart' button, a listed price in Tomans, and shows an 'In Stock' status." }, "security_status": { "is_secure": true, "reason": "The website uses HTTPS, displays a valid and clickable 'eNamad' symbol in the footer, and lists a physical address and phone number. The product is a permissible electronic item." } } Use code with caution. Json Example of a bad response: Generated json { "purchasable_status": { "is_purchasable": false, "reason": "The page is a blog post reviewing the product with links to other retailers; there is no direct 'buy' option or price." }, "security_status": { "is_secure": false, "reason": "The website does not have an 'eNamad' symbol, lacks an HTTPS connection, and the product sold is a dietary supplement, which is a prohibited item." } } Use code with caution. Json لطفاً لینک یا آدرس وب‌سایت مورد نظر برای بررسی را وارد کنید: https://www.ariadigitall.ir/product/اسپیکر-بلوتوثی-هارمن-کاردن-مدل-aura-studio-3/?utm_medium=PPC&utm_source=Torob

Pensamiento

Analyzing prompt for improvement

The user’s prompt involves analyzing a URL from Ariadigitall's product page, focusing on parameters like purchasable_status and security_status in a strict JSON format. They mention checking eNamad and other elements. The last part, "Json لطفاً لینک یا آدرس وب‌سایت مورد نظر برای بررسی را وارد کنید: <URL>,” might be causing confusion. It seems like an instruction to provide the URL, but it isn’t clear. I’ll need to clarify the input structure and modify the prompt to ensure it works smoothly.

Improving the prompt

It looks like the prompt fails because Gemini may not have browsing capability, or it can't properly fetch the URL. The complex instructions and mix of languages could also be part of the issue. Additionally, strict JSON requirements might also trip things up when the model outputs extra explanation text instead of clean data.

To fix this, the better approach could be to remove the need for the model to fetch a URL directly. Instead, I can suggest simulating the analysis or instructing the user to provide the page content separately.

Thought for 16 seconds

Respuesta

1. What the original prompt is trying to do

You want Gemini 2.5 to act as a Divar.ir compliance bot that:

  1. Visits a product‐detail URL.
  2. Decides whether the product can actually be bought on that page (“purchasable_status”).
  3. Decides whether the site is secure / policy-compliant for Iranian e-commerce (“security_status”).
  4. Returns only a strict JSON object with those two decision blocks.

2. Why the prompt often fails in Gemini 2.5 (Flash / Pro)

IssueWhy it causes failure
Requires live web-fetchingGemini 2.5 (Flash/Pro) has no built-in browser; asking it to “access and analyze” a URL will lead to hallucination or refusal.
Multiple example blocks + “Use code with caution” linesGemini sometimes echoes instructional text in its answer, breaking the “JSON-only” requirement.
Persian + English mixed meta-instructionsMakes it harder for the model to see where the actual output should start and what should be ignored.
Interactive question at the end<br>(“لطفاً لینک … وارد کنید”)Gemini may think it must ask the user for a link instead of analysing the provided one.
No fall-back path when HTML cannot be fetchedLeads either to silence or policy-violation refusals.

3. A cleaned-up, more reliable prompt

text
SYSTEM You are “Divar-Compliance-Bot”. Your job is to judge (a) whether a product page allows direct purchase and (b) whether the website meets Iranian e-commerce security requirements. ASSISTANT RULES 1. **Input fields** (always provided by the caller): - page_url : string (e.g. "https://example.com/product/123") - page_html : string (full raw HTML of the page, or "" if not supplied) 2. **Analyse the HTML only** – never attempt to fetch external content yourself. 3. **Purchasability check** True *only if* all three are found in the HTML: • An “Add to Cart” (افزودن به سبد خرید) or “Buy Now” (خرید) button • A price in ریال or تومان • A signal that the item is in stock (موجود) Otherwise return false. 4. **Security & policy check** Passes *only if* **all** of the following appear in the HTML: • Site uses HTTPS (page_url starts with "https://") • A valid, clickable eNamad logo (نماد اعتماد) (anchor <a> wrapping an <img> or <script>) • Visible phone number **and** physical address • Mentions of an Iranian payment gateway (شاپرک or بانک ملت/سامان/پاسارگاد) • Product is **not** in Divar’s prohibited list (VPN, weapons, alcohol, medicines, currency, etc.) If any item is missing, security_status → false. 5. **Output format** Return **exactly** the following JSON structure with no extra keys or text: ```json { "purchasable_status": { "is_purchasable": <true/false>, "reason": "<one short sentence>" }, "security_status": { "is_secure": <true/false>, "reason": "<one short sentence>" } }
  1. If page_html is empty
    Set both booleans to false and reasons to "No HTML provided".

  2. Never output anything except the JSON.

USER page_url = "https://www.ariadigitall.ir/product/اسپیکر-بلوتوثی-هارمن-کاردن-مدل-aura-studio-3/?utm_medium=PPC&utm_source=Torob" page_html = "<!-- full HTML will be inserted here by the caller -->"

text
--- #### How this rewrite fixes the problems * **No external fetch needed** – caller must pass HTML, so Gemini stays within its sandbox. * **Single clean instruction set** – avoids stray text that could break JSON. * **Clear fallback behaviour** – defined when HTML is missing. * **All criteria enumerated once** – reduces chance of Gemini inventing extra fields.

Compartir este Q&A