from agent import PromptToSignatureAgent, PromptToSignatureConfig agent = PromptToSignatureAgent(PromptToSignatureConfig()) PROMPT = """**INPUT FORMAT**: Customer product reviews in natural language text, ranging from 50-1000 words. May include informal language, slang, misspellings, emojis, and mixed sentiments. Reviews may be from various e-commerce platforms (Amazon, eBay, specialized retail sites). **TASK DESCRIPTION**: You are an advanced sentiment analysis and feature extraction system for e-commerce platforms. Your goal is to parse customer reviews and extract granular insights about both overall sentiment and feature-specific opinions to help businesses understand customer satisfaction at a detailed level. **EXTRACTION REQUIREMENTS**: - **Overall Sentiment**: Determine the general sentiment of the entire review using a 4-category classification (positive/negative/mixed/neutral). Mixed indicates both positive and negative sentiments present; neutral indicates factual statements without emotional valence. - **Product Features Mentioned**: Identify which of these standard e-commerce features are discussed: product quality, value for money, delivery/shipping experience, customer service interactions, packaging quality, product description accuracy, ease of use, durability, aesthetics/appearance, size/fit accuracy - **Feature-Specific Sentiment**: For each feature mentioned, assign a sentiment score (-2 very negative, -1 negative, 0 neutral, +1 positive, +2 very positive) - **Star Rating Prediction**: Based on the text sentiment and feature analysis, predict what star rating (1-5 stars) the customer likely gave, with confidence score (0-100%) - **Purchase Verification**: Detect phrases indicating verified purchase ("verified purchase", "bought this", "received this product", "purchased from") vs. uncertain authenticity - **Competitor Comparison**: Identify if the review compares the product to competitors, extract competitor names/products mentioned, and determine if comparison is favorable or unfavorable - **Specific Issues**: Extract concrete complaints (e.g., "broke after 2 weeks", "arrived damaged", "wrong color sent", "missing parts") - **Specific Praise**: Extract concrete positive mentions (e.g., "excellent battery life", "fast shipping", "exceeded expectations") - **Review Helpfulness Indicators**: Classify review as "likely helpful" or "not helpful" based on linguistic markers (specificity, length, balanced perspective, constructive criticism vs. pure emotion) **CLASSIFICATION REQUIREMENTS**: - **Review Quality Score**: Rate the review quality from 1-5 where: - 1 = Unhelpful (pure emotion, no details, spam-like) - 2 = Minimal info (very brief, vague) - 3 = Moderate (some useful details) - 4 = Good (specific, balanced, informative) - 5 = Excellent (detailed, comprehensive, fair assessment) **OUTPUT FORMAT**: Return the following schema: { "overall_sentiment": { "classification": "positive|negative|mixed|neutral", "confidence_score": "float (0-1)" }, "predicted_star_rating": { "stars": "integer (1-5)", "confidence": "integer (0-100)" }, "features_analyzed": [ { "feature_name": "string", "mentioned": "boolean", "sentiment_score": "integer (-2 to +2)", "supporting_quote": "string (relevant excerpt from review)" } ], "purchase_verification": { "appears_verified": "boolean", "indicators": ["array of strings showing evidence"] }, "competitor_comparison": { "present": "boolean", "competitors_mentioned": ["array of strings"], "comparison_favorability": "favorable|unfavorable|neutral" }, "specific_issues": [ { "issue": "string", "severity": "minor|moderate|major", "quote": "string" } ], "specific_praise": [ { "praise_point": "string", "quote": "string" } ], "review_helpfulness": { "classification": "likely_helpful|not_helpful", "quality_score": "integer (1-5)", "reasoning": "string" } } """ def main(): agent.push_to_hub("fadeleke/prompt-to-signature", with_code=True) #result = agent(PROMPT) #code = agent.generate_code(result) #print(code) if __name__ == "__main__": main()