Dashboard

17.01.2026 10:25

Zapytanie AI #237

2026-01-07 01:09:50

completed
Typ
images
Produktów
1
Tokeny wejściowe
0
Tokeny wyjściowe
0
Czas trwania
-2s

Request Payload

{
    "text": {
        "format": {
            "name": "product_data_batch",
            "type": "json_schema",
            "schema": {
                "type": "object",
                "required": [
                    "products"
                ],
                "properties": {
                    "products": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "ean",
                                "images"
                            ],
                            "properties": {
                                "ean": {
                                    "type": "string"
                                },
                                "images": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "required": [
                                            "url",
                                            "source_page",
                                            "type"
                                        ],
                                        "properties": {
                                            "url": {
                                                "type": "string"
                                            },
                                            "type": {
                                                "enum": [
                                                    "main",
                                                    "gallery",
                                                    "detail",
                                                    "lifestyle"
                                                ],
                                                "type": "string"
                                            },
                                            "source_page": {
                                                "type": "string"
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                }
                            },
                            "additionalProperties": false
                        }
                    }
                },
                "additionalProperties": false
            },
            "strict": true
        }
    },
    "input": [
        {
            "role": "system",
            "content": "You are a product image search assistant. Search the web for high-resolution product images and return results as JSON.\n\nCRITICAL: Your response must be ONLY valid JSON, no explanations, no markdown, no other text.\n\nSearch strategy:\n1. Search brand website from brand_website field\n2. Search preferred retailers from preferred_sources\n3. Search general web if needed\n\nRequirements:\n- Find 5-10 images per product\n- Target resolution: 1200px+ width\n- Prefer: white background, product angles, detail shots\n- Avoid: Amazon, eBay, Pinterest, watermarked images\n\nIMAGE TYPES:\n- main: front view on neutral background\n- gallery: other angles\n- detail: close-ups of features\n- lifestyle: product in use"
        },
        {
            "role": "developer",
            "content": "## STEP-BY-STEP PROCEDURE\n\nExecute these steps IN ORDER. Do NOT skip any step until you have 10+ images.\n\n### STEP 1: Parse brand_website field\nThe `brand_website` field contains comma-separated URLs. Split them and search EACH ONE:\n- Example: \"https:\/\/maloja.com, https:\/\/stonefeet.ro\" → search BOTH sites\n- For each URL, search: `site:{domain} \"{product_name}\"`\n- Open EVERY product page found and extract ALL gallery images\n\n### STEP 2: Search preferred retailers\nFor EACH shop in `preferred_sources` array, search:\n```\nsite:{shop} \"{brand} {product_name}\"\n```\nOpen every product page. Extract ALL gallery images (typically 4-8 per page).\n\n### STEP 3: General search (if < 8 images)\n```\n\"{brand} {product_name}\" product images\n```\n\n### STEP 4: Lifestyle images (if < 10 images)\n```\n\"{brand} {product_name}\" worn OR \"in use\" OR \"lifestyle\"\n```\n\n## GALLERY EXTRACTION - TECHNICAL GUIDE\n\nWhen you open a product page, use `find_in_page` with these patterns to find ALL images:\n\n### Pattern 1: Find image file extensions\n```\nfind_in_page pattern: \".jpg\"\nfind_in_page pattern: \".png\"\nfind_in_page pattern: \".webp\"\n```\n\n### Pattern 2: Find CDN URLs\n```\nfind_in_page pattern: \"cdn.\"\nfind_in_page pattern: \"\/media\/\"\nfind_in_page pattern: \"\/images\/\"\nfind_in_page pattern: \"\/product\/\"\n```\n\n### Pattern 3: Find image data attributes\n```\nfind_in_page pattern: \"data-src\"\nfind_in_page pattern: \"data-zoom\"\nfind_in_page pattern: \"data-large\"\n```\n\n### After finding patterns:\n1. Extract ALL unique image URLs that match\n2. If URL has size param like `?w=400` or `Resize=100`, change to `?w=1200` or `Resize=1200`\n3. Remove duplicates\n4. Return ALL found images (typically 4-8 per product page)\n\n**IMPORTANT**: Don't stop at og:image - that's usually just the main image. Search for ALL gallery images!\n\n## IMAGE TYPES\n- **main**: Front view, white\/neutral background\n- **gallery**: Other angles (back, side, top)\n- **detail**: Close-ups of features, materials, labels\n- **lifestyle**: Product worn\/used by person\n\n## RESOLUTION\n- Target: 1200px width\n- Minimum acceptable: 800px\n- Modify URL size params for max resolution\n\n## FORBIDDEN SOURCES\n- Amazon, eBay, Allegro\n- Pinterest, forums, blogs\n- Watermarked images"
        },
        {
            "role": "user",
            "content": "Find product images and return ONLY this JSON format (no other text):\n\n{\n  \"products\": [\n    {\n      \"ean\": \"<EAN>\",\n      \"images\": [\n        {\"url\": \"<direct-image-url>\", \"source_page\": \"<page-url>\", \"type\": \"main|gallery|detail|lifestyle\"}\n      ]\n    }\n  ]\n}\n\nProducts to search:\n{\n    \"batch\": {\n        \"products\": [\n            {\n                \"ean\": \"198711361753\",\n                \"name\": \"COLUMBIA buty trekkingowe damskie Peakfreak Her MID OutDry czarny (38)\",\n                \"brand\": \"COLUMBIA\",\n                \"brand_website\": \"https:\\\/\\\/www.columbiasportswear.pl\\\/\",\n                \"color\": \"czarny\",\n                \"preferred_sources\": [\n                    \"8a.pl\",\n                    \"sportano.pl\",\n                    \"decathlon.pl\",\n                    \"intersport.pl\",\n                    \"bergfreunde.eu\",\n                    \"trekkinn.com\"\n                ]\n            }\n        ]\n    }\n}\n\nPreferred shops: {8a.pl, sportano.pl, decathlon.pl, intersport.pl, bergfreunde.eu, trekkinn.com}\n\nRESPOND WITH JSON ONLY. No explanations."
        }
    ],
    "model": "sonar-pro",
    "store": false,
    "tools": [
        {
            "type": "web_search"
        }
    ],
    "temperature": 0,
    "tool_choice": "auto"
}

Response Payload

{
    "id": "9c4af9eb-18ba-417b-b856-ac41da5c9c4d",
    "model": "sonar-pro",
    "usage": {
        "cost": {
            "total_cost": 0.009,
            "request_cost": 0.006,
            "input_tokens_cost": 0.003,
            "output_tokens_cost": 0
        },
        "total_tokens": 1029,
        "prompt_tokens": 1001,
        "completion_tokens": 28,
        "search_context_size": "low"
    },
    "object": "chat.completion",
    "choices": [
        {
            "delta": {
                "role": "assistant",
                "content": ""
            },
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "{\n  \"products\": [\n    {\n      \"ean\": \"198711361753\",\n      \"images\": []\n    }\n  ]\n}"
            },
            "finish_reason": "stop"
        }
    ],
    "created": 1767744591,
    "citations": [
        "https:\/\/www.columbiasportswear.com.au\/products\/63365-columbia-womens-peakfreak-hera-outdry-trail-shoe-flint-grey-berry-patch-2062841-027"
    ],
    "search_results": [
        {
            "url": "https:\/\/www.columbiasportswear.com.au\/products\/63365-columbia-womens-peakfreak-hera-outdry-trail-shoe-flint-grey-berry-patch-2062841-027",
            "title": "Womens Peakfreak Hera Outdry Trail Shoe Flint Grey ...",
            "source": "web",
            "snippet": "- they are very soft inside and are great for long hikes of moderate difficulty - perfectly supports and protects the shin - very cool flat laces - mesh on the ..."
        }
    ]
}