I will give you a prompt for gemini model 2.5(flas...
생성일: 2025년 7월 12일
생성일: 2025년 7월 12일
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
You want Gemini 2.5 to act as a Divar.ir compliance bot that:
Issue | Why it causes failure |
---|---|
Requires live web-fetching | Gemini 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” lines | Gemini sometimes echoes instructional text in its answer, breaking the “JSON-only” requirement. |
Persian + English mixed meta-instructions | Makes 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 fetched | Leads either to silence or policy-violation refusals. |
textSYSTEM 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>" } }
If page_html is empty
Set both booleans to false and reasons to "No HTML provided"
.
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.