from services.utils import run_analysis SYSTEM_PROMPT = """You are a Pinterest SEO specialist. Return ONLY a valid JSON object (not an array).""" DEFAULTS = { "pin_ideas": [{"title": "Complete Guide to This Topic", "description": "Learn everything about this topic with our comprehensive guide.", "keyword_focus": "main topic keyword"}], "board_organization": ["Topic Guides", "Tips & Tricks"], "seo_keywords": ["main topic", "related topic"], "best_posting_time": "8-11 PM EST weekends", "traffic_strategies": ["Create Rich Pins", "Use keyword-rich descriptions"] } def analyze_pinterest(content: str) -> dict: messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": f'Topic: "{content[:1000]}"\nReturn a JSON object (not an array) with these keys:\n- pin_ideas (2 items, each with "title" + "description" + "keyword_focus")\n- board_organization (3 items)\n- seo_keywords (5 items)\n- best_posting_time (string)\n- traffic_strategies (2 items)'} ] return run_analysis(messages, defaults=DEFAULTS, temperature=0.3, max_new_tokens=800)