From 940a4ad1fa05bc86a3be626059c56ee18be6ee13 Mon Sep 17 00:00:00 2001 From: ajaysi Date: Mon, 7 Apr 2025 15:13:33 +0530 Subject: [PATCH] ALwrity AI Copywriter app, aidppc, oath, quest, star, fab, pas, app, acca, 4c, 4r, emotional --- lib/ai_writers/ai_copywriter/4c_copywriter.py | 226 +++++++++++++++++ lib/ai_writers/ai_copywriter/4r_copywriter.py | 214 ++++++++++++++++ lib/ai_writers/ai_copywriter/README | 97 +++++++ .../ai_copywriter/acca_copywriter.py | 182 ++++++++++++++ .../ai_copywriter/ai_emotional_copywriter.py | 168 +++++++++++++ .../ai_copywriter/aida_copywriter.py | 211 ++++++++++++++++ .../ai_copywriter/aidppc_copywriter.py | 191 ++++++++++++++ .../ai_copywriter/app_copywriter.py | 176 +++++++++++++ .../ai_copywriter/copywriter_dashboard.py | 236 ++++++++++++++++++ .../ai_copywriter/fab_copywriter.py | 212 ++++++++++++++++ .../ai_copywriter/oath_copywriter.py | 186 ++++++++++++++ .../ai_copywriter/pas_copywriter.py | 213 ++++++++++++++++ .../ai_copywriter/quest_copywriter.py | 191 ++++++++++++++ .../ai_copywriter/star_copywriter.py | 182 ++++++++++++++ .../text_generation/main_text_generation.py | 41 +-- lib/utils/content_generators.py | 7 +- 16 files changed, 2714 insertions(+), 19 deletions(-) create mode 100644 lib/ai_writers/ai_copywriter/4c_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/4r_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/README create mode 100644 lib/ai_writers/ai_copywriter/acca_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/ai_emotional_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/aida_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/aidppc_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/app_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/copywriter_dashboard.py create mode 100644 lib/ai_writers/ai_copywriter/fab_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/oath_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/pas_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/quest_copywriter.py create mode 100644 lib/ai_writers/ai_copywriter/star_copywriter.py diff --git a/lib/ai_writers/ai_copywriter/4c_copywriter.py b/lib/ai_writers/ai_copywriter/4c_copywriter.py new file mode 100644 index 00000000..0511d537 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/4c_copywriter.py @@ -0,0 +1,226 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 4C Copywriting Generator

+

Create compelling copy that follows the 4C (Clear, Concise, Credible, Compelling) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about 4C copywriting + with st.expander("📚 What is 4C Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the 4C Copywriting Framework + + The 4C framework is a powerful copywriting approach that ensures your message is effective and persuasive: + + - **Clear**: Your message is easy to understand, with no ambiguity or confusion + - **Concise**: Your copy is brief and to the point, without unnecessary words + - **Credible**: Your claims are backed by evidence, testimonials, or authority + - **Compelling**: Your message is interesting and persuasive, motivating action + + ### Why 4C Copywriting Works + + The 4C framework works because it: + + - Improves readability and comprehension + - Respects the reader's time and attention + - Builds trust and credibility + - Increases the likelihood of conversion + - Creates a professional, polished impression + - Works across all marketing channels and platforms + + ### When to Use 4C Copywriting + + The 4C framework is particularly effective for: + + - Email marketing campaigns + - Landing pages and sales pages + - Social media posts and ads + - Product descriptions + - Service offerings + - Any marketing content where clarity and persuasion are essential + """) + + # Main input form + with st.expander("✍️ Create Your 4C Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity AI Writer", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Content marketers", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + campaign_description = st.text_input('**📝 Campaign Description** (In 3-4 words)', + placeholder="e.g., AI writing assistant", + help="Describe your campaign briefly.") + + clear_message = st.text_area('**🔍 Clear Message**', + placeholder="e.g., Our AI writing assistant helps you create high-quality content in minutes", + help="What is the main message you want to convey? Make it easy to understand.") + + with col2: + brand_description = st.text_input('**📋 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing platform", + help="Describe what your company does briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., All-in-one AI copywriting platform", + help="What makes your product/service different from competitors?") + + concise_content = st.text_area('**📏 Concise Content**', + placeholder="e.g., Create content 10x faster with our AI assistant", + help="How can you express your message in the fewest words possible?") + + credible_elements = st.text_area('**✅ Credible Elements**', + placeholder="e.g., Trusted by 10,000+ businesses, 4.8/5 star rating, 30-day money-back guarantee", + help="What evidence, testimonials, or authority can you use to build credibility?") + + compelling_hook = st.text_area('**🎣 Compelling Hook**', + placeholder="e.g., Stop struggling with writer's block. Our AI assistant helps you create engaging content in minutes.", + help="What will grab attention and motivate action?") + + call_to_action = st.text_area('**🚀 Call to Action**', + placeholder="e.g., Start creating high-converting content today with our 14-day free trial...", + help="Prompt your audience to take action with a strong call to action.") + + landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)', + placeholder="e.g., https://alwrity.com", + help="Provide a URL to include in your call to action.") + + col1, col2 = st.columns([1, 1]) + with col1: + platform = st.selectbox( + '**📱 Content Platform**', + options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'], + help="Select the platform where your copy will be used." + ) + + with col2: + language = st.selectbox( + '**🌍 Language**', + options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'], + help="Select the language for your copy." + ) + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate 4C Copy**', type="primary"): + if not brand_name or not brand_description or not campaign_description or not clear_message or not concise_content or not credible_elements or not compelling_hook: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Campaign Description, Clear Message, Concise Content, Credible Elements, and Compelling Hook)!") + else: + with st.spinner("✨ Crafting compelling 4C copy..."): + four_cs_copy = generate_four_cs_copy( + brand_name, + brand_description, + campaign_description, + clear_message, + concise_content, + credible_elements, + compelling_hook, + target_audience, + unique_selling_point, + call_to_action, + landing_page_url, + platform, + language, + tone_style + ) + + if four_cs_copy: + st.markdown(""" +
+

🎯 Your 4C Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(four_cs_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your 4C Copy", expanded=False): + st.markdown(""" + ### How to Use Your 4C Copy Effectively + + 1. **Test for clarity**: Ask someone unfamiliar with your product to read your copy and explain what they understand + + 2. **Edit ruthlessly**: Review your copy to eliminate unnecessary words and phrases + + 3. **Add specific details**: Include concrete numbers, statistics, and examples to enhance credibility + + 4. **Create urgency**: Add time-sensitive elements to make your compelling hook even more effective + + 5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 6. **Measure results**: Track conversion metrics to see how your 4C copy performs + + 7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate 4C Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_four_cs_copy(brand_name, brand_description, campaign_description, clear_message, + concise_content, credible_elements, compelling_hook, target_audience, + unique_selling_point, call_to_action, landing_page_url, platform, + language, tone_style): + system_prompt = """You are an expert copywriter specializing in the 4C (Clear, Concise, Credible, Compelling) framework. + Your expertise is in creating effective, persuasive marketing copy that communicates clearly, builds credibility, and drives action. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {brand_description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + PLATFORM: {platform} + LANGUAGE: {language} + TONE & STYLE: {tone_style} + + Use the 4C framework with these elements: + - **Clear Message**: {clear_message} + - **Concise Content**: {concise_content} + - **Credible Elements**: {credible_elements} + - **Compelling Hook**: {compelling_hook} + - **Call to Action**: {call_to_action} + """ + + if landing_page_url: + prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action." + + prompt += """ + For each campaign: + 1. Start with a compelling hook that grabs attention + 2. Present your clear message in a concise way + 3. Support your claims with credible elements + 4. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/4r_copywriter.py b/lib/ai_writers/ai_copywriter/4r_copywriter.py new file mode 100644 index 00000000..252ce56f --- /dev/null +++ b/lib/ai_writers/ai_copywriter/4r_copywriter.py @@ -0,0 +1,214 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 4R Copywriting Generator

+

Create compelling copy that follows the 4R (Relevance, Resonance, Response, Results) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about 4R copywriting + with st.expander("📚 What is 4R Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the 4R Copywriting Framework + + The 4R framework is a powerful copywriting approach that ensures your message connects with your audience and drives action: + + - **Relevance**: Your message addresses the specific needs, interests, or pain points of your target audience + - **Resonance**: Your copy creates an emotional connection with the audience, making them feel understood + - **Response**: Your message prompts the audience to take a specific action + - **Results**: Your copy clearly communicates the positive outcomes or benefits the audience will experience + + ### Why 4R Copywriting Works + + The 4R framework works because it: + + - Ensures your message is targeted to the right audience + - Creates emotional connections that build trust and loyalty + - Drives specific actions that lead to conversions + - Focuses on the outcomes that matter most to your audience + - Creates a complete journey from awareness to action + - Works across all marketing channels and platforms + + ### When to Use 4R Copywriting + + The 4R framework is particularly effective for: + + - Email marketing campaigns + - Landing pages and sales pages + - Social media posts and ads + - Product descriptions + - Service offerings + - Any marketing content where audience connection and action are essential + """) + + # Main input form + with st.expander("✍️ Create Your 4R Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity AI Writer", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Content marketers", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + relevance = st.text_area('**🎯 Relevance**', + placeholder="e.g., Struggling with writer's block? Our AI assistant helps you create high-quality content in minutes", + help="How does your product/service address the specific needs or pain points of your target audience?") + + with col2: + brand_description = st.text_input('**📋 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing platform", + help="Describe what your company does briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., All-in-one AI copywriting platform", + help="What makes your product/service different from competitors?") + + resonance = st.text_area('**💖 Resonance**', + placeholder="e.g., We understand the frustration of staring at a blank page. Our AI assistant feels like having a professional writer by your side", + help="How can you create an emotional connection with your audience? What language or imagery will resonate with them?") + + response = st.text_area('**🚀 Response**', + placeholder="e.g., Start creating high-converting content today with our 14-day free trial", + help="What specific action do you want your audience to take?") + + results = st.text_area('**✨ Results**', + placeholder="e.g., Save 20+ hours per week on content creation, increase conversion rates by 35%, improve SEO rankings", + help="What positive outcomes or benefits will your audience experience?") + + landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)', + placeholder="e.g., https://alwrity.com", + help="Provide a URL to include in your call to action.") + + col1, col2 = st.columns([1, 1]) + with col1: + platform = st.selectbox( + '**📱 Content Platform**', + options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'], + help="Select the platform where your copy will be used." + ) + + with col2: + language = st.selectbox( + '**🌍 Language**', + options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'], + help="Select the language for your copy." + ) + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate 4R Copy**', type="primary"): + if not brand_name or not brand_description or not relevance or not resonance or not response or not results: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Relevance, Resonance, Response, and Results)!") + else: + with st.spinner("✨ Crafting compelling 4R copy..."): + four_r_copy = generate_four_r_copy( + brand_name, + brand_description, + relevance, + resonance, + response, + results, + target_audience, + unique_selling_point, + landing_page_url, + platform, + language, + tone_style + ) + + if four_r_copy: + st.markdown(""" +
+

🎯 Your 4R Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(four_r_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your 4R Copy", expanded=False): + st.markdown(""" + ### How to Use Your 4R Copy Effectively + + 1. **Test for relevance**: Ensure your copy speaks directly to your target audience's needs and interests + + 2. **Enhance emotional resonance**: Use language and imagery that creates a deeper connection with your audience + + 3. **Clarify the response**: Make sure your call to action is clear, specific, and compelling + + 4. **Quantify results**: Use specific numbers, statistics, and examples to make your results more tangible + + 5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 6. **Measure performance**: Track conversion metrics to see how your 4R copy performs + + 7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate 4R Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_four_r_copy(brand_name, brand_description, relevance, resonance, response, results, + target_audience, unique_selling_point, landing_page_url, platform, + language, tone_style): + system_prompt = """You are an expert copywriter specializing in the 4R (Relevance, Resonance, Response, Results) framework. + Your expertise is in creating compelling marketing copy that connects with audiences on a deep level and drives specific actions. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {brand_description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + PLATFORM: {platform} + LANGUAGE: {language} + TONE & STYLE: {tone_style} + + Use the 4R framework with these elements: + - **Relevance**: {relevance} + - **Resonance**: {resonance} + - **Response**: {response} + - **Results**: {results} + """ + + if landing_page_url: + prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action." + + prompt += """ + For each campaign: + 1. Start by establishing relevance to your target audience's needs or pain points + 2. Create emotional resonance by connecting with your audience's feelings and experiences + 3. Clearly communicate the specific action you want your audience to take + 4. End by highlighting the positive results or benefits they will experience + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/README b/lib/ai_writers/ai_copywriter/README new file mode 100644 index 00000000..b726744a --- /dev/null +++ b/lib/ai_writers/ai_copywriter/README @@ -0,0 +1,97 @@ +# Brainstorming for Copywriting Tools UI and Features (TBD) + +## Showing All Copywriting Tools in a Single UI + +1. **Unified Dashboard Approach** + - Create a central dashboard with cards/tiles for each copywriting formula + - Use visual icons and brief descriptions to distinguish each formula + - Implement a consistent color scheme and design language across all tools + +2. **Categorization System** + - Group formulas by purpose (e.g., "Emotional Appeal," "Problem-Solution," "Storytelling") + - Allow users to filter by category or search by keyword + - Include a "Featured" or "Popular" section for commonly used formulas + +3. **Interactive Selection Interface** + - Create a decision tree or guided selection process + - Ask users a few key questions to recommend the most appropriate formula + - Show a comparison view of multiple formulas side-by-side + +4. **Progressive Disclosure** + - Start with a simplified view showing just the formula names and basic descriptions + - Allow users to expand each formula for more details and to start using it + - Implement a "Recently Used" section for quick access to frequently used formulas + +## Presenting the Right Formula for User Needs + +1. **Guided Selection Wizard** + - Create a multi-step wizard that asks about the user's marketing goals + - Include questions about target audience, industry, content type, and desired outcome + - Provide recommendations based on user responses with explanations + +2. **Formula Comparison Tool** + - Create a comparison matrix showing strengths of each formula + - Include use cases and examples for each formula + - Allow users to see side-by-side comparisons of different formulas + +3. **Educational Content Integration** + - Add a "Learn More" section for each formula with detailed explanations + - Include case studies showing successful applications of each formula + - Provide templates and examples for common use cases + +4. **Contextual Recommendations** + - Analyze the user's input and automatically suggest the most appropriate formula + - Show a confidence score for each recommendation + - Allow users to easily switch between formulas if the recommendation isn't right + +## Using AI to Pre-fill Inputs Based on Brief Requirements + +1. **Smart Input Generation** + - Create an initial input field where users can describe their copywriting needs in natural language + - Use AI to analyze this input and extract key information (brand, audience, goals, etc.) + - Pre-fill the formula-specific fields with AI-generated content + - Allow users to edit and refine the pre-filled content + +2. **Contextual Understanding** + - Implement industry-specific templates and prompts + - Use AI to recognize industry terminology and adapt suggestions accordingly + - Provide multiple options for each field based on the user's brief description + +3. **Progressive Refinement** + - Start with AI-generated suggestions for all fields + - Allow users to focus on refining specific fields while keeping others + - Implement a "regenerate" option for individual fields if the AI suggestion isn't suitable + +4. **Learning from User Edits** + - Track which AI-generated suggestions users keep vs. modify + - Use this data to improve future suggestions + - Implement a feedback mechanism for users to rate the quality of AI suggestions + +## AI-Generated Images as a Feature + +1. **Complementary Visual Content** + - Generate images that match the tone and message of the copy + - Create multiple image options for different platforms (social media, email, website) + - Ensure images align with the copywriting formula being used + +2. **Integrated Workflow** + - Add an "Generate Matching Images" button after copy is created + - Allow users to specify image style, mood, and key elements + - Provide options to customize generated images further + +3. **Platform-Specific Optimization** + - Automatically size and format images for different platforms + - Generate variations optimized for different aspect ratios + - Include text overlay options that complement the copy + +4. **Brand Consistency** + - Allow users to upload brand assets (logos, colors, fonts) + - Generate images that maintain brand identity + - Create a visual style guide based on user preferences + +5. **Enhanced Engagement** + - A/B test different image options with the same copy + - Provide analytics on which image-copy combinations perform best + - Suggest image improvements based on performance data + +These enhancements would create a more comprehensive, user-friendly copywriting platform that guides users to the right formula, simplifies the input process, and delivers complete marketing assets ready for deployment. diff --git a/lib/ai_writers/ai_copywriter/acca_copywriter.py b/lib/ai_writers/ai_copywriter/acca_copywriter.py new file mode 100644 index 00000000..4eea9ea5 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/acca_copywriter.py @@ -0,0 +1,182 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen + +def input_section(): + st.markdown(""" +
+

🚀 ACCA Copywriting Generator

+

Create persuasive marketing copy using the proven ACCA (Awareness-Curiosity-Conviction-Action) formula.

+
+ """, unsafe_allow_html=True) + + # Educational content about ACCA copywriting + with st.expander("📚 What is ACCA Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the ACCA Copywriting Formula + + The ACCA formula is a powerful copywriting framework that guides your audience through a journey from problem recognition to action: + + - **Awareness**: Highlight the problem or pain point your audience faces + - **Curiosity**: Agitate the problem by emphasizing its negative impact + - **Conviction**: Present your solution and build confidence in it + - **Action**: Provide a clear, compelling call to action + + ### Why ACCA Copywriting Works + + The ACCA formula works because it: + + - Follows the natural decision-making process of your audience + - Creates a logical progression from problem to solution + - Builds emotional investment before asking for commitment + - Addresses objections before they arise + - Ends with a clear next step + + ### When to Use ACCA Copywriting + + The ACCA formula is particularly effective for: + + - Product launches + - Service promotions + - Problem-solving offers + - Educational content + - Sales pages + - Email marketing sequences + """) + + # Main input form + with st.expander("✍️ Create Your ACCA Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + awareness = st.text_input('❓ **Awareness (Problem)**', + placeholder="e.g., Struggling to manage finances", + help="What problem or pain point does your audience face?") + + with col2: + description = st.text_input('**📝 Brand Description** (In 5-6 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + curiosity = st.text_input('🔥 **Curiosity (Agitation)**', + placeholder="e.g., Leads to financial instability and stress", + help="Why is this problem serious for your audience? Highlight the negative impact.") + + conviction = st.text_input('💡 **Conviction (Solution)**', + placeholder="e.g., Provides easy-to-use budgeting tools with AI insights", + help="How does your product/service solve this problem? Explain the benefits.") + + call_to_action = st.text_input('🎯 **Action (Call to Action)**', + placeholder="e.g., Start your free trial today", + help="What specific action do you want your audience to take?") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate ACCA Copy**', type="primary"): + if not brand_name or not description or not awareness or not curiosity or not conviction: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Awareness, Curiosity, and Conviction)!") + else: + with st.spinner("✨ Crafting persuasive ACCA copy..."): + acca_copy = generate_acca_copy( + brand_name, + description, + awareness, + curiosity, + conviction, + target_audience, + unique_selling_point, + call_to_action, + tone_style + ) + + if acca_copy: + st.markdown(""" +
+

✨ Your ACCA Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(acca_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy - using a container instead of an expander + st.markdown(""" +
+

💡 Tips for Using Your ACCA Copy

+
+ """, unsafe_allow_html=True) + + st.markdown(""" + ### How to Use Your ACCA Copy Effectively + + 1. **Test different versions**: A/B test your copy to see which version resonates most with your audience + + 2. **Pair with visuals**: Combine your copy with images that reinforce each stage of the ACCA formula + + 3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.) + + 4. **Measure results**: Track conversion metrics to see how your ACCA copy performs + + 5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate ACCA Copy. Please try again!**") + + +def generate_acca_copy(brand_name, description, awareness, curiosity, conviction, target_audience, + unique_selling_point, call_to_action, tone_style): + system_prompt = """You are an expert copywriter specializing in the ACCA (Awareness-Curiosity-Conviction-Action) formula. + Your expertise is in creating compelling, persuasive marketing copy that guides audiences through a journey from problem + recognition to taking action. Your copy is authentic, specific to the brand, and focused on the target audience's needs.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the ACCA formula with these elements: + - **Awareness**: {awareness} + - **Curiosity**: {curiosity} + - **Conviction**: {conviction} + - **Action**: {call_to_action} + + For each campaign: + 1. Create a compelling headline that captures attention + 2. Write 2-3 paragraphs that follow the ACCA formula + 3. End with a strong call to action + 4. Explain how each element of the ACCA formula is used in the copy + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/ai_emotional_copywriter.py b/lib/ai_writers/ai_copywriter/ai_emotional_copywriter.py new file mode 100644 index 00000000..3249872c --- /dev/null +++ b/lib/ai_writers/ai_copywriter/ai_emotional_copywriter.py @@ -0,0 +1,168 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen + +def input_section(): + st.markdown(""" +
+

🎭 Emotional Copywriting Generator

+

Create compelling copy that resonates with your audience's emotions and drives action.

+
+ """, unsafe_allow_html=True) + + # Educational content about emotional copywriting + with st.expander("📚 What is Emotional Copywriting?", expanded=False): + st.markdown(""" + ### Understanding Emotional Copywriting + + Emotional copywriting is a powerful marketing technique that connects with your audience on a deeper level by: + + - **Triggering specific emotions** (joy, fear, urgency, trust, etc.) + - **Creating personal connections** with your audience + - **Addressing pain points** and offering solutions + - **Building trust and credibility** + - **Creating a sense of belonging** or exclusivity + + ### Why Emotional Copywriting Works + + Research shows that people make purchasing decisions based on emotions first, then justify with logic. By tapping into the right emotions, you can: + + - Increase engagement and response rates + - Build stronger brand loyalty + - Drive more conversions + - Create memorable brand experiences + + ### Common Emotional Triggers + + - **Fear of Missing Out (FOMO)**: Limited time offers, exclusive access + - **Trust**: Testimonials, guarantees, social proof + - **Joy/Happiness**: Benefits, positive outcomes, aspirational messaging + - **Urgency**: Time-sensitive offers, countdown timers + - **Belonging**: Community, exclusivity, shared values + """) + + # Main input form + with st.expander("✍️ Create Your Emotional Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**Brand/Company Name**', + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**Target Audience**', + help="Who is your ideal customer? (e.g., 'busy moms', 'tech-savvy millennials')") + + emotional_trigger = st.selectbox( + '**Primary Emotional Trigger**', + options=['Trust', 'Fear of Missing Out', 'Joy/Happiness', 'Urgency', 'Belonging', 'Exclusivity'], + help="Select the primary emotion you want to evoke in your audience." + ) + + with col2: + description = st.text_input('**Brand Description** (In 5-6 words)', + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**Unique Selling Point**', + help="What makes your product/service different from competitors?") + + call_to_action = st.text_input('**Desired Call to Action**', + help="What action do you want your audience to take? (e.g., 'Sign up now', 'Buy today')") + + trust_elements = st.text_area('**Trust Elements**', + help="Build trust and credibility by showcasing testimonials, guarantees, or endorsements.", + placeholder="Testimonials from satisfied customers...\nOur guarantee that...\nIndustry certifications...") + + tone_style = st.selectbox( + '**Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**Generate Emotional Copy**', type="primary"): + if not brand_name or not description or not trust_elements: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, and Trust Elements)!") + else: + with st.spinner("✨ Crafting emotionally compelling copy..."): + emotional_copy = generate_emotional_copy( + brand_name, + description, + trust_elements, + target_audience, + emotional_trigger, + unique_selling_point, + call_to_action, + tone_style + ) + + if emotional_copy: + st.markdown(""" +
+

🎯 Your Emotional Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(emotional_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy - using a container instead of an expander + st.markdown(""" +
+

💡 Tips for Using Your Emotional Copy

+
+ """, unsafe_allow_html=True) + + st.markdown(""" + ### How to Use Your Emotional Copy Effectively + + 1. **Test different versions**: A/B test your copy to see which emotional triggers resonate most with your audience + + 2. **Pair with visuals**: Combine your copy with images that reinforce the emotional message + + 3. **Consider the context**: Adapt the copy based on where it will appear (social media, email, website, etc.) + + 4. **Measure results**: Track engagement metrics to see how your emotional copy performs + + 5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate Emotional Copy. Please try again!**") + + +def generate_emotional_copy(brand_name, description, trust_elements, target_audience, emotional_trigger, + unique_selling_point, call_to_action, tone_style): + system_prompt = """You are an expert emotional copywriter with years of experience in creating compelling marketing copy + that resonates with audiences on a deep emotional level. Your specialty is crafting copy that triggers specific emotions + and drives action while maintaining authenticity and credibility.""" + + prompt = f"""Create 3 different emotional marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + PRIMARY EMOTIONAL TRIGGER: {emotional_trigger} + UNIQUE SELLING POINT: {unique_selling_point} + DESIRED CALL TO ACTION: {call_to_action} + TONE & STYLE: {tone_style} + TRUST ELEMENTS: {trust_elements} + + For each campaign: + 1. Create a compelling headline that captures attention + 2. Write 2-3 paragraphs of body copy that builds emotional connection + 3. End with a strong call to action + 4. Explain which emotional triggers you used and why they're effective for this audience + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/aida_copywriter.py b/lib/ai_writers/ai_copywriter/aida_copywriter.py new file mode 100644 index 00000000..80ca3cfd --- /dev/null +++ b/lib/ai_writers/ai_copywriter/aida_copywriter.py @@ -0,0 +1,211 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 AIDA Copywriting Generator

+

Create compelling copy that follows the AIDA (Attention-Interest-Desire-Action) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about AIDA copywriting + with st.expander("📚 What is AIDA Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the AIDA Copywriting Framework + + AIDA is an acronym for Attention-Interest-Desire-Action. It's a classic copywriting framework that guides your audience through a complete journey: + + - **Attention**: Capturing the audience's attention with a compelling headline or hook + - **Interest**: Generating interest by highlighting benefits or addressing pain points + - **Desire**: Creating desire by showcasing how the product/service solves problems or fulfills needs + - **Action**: Prompting the audience to take a specific action with a strong call to action + + ### Why AIDA Copywriting Works + + The AIDA framework works because it: + + - Follows the natural decision-making process of consumers + - Addresses all key elements needed for conversion + - Creates a complete journey from awareness to action + - Balances emotional and rational appeals + - Focuses on the customer's journey rather than just product features + + ### When to Use AIDA Copywriting + + The AIDA framework is particularly effective for: + + - Landing pages and sales pages + - Email marketing campaigns + - Product descriptions + - Direct response advertising + - Content that needs to drive specific actions + - Marketing materials that need to address objections + """) + + # Main input form + with st.expander("✍️ Create Your AIDA Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + attention = st.text_area('**🔔 Attention-Grabbing Hook**', + placeholder="e.g., Tired of spending hours writing content that doesn't convert?", + help="Create a compelling headline or hook that captures attention.") + + interest = st.text_area('**💡 Generate Interest**', + placeholder="e.g., Imagine creating high-quality content in minutes instead of hours...", + help="Highlight benefits or address pain points to generate interest.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 5-6 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + desire = st.text_area('**❤️ Create Desire**', + placeholder="e.g., Our AI analyzes top-performing content to ensure your copy resonates with your target audience...", + help="Showcase how your product/service solves problems or fulfills needs.") + + action = st.text_area('**🚀 Call to Action**', + placeholder="e.g., Start creating converting content today with our 14-day free trial...", + help="Prompt your audience to take action with a strong call to action.") + + landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)', + placeholder="e.g., https://alwrity.com", + help="Provide a URL to include in your call to action.") + + col1, col2 = st.columns([1, 1]) + with col1: + platform = st.selectbox( + '**📱 Content Platform**', + options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'], + help="Select the platform where your copy will be used." + ) + + with col2: + language = st.selectbox( + '**🌍 Language**', + options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'], + help="Select the language for your copy." + ) + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate AIDA Copy**', type="primary"): + if not brand_name or not description or not attention or not interest or not desire or not action: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all AIDA elements)!") + else: + with st.spinner("✨ Crafting compelling AIDA copy..."): + aida_copy = generate_aida_copy( + brand_name, + description, + attention, + interest, + desire, + action, + target_audience, + unique_selling_point, + landing_page_url, + platform, + language, + tone_style + ) + + if aida_copy: + st.markdown(""" +
+

🎯 Your AIDA Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(aida_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your AIDA Copy", expanded=False): + st.markdown(""" + ### How to Use Your AIDA Copy Effectively + + 1. **Follow the sequence**: The AIDA framework creates a natural progression - make sure your copy maintains this flow + + 2. **Test different hooks**: A/B test different attention-grabbing headlines to see which resonates most with your audience + + 3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the AIDA journey + + 4. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 5. **Measure results**: Track conversion metrics to see how your AIDA copy performs + + 6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate AIDA Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_aida_copy(brand_name, description, attention, interest, desire, action, + target_audience, unique_selling_point, landing_page_url, + platform, language, tone_style): + system_prompt = """You are an expert copywriter specializing in the AIDA (Attention-Interest-Desire-Action) framework. + Your expertise is in creating compelling, conversion-focused marketing copy that guides readers through a complete journey from awareness to action. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + PLATFORM: {platform} + LANGUAGE: {language} + TONE & STYLE: {tone_style} + + Use the AIDA framework with these elements: + - **Attention**: {attention} + - **Interest**: {interest} + - **Desire**: {desire} + - **Action**: {action} + """ + + if landing_page_url: + prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action." + + prompt += """ + For each campaign: + 1. Start with the attention-grabbing hook to capture the audience's attention + 2. Generate interest by highlighting benefits or addressing pain points + 3. Create desire by showcasing how the product/service solves problems or fulfills needs + 4. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/aidppc_copywriter.py b/lib/ai_writers/ai_copywriter/aidppc_copywriter.py new file mode 100644 index 00000000..5b1ca375 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/aidppc_copywriter.py @@ -0,0 +1,191 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 AIDPPC Copywriting Generator

+

Create compelling copy that follows the AIDPPC (Attention-Interest-Description-Persuasion-Proof-Close) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about AIDPPC copywriting + with st.expander("📚 What is AIDPPC Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the AIDPPC Copywriting Framework + + AIDPPC is an acronym for Attention-Interest-Description-Persuasion-Proof-Close. It's a comprehensive copywriting framework that guides your audience through a complete journey: + + - **Attention**: Capturing the audience's attention with a compelling headline or hook + - **Interest**: Generating interest by highlighting benefits or addressing pain points + - **Description**: Describing your product or service in detail + - **Persuasion**: Presenting compelling arguments or incentives to persuade + - **Proof**: Providing social proof, testimonials, or guarantees to build credibility + - **Close**: Prompting the audience to take action with a strong call to action + + ### Why AIDPPC Copywriting Works + + The AIDPPC framework works because it: + + - Follows the natural decision-making process of consumers + - Addresses all key elements needed for conversion + - Builds credibility through multiple stages + - Creates a complete journey from awareness to action + - Balances emotional and rational appeals + + ### When to Use AIDPPC Copywriting + + The AIDPPC framework is particularly effective for: + + - Landing pages and sales pages + - Email marketing campaigns + - Product descriptions + - Direct response advertising + - Content that needs to drive specific actions + - Marketing materials that need to address objections + """) + + # Main input form + with st.expander("✍️ Create Your AIDPPC Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + attention = st.text_area('**🔔 Attention-Grabbing Hook**', + placeholder="e.g., Tired of spending hours writing content that doesn't convert?", + help="Create a compelling headline or hook that captures attention.") + + interest = st.text_area('**💡 Generate Interest**', + placeholder="e.g., Imagine creating high-quality content in minutes instead of hours...", + help="Highlight benefits or address pain points to generate interest.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + persuasion = st.text_area('**💪 Persuasive Arguments**', + placeholder="e.g., Our AI analyzes top-performing content to ensure your copy resonates with your target audience...", + help="Present compelling arguments or incentives to persuade your audience.") + + proof = st.text_area('**✅ Social Proof**', + placeholder="e.g., Join 10,000+ satisfied customers who have transformed their content strategy...", + help="Provide testimonials, statistics, or guarantees to build credibility.") + + close = st.text_area('**🚀 Call to Action**', + placeholder="e.g., Start creating converting content today with our 14-day free trial...", + help="Prompt your audience to take action with a strong call to action.") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate AIDPPC Copy**', type="primary"): + if not brand_name or not description or not attention or not interest or not persuasion or not proof or not close: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all AIDPPC elements)!") + else: + with st.spinner("✨ Crafting compelling AIDPPC copy..."): + aidppc_copy = generate_aidppc_copy( + brand_name, + description, + attention, + interest, + persuasion, + proof, + close, + target_audience, + unique_selling_point, + tone_style + ) + + if aidppc_copy: + st.markdown(""" +
+

🎯 Your AIDPPC Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(aidppc_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your AIDPPC Copy", expanded=False): + st.markdown(""" + ### How to Use Your AIDPPC Copy Effectively + + 1. **Follow the sequence**: The AIDPPC framework creates a natural progression - make sure your copy maintains this flow + + 2. **Test different hooks**: A/B test different attention-grabbing headlines to see which resonates most with your audience + + 3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the AIDPPC journey + + 4. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 5. **Measure results**: Track conversion metrics to see how your AIDPPC copy performs + + 6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate AIDPPC Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_aidppc_copy(brand_name, description, attention, interest, persuasion, proof, close, + target_audience, unique_selling_point, tone_style): + system_prompt = """You are an expert copywriter specializing in the AIDPPC (Attention-Interest-Description-Persuasion-Proof-Close) framework. + Your expertise is in creating compelling, conversion-focused marketing copy that guides readers through a complete journey from awareness to action. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the AIDPPC framework with these elements: + - **Attention**: {attention} + - **Interest**: {interest} + - **Persuasion**: {persuasion} + - **Proof**: {proof} + - **Close**: {close} + + For each campaign: + 1. Start with the attention-grabbing hook to capture the audience's attention + 2. Generate interest by highlighting benefits or addressing pain points + 3. Describe your product or service in detail + 4. Present persuasive arguments or incentives + 5. Provide social proof, testimonials, or guarantees + 6. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/app_copywriter.py b/lib/ai_writers/ai_copywriter/app_copywriter.py new file mode 100644 index 00000000..8bcfe6d7 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/app_copywriter.py @@ -0,0 +1,176 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen + +def input_section(): + st.markdown(""" +
+

🔍 APP Copywriting Generator

+

Create compelling marketing copy using the proven APP (Agree-Promise-Preview) formula.

+
+ """, unsafe_allow_html=True) + + # Educational content about APP copywriting + with st.expander("📚 What is APP Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the APP Copywriting Formula + + The APP formula is a powerful copywriting framework that creates a natural connection with your audience: + + - **Agree**: Acknowledge a shared problem or pain point your audience faces + - **Promise**: Make a compelling promise or offer a solution to that problem + - **Preview**: Provide a preview of how your solution will deliver on that promise + + ### Why APP Copywriting Works + + The APP formula works because it: + + - Creates immediate rapport by showing you understand your audience's challenges + - Builds trust by acknowledging problems before selling solutions + - Reduces resistance by connecting on a human level first + - Demonstrates empathy and understanding + - Follows a natural conversation flow that feels authentic + + ### When to Use APP Copywriting + + The APP formula is particularly effective for: + + - Building trust with new audiences + - Introducing new products or services + - Addressing common objections + - Creating relatable content + - Establishing your brand as a solution provider + - Email marketing sequences + """) + + # Main input form + with st.expander("✍️ Create Your APP Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + agree = st.text_area('**🤝 Agree (Shared Problem)**', + placeholder="We all face..., Like you, I've..., Safety, Unprofessionalism..", + help="Connect with the audience by acknowledging a shared problem or pain point they face.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + promise = st.text_area('**✨ Promise (Solution)**', + placeholder="We guarantee..., Our solution ensures..., You'll never have to worry about...", + help="Make a compelling promise or offer a solution to the problem.") + + preview = st.text_area('**🔮 Preview (Proof)**', + placeholder="Here's how..., Our customers have experienced..., You'll see results like...", + help="Provide a preview of how your solution will deliver on the promise.") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate APP Copy**', type="primary"): + if not brand_name or not description or not agree or not promise or not preview: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Agree, Promise, and Preview)!") + else: + with st.spinner("✨ Crafting compelling APP copy..."): + app_copy = generate_app_copy( + brand_name, + description, + agree, + target_audience, + unique_selling_point, + promise, + preview, + tone_style + ) + + if app_copy: + st.markdown(""" +
+

✨ Your APP Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(app_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy - using a container instead of an expander + st.markdown(""" +
+

💡 Tips for Using Your APP Copy

+
+ """, unsafe_allow_html=True) + + st.markdown(""" + ### How to Use Your APP Copy Effectively + + 1. **Test different versions**: A/B test your copy to see which version resonates most with your audience + + 2. **Pair with visuals**: Combine your copy with images that reinforce each stage of the APP formula + + 3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.) + + 4. **Measure results**: Track engagement metrics to see how your APP copy performs + + 5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate APP Copy. Please try again!**") + + +def generate_app_copy(brand_name, description, agree, target_audience, unique_selling_point, + promise, preview, tone_style): + system_prompt = """You are an expert copywriter specializing in the APP (Agree-Promise-Preview) formula. + Your expertise is in creating compelling, persuasive marketing copy that builds rapport with audiences by + acknowledging their problems, making promises, and providing previews of solutions. Your copy is authentic, + specific to the brand, and focused on the target audience's needs.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the APP formula with these elements: + - **Agree**: {agree} + - **Promise**: {promise} + - **Preview**: {preview} + + For each campaign: + 1. Create a compelling headline that captures attention + 2. Write 2-3 paragraphs that follow the APP formula + 3. End with a strong call to action + 4. Explain how each element of the APP formula is used in the copy + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/copywriter_dashboard.py b/lib/ai_writers/ai_copywriter/copywriter_dashboard.py new file mode 100644 index 00000000..38058f44 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/copywriter_dashboard.py @@ -0,0 +1,236 @@ +import streamlit as st +import importlib +import sys +import os +from pathlib import Path + +# Add the parent directory to the path to allow importing from lib +current_dir = Path(__file__).parent +root_dir = current_dir.parent.parent.parent +sys.path.append(str(root_dir)) + +# Dictionary to store the input section functions +input_sections = {} + +# List of copywriter modules to import +copywriter_modules = [ + "ai_emotional_copywriter", + "acca_copywriter", + "app_copywriter", + "star_copywriter", + "oath_copywriter", + "quest_copywriter", + "aidppc_copywriter", + "aida_copywriter", + "pas_copywriter", + "fab_copywriter", + "four_c_copywriter", + "four_r_copywriter" +] + +# Dynamically import all copywriter modules +for module_name in copywriter_modules: + try: + module_path = f"lib.ai_writers.ai_copywriter.{module_name}" + module = importlib.import_module(module_path) + if hasattr(module, "input_section"): + input_sections[module_name] = module.input_section + except Exception as e: + st.write(f"Debug: Error importing {module_name}: {str(e)}") + +def copywriter_dashboard(): + """ + Main function to display the copywriting dashboard. + This function can be called from content_generator.py when the user selects "AI Copywriter". + """ + + # Define the copywriting formulas with their details + copywriting_formulas = [ + { + "name": "Emotional Copywriter", + "icon": "🎭", + "description": "Create copy that resonates with your audience's emotions and drives action.", + "color": "#FF6B6B", + "module": "ai_emotional_copywriter", + "function": input_sections.get("ai_emotional_copywriter") + }, + { + "name": "ACCA Copywriter", + "icon": "🎯", + "description": "Use the ACCA (Attention, Context, Content, Action) framework to create compelling copy.", + "color": "#4ECDC4", + "module": "acca_copywriter", + "function": input_sections.get("acca_copywriter") + }, + { + "name": "APP Copywriter", + "icon": "🤝", + "description": "Implement the APP (Agree, Promise, Preview) formula to create persuasive copy.", + "color": "#45B7D1", + "module": "app_copywriter", + "function": input_sections.get("app_copywriter") + }, + { + "name": "STAR Copywriter", + "icon": "⭐", + "description": "Use the STAR (Situation, Task, Action, Result) framework to tell compelling stories.", + "color": "#FFD166", + "module": "star_copywriter", + "function": input_sections.get("star_copywriter") + }, + { + "name": "OATH Copywriter", + "icon": "📜", + "description": "Apply the OATH (Oblivious, Apathetic, Thinking, Hurting) framework to target specific audience mindsets.", + "color": "#06D6A0", + "module": "oath_copywriter", + "function": input_sections.get("oath_copywriter") + }, + { + "name": "QUEST Copywriter", + "icon": "🔍", + "description": "Use the QUEST (Question, Unpack, Emphasize, Solution, Transform) framework for narrative-driven copy.", + "color": "#118AB2", + "module": "quest_copywriter", + "function": input_sections.get("quest_copywriter") + }, + { + "name": "AIDPPC Copywriter", + "icon": "💰", + "description": "Implement the AIDPPC (Attention, Interest, Desire, Proof, Persuasion, Call to Action) framework for PPC ads.", + "color": "#073B4C", + "module": "aidppc_copywriter", + "function": input_sections.get("aidppc_copywriter") + }, + { + "name": "AIDA Copywriter", + "icon": "🎬", + "description": "Use the AIDA (Attention, Interest, Desire, Action) framework to guide customers through the sales funnel.", + "color": "#EF476F", + "module": "aida_copywriter", + "function": input_sections.get("aida_copywriter") + }, + { + "name": "PAS Copywriter", + "icon": "🔧", + "description": "Apply the PAS (Problem, Agitate, Solution) formula to address pain points and offer solutions.", + "color": "#7209B7", + "module": "pas_copywriter", + "function": input_sections.get("pas_copywriter") + }, + { + "name": "FAB Copywriter", + "icon": "💎", + "description": "Use the FAB (Features, Advantages, Benefits) framework to highlight product value.", + "color": "#3A0CA3", + "module": "fab_copywriter", + "function": input_sections.get("fab_copywriter") + }, + { + "name": "4C Copywriter", + "icon": "📝", + "description": "Implement the 4C (Clear, Concise, Credible, Compelling) framework for effective messaging.", + "color": "#4361EE", + "module": "four_c_copywriter", + "function": input_sections.get("four_c_copywriter") + }, + { + "name": "4R Copywriter", + "icon": "🔄", + "description": "Use the 4R (Relevance, Resonance, Response, Results) framework to connect with your audience.", + "color": "#F72585", + "module": "four_r_copywriter", + "function": input_sections.get("four_r_copywriter") + } + ] + + # Create a container for the dashboard + dashboard_container = st.container() + + # Create a container for the formula input section + formula_container = st.container() + + # Initialize session state for selected formula if it doesn't exist + if "selected_formula" not in st.session_state: + st.session_state.selected_formula = None + + # If a formula is selected, show its input section + if st.session_state.selected_formula is not None: + with formula_container: + # Display the selected formula's input section + st.markdown("---") + st.markdown(f"# {st.session_state.selected_formula['icon']} {st.session_state.selected_formula['name']}") + + # Add a back button + if st.button("← Back to Dashboard", key="back_to_dashboard"): + # Clear the selected formula from session state + st.session_state.selected_formula = None + st.rerun() + + # Call the input section function for the selected formula + if st.session_state.selected_formula["function"]: + st.session_state.selected_formula["function"]() + else: + st.error(f"The {st.session_state.selected_formula['name']} module is not available.") + else: + with dashboard_container: + # Display the dashboard + # Header + st.markdown(""" +
+

✍️ AI Copywriting Tools

+

Choose the perfect copywriting formula for your marketing needs

+
+ """, unsafe_allow_html=True) + + # Introduction + st.markdown(""" + ## Welcome to the AI Copywriting Suite + + This dashboard provides access to a variety of copywriting formulas, each designed for specific marketing needs. + Select a formula below to get started with creating compelling copy for your brand. + + ### How to Use This Dashboard + + 1. Browse the available copywriting formulas below + 2. Click on a formula card to access its specific tool + 3. Fill in the required information + 4. Generate high-quality copy tailored to your needs + """) + + # Create a 3-column layout for the formula cards + col1, col2, col3 = st.columns(3) + + # Display the formula cards + for i, formula in enumerate(copywriting_formulas): + # Skip formulas that don't have a function + if formula["function"] is None: + continue + + # Determine which column to use + col = col1 if i % 3 == 0 else col2 if i % 3 == 1 else col3 + + with col: + # Create a card for each formula + st.markdown(f""" +
+

{formula["icon"]} {formula["name"]}

+

{formula["description"]}

+
+ """, unsafe_allow_html=True) + + # Add a button to access the formula + if st.button(f"Use {formula['name']}", key=f"btn_{i}"): + # Store the selected formula in session state + st.session_state.selected_formula = formula + st.rerun() + +# For standalone execution +if __name__ == "__main__": + st.set_page_config( + page_title="AI Copywriting Tools", + page_icon="✍️", + layout="wide", + initial_sidebar_state="expanded" + ) + copywriter_dashboard() \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/fab_copywriter.py b/lib/ai_writers/ai_copywriter/fab_copywriter.py new file mode 100644 index 00000000..6f6dad8b --- /dev/null +++ b/lib/ai_writers/ai_copywriter/fab_copywriter.py @@ -0,0 +1,212 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 FAB Copywriting Generator

+

Create compelling copy that follows the FAB (Features-Advantages-Benefits) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about FAB copywriting + with st.expander("📚 What is FAB Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the FAB Copywriting Framework + + FAB is an acronym for Features-Advantages-Benefits. It's a powerful copywriting framework that focuses on translating product features into customer benefits: + + - **Features**: The specific characteristics, attributes, or capabilities of your product or service + - **Advantages**: How these features compare to or outperform competitors + - **Benefits**: The positive outcomes or results that customers will experience when using your product or service + + ### Why FAB Copywriting Works + + The FAB framework works because it: + + - Focuses on customer value rather than just product specifications + - Translates technical features into meaningful benefits + - Addresses the "what's in it for me" question that customers ask + - Creates a clear connection between product capabilities and customer outcomes + - Helps customers understand why they should choose your product over alternatives + + ### When to Use FAB Copywriting + + The FAB framework is particularly effective for: + + - Product descriptions and specifications + - Technical products with complex features + - Comparison marketing + - B2B marketing where features matter + - Content that needs to explain product capabilities + - Marketing materials that need to address feature-based objections + """) + + # Main input form + with st.expander("✍️ Create Your FAB Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + product_name = st.text_input('**🏢 Product/Service Name**', + placeholder="e.g., Alwrity AI Writer", + help="Enter the name of your product or service.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Content marketers", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + features = st.text_area('**🔧 Features**', + placeholder="e.g., AI-powered content generation, Multiple copywriting frameworks, SEO optimization", + help="List the specific characteristics, attributes, or capabilities of your product or service.") + + advantages = st.text_area('**💪 Advantages**', + placeholder="e.g., 10x faster than manual writing, Supports 12+ copywriting frameworks, Built-in SEO analysis", + help="How do these features compare to or outperform competitors?") + + with col2: + product_description = st.text_input('**📝 Product Description** (In 5-6 words)', + placeholder="e.g., AI writing assistant", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., All-in-one AI copywriting platform", + help="What makes your product/service different from competitors?") + + benefits = st.text_area('**✨ Benefits**', + placeholder="e.g., Save 20+ hours per week on content creation, Increase conversion rates by 35%, Improve SEO rankings", + help="What positive outcomes or results will customers experience when using your product or service?") + + call_to_action = st.text_area('**🚀 Call to Action**', + placeholder="e.g., Start creating high-converting content today with our 14-day free trial...", + help="Prompt your audience to take action with a strong call to action.") + + landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)', + placeholder="e.g., https://alwrity.com", + help="Provide a URL to include in your call to action.") + + col1, col2 = st.columns([1, 1]) + with col1: + platform = st.selectbox( + '**📱 Content Platform**', + options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'], + help="Select the platform where your copy will be used." + ) + + with col2: + language = st.selectbox( + '**🌍 Language**', + options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'], + help="Select the language for your copy." + ) + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate FAB Copy**', type="primary"): + if not product_name or not product_description or not features or not advantages or not benefits: + st.error("⚠️ Please fill in all required fields (Product Name, Description, Features, Advantages, and Benefits)!") + else: + with st.spinner("✨ Crafting compelling FAB copy..."): + fab_copy = generate_fab_copy( + product_name, + product_description, + features, + advantages, + benefits, + target_audience, + unique_selling_point, + call_to_action, + landing_page_url, + platform, + language, + tone_style + ) + + if fab_copy: + st.markdown(""" +
+

🎯 Your FAB Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(fab_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your FAB Copy", expanded=False): + st.markdown(""" + ### How to Use Your FAB Copy Effectively + + 1. **Follow the sequence**: The FAB framework creates a natural progression - make sure your copy maintains this flow + + 2. **Balance features and benefits**: While benefits are most important, don't neglect features for technical audiences + + 3. **Be specific**: Use concrete numbers, statistics, and examples to make your advantages and benefits more compelling + + 4. **Pair with visuals**: Combine your copy with images that showcase your product features and the resulting benefits + + 5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 6. **Measure results**: Track conversion metrics to see how your FAB copy performs + + 7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate FAB Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_fab_copy(product_name, product_description, features, advantages, benefits, + target_audience, unique_selling_point, call_to_action, + landing_page_url, platform, language, tone_style): + system_prompt = """You are an expert copywriter specializing in the FAB (Features-Advantages-Benefits) framework. + Your expertise is in creating compelling, conversion-focused marketing copy that translates product features into meaningful customer benefits. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {product_name}, which is a {product_description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + PLATFORM: {platform} + LANGUAGE: {language} + TONE & STYLE: {tone_style} + + Use the FAB framework with these elements: + - **Features**: {features} + - **Advantages**: {advantages} + - **Benefits**: {benefits} + - **Call to Action**: {call_to_action} + """ + + if landing_page_url: + prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action." + + prompt += """ + For each campaign: + 1. Start by highlighting the key features of the product or service + 2. Explain the advantages these features provide compared to alternatives + 3. Connect these advantages to specific benefits that customers will experience + 4. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/oath_copywriter.py b/lib/ai_writers/ai_copywriter/oath_copywriter.py new file mode 100644 index 00000000..d5375cd6 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/oath_copywriter.py @@ -0,0 +1,186 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

📋 OATH Copywriting Generator

+

Create compelling copy that addresses different audience mindsets using the OATH (Oblivious-Apathetic-Thinking-Hurting) framework.

+
+ """, unsafe_allow_html=True) + + # Educational content about OATH copywriting + with st.expander("📚 What is OATH Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the OATH Copywriting Framework + + The OATH framework is a powerful copywriting approach that recognizes different audience mindsets: + + - **Oblivious**: People who don't know they have a problem or need + - **Apathetic**: People who know about the problem but don't care enough to act + - **Thinking**: People who are actively considering solutions + - **Hurting**: People who are experiencing pain and urgently need a solution + + ### Why OATH Copywriting Works + + The OATH framework works because it: + + - Addresses the full spectrum of audience awareness + - Creates targeted messaging for each mindset + - Increases conversion rates by meeting people where they are + - Helps you craft the right message for the right audience + - Allows for more personalized and effective marketing campaigns + + ### When to Use OATH Copywriting + + The OATH framework is particularly effective for: + + - New product launches + - Educational content + - Problem-solution marketing + - Awareness campaigns + - Multi-channel marketing strategies + - Content that needs to address different audience segments + """) + + # Main input form + with st.expander("✍️ Create Your OATH Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + oblivious = st.text_area('**🔍 Oblivious Audience**', + placeholder="People who don't know they have this problem...", + help="Describe the audience who doesn't know they have a problem or need your solution.") + + apathetic = st.text_area('**😐 Apathetic Audience**', + placeholder="People who know about the problem but don't care enough to act...", + help="Describe the audience who knows about the problem but isn't motivated to solve it.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + thinking = st.text_area('**🤔 Thinking Audience**', + placeholder="People who are actively considering solutions...", + help="Describe the audience who is actively researching solutions to their problem.") + + hurting = st.text_area('**😫 Hurting Audience**', + placeholder="People who are experiencing pain and urgently need a solution...", + help="Describe the audience who is experiencing significant pain and urgently needs a solution.") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate OATH Copy**', type="primary"): + if not brand_name or not description or not oblivious or not apathetic or not thinking or not hurting: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all audience segments)!") + else: + with st.spinner("✨ Crafting compelling OATH copy..."): + oath_copy = generate_oath_copy( + brand_name, + description, + oblivious, + apathetic, + thinking, + hurting, + target_audience, + unique_selling_point, + tone_style + ) + + if oath_copy: + st.markdown(""" +
+

📋 Your OATH Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(oath_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy - using a container instead of an expander + st.markdown(""" +
+

💡 Tips for Using Your OATH Copy

+
+ """, unsafe_allow_html=True) + + st.markdown(""" + ### How to Use Your OATH Copy Effectively + + 1. **Target the right audience**: Use the appropriate OATH segment copy based on your target audience's current mindset + + 2. **Create a journey**: Consider how to move audiences from one mindset to another (e.g., from Oblivious to Thinking) + + 3. **Test different versions**: A/B test your copy to see which OATH segment resonates most with your audience + + 4. **Pair with visuals**: Combine your copy with images that reinforce the message for each audience segment + + 5. **Measure results**: Track engagement metrics to see how your OATH copy performs across different audience segments + + 6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate OATH Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_oath_copy(brand_name, description, oblivious, apathetic, thinking, hurting, + target_audience, unique_selling_point, tone_style): + system_prompt = """You are an expert copywriter specializing in the OATH (Oblivious-Apathetic-Thinking-Hurting) framework. + Your expertise is in creating compelling, targeted marketing copy that addresses different audience mindsets and awareness levels. + Your copy is authentic, specific to the brand, and focused on meeting audiences where they are in their journey.""" + + prompt = f"""Create 4 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the OATH framework with these audience segments: + - **Oblivious**: {oblivious} + - **Apathetic**: {apathetic} + - **Thinking**: {thinking} + - **Hurting**: {hurting} + + For each campaign: + 1. Create a compelling headline that captures attention + 2. Write 2-3 paragraphs that address the specific audience mindset + 3. End with a strong call to action + 4. Explain how the copy is tailored to that specific audience mindset + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/pas_copywriter.py b/lib/ai_writers/ai_copywriter/pas_copywriter.py new file mode 100644 index 00000000..5e1a5ecf --- /dev/null +++ b/lib/ai_writers/ai_copywriter/pas_copywriter.py @@ -0,0 +1,213 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def input_section(): + st.markdown(""" +
+

🎯 PAS Copywriting Generator

+

Create compelling copy that follows the PAS (Problem-Agitate-Solution) framework to drive conversions.

+
+ """, unsafe_allow_html=True) + + # Educational content about PAS copywriting + with st.expander("📚 What is PAS Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the PAS Copywriting Framework + + PAS is an acronym for Problem-Agitate-Solution. It's a powerful copywriting framework that focuses on identifying and solving customer pain points: + + - **Problem**: Identifying a specific problem or pain point that your target audience faces + - **Agitate**: Amplifying the problem by highlighting its negative consequences and emotional impact + - **Solution**: Presenting your product or service as the ideal solution to the problem + + ### Why PAS Copywriting Works + + The PAS framework works because it: + + - Addresses real customer pain points and needs + - Creates emotional resonance by highlighting the consequences of inaction + - Positions your product/service as the hero that solves the problem + - Follows a natural problem-solving narrative that readers can relate to + - Focuses on the customer's journey rather than just product features + + ### When to Use PAS Copywriting + + The PAS framework is particularly effective for: + + - Products or services that solve specific problems + - Marketing to audiences with clear pain points + - Content that needs to drive specific actions + - Landing pages and sales pages + - Email marketing campaigns + - Direct response advertising + """) + + # Main input form + with st.expander("✍️ Create Your PAS Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + problem = st.text_area('**❌ Problem**', + placeholder="e.g., Struggling to create high-quality content that converts", + help="Identify a specific problem or pain point that your target audience faces.") + + agitate = st.text_area('**😫 Agitate**', + placeholder="e.g., Without effective content, you're losing potential customers and revenue every day...", + help="Amplify the problem by highlighting its negative consequences and emotional impact.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 5-6 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + solution = st.text_area('**✨ Solution**', + placeholder="e.g., Our AI-powered platform creates high-converting content in minutes...", + help="Present your product or service as the ideal solution to the problem.") + + call_to_action = st.text_area('**🚀 Call to Action**', + placeholder="e.g., Start creating converting content today with our 14-day free trial...", + help="Prompt your audience to take action with a strong call to action.") + + landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)', + placeholder="e.g., https://alwrity.com", + help="Provide a URL to include in your call to action.") + + col1, col2 = st.columns([1, 1]) + with col1: + platform = st.selectbox( + '**📱 Content Platform**', + options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'], + help="Select the platform where your copy will be used." + ) + + with col2: + language = st.selectbox( + '**🌍 Language**', + options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'], + help="Select the language for your copy." + ) + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate PAS Copy**', type="primary"): + if not brand_name or not description or not problem or not agitate or not solution: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Problem, Agitate, and Solution)!") + else: + with st.spinner("✨ Crafting compelling PAS copy..."): + pas_copy = generate_pas_copy( + brand_name, + description, + problem, + agitate, + solution, + target_audience, + unique_selling_point, + call_to_action, + landing_page_url, + platform, + language, + tone_style + ) + + if pas_copy: + st.markdown(""" +
+

🎯 Your PAS Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(pas_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your PAS Copy", expanded=False): + st.markdown(""" + ### How to Use Your PAS Copy Effectively + + 1. **Follow the sequence**: The PAS framework creates a natural progression - make sure your copy maintains this flow + + 2. **Be specific about the problem**: The more specific and relatable the problem, the more effective your copy will be + + 3. **Balance agitation**: Don't over-agitate to the point of creating anxiety; find the right balance to motivate action + + 4. **Pair with visuals**: Combine your copy with images that reinforce each stage of the PAS journey + + 5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.) + + 6. **Measure results**: Track conversion metrics to see how your PAS copy performs + + 7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate PAS Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_pas_copy(brand_name, description, problem, agitate, solution, + target_audience, unique_selling_point, call_to_action, + landing_page_url, platform, language, tone_style): + system_prompt = """You are an expert copywriter specializing in the PAS (Problem-Agitate-Solution) framework. + Your expertise is in creating compelling, conversion-focused marketing copy that identifies customer pain points, + amplifies their impact, and positions your product or service as the ideal solution. + Your copy is authentic, specific to the brand, and focused on driving measurable results.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + PLATFORM: {platform} + LANGUAGE: {language} + TONE & STYLE: {tone_style} + + Use the PAS framework with these elements: + - **Problem**: {problem} + - **Agitate**: {agitate} + - **Solution**: {solution} + - **Call to Action**: {call_to_action} + """ + + if landing_page_url: + prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action." + + prompt += """ + For each campaign: + 1. Start by identifying the specific problem or pain point + 2. Amplify the problem by highlighting its negative consequences and emotional impact + 3. Present your product or service as the ideal solution to the problem + 4. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/quest_copywriter.py b/lib/ai_writers/ai_copywriter/quest_copywriter.py new file mode 100644 index 00000000..2552d637 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/quest_copywriter.py @@ -0,0 +1,191 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen +from tenacity import retry, wait_random_exponential, stop_after_attempt + +def title_and_description(): + st.markdown(""" +
+

🔍 QUEST Copywriting Generator

+

Create compelling copy that guides your audience through a journey using the QUEST (Question-Unpack-Emphasize-Solution-Transform) framework.

+
+ """, unsafe_allow_html=True) + + # Educational content about QUEST copywriting + with st.expander("📚 What is QUEST Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the QUEST Copywriting Framework + + QUEST is an acronym for Question-Unpack-Emphasize-Solution-Transform. It's a copywriting framework that focuses on guiding the audience through different stages: + + - **Question**: Presenting a thought-provoking question to engage the audience + - **Unpack**: Unpacking the question by elaborating on its implications and relevance + - **Emphasize**: Emphasizing the importance or significance of the topic + - **Solution**: Presenting your product or service as the solution to the question + - **Transform**: Describing the transformation or improvement your solution offers + + ### Why QUEST Copywriting Works + + The QUEST framework works because it: + + - Creates a natural flow that guides readers through a journey + - Engages readers by starting with a question they care about + - Builds credibility by showing deep understanding of the problem + - Demonstrates value by clearly connecting the solution to the problem + - Inspires action by showing the transformation that's possible + + ### When to Use QUEST Copywriting + + The QUEST framework is particularly effective for: + + - Educational content and blog posts + - Product launches and feature announcements + - Problem-solution marketing + - Thought leadership content + - Content that needs to guide readers through a journey + - Marketing materials that need to explain complex solutions + """) + +def input_section(): + # Main input form + with st.expander("✍️ Create Your QUEST Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + question = st.text_area('**❓ Thought-Provoking Question**', + placeholder="e.g., What if you could create content 10x faster without sacrificing quality?", + help="Pose a question that resonates with your audience and highlights a problem they face.") + + unpack = st.text_area('**📦 Unpack the Question**', + placeholder="e.g., Content creation is time-consuming and often results in inconsistent quality...", + help="Elaborate on the implications of the question and provide context that your audience can relate to.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + emphasize = st.text_area('**💪 Emphasize Importance**', + placeholder="e.g., In today's fast-paced digital world, efficient content creation is essential for business growth...", + help="Highlight the relevance and impact of addressing this problem.") + + solution = st.text_area('**🔧 Present Your Solution**', + placeholder="e.g., Our AI-powered writing assistant helps you create high-quality content in a fraction of the time...", + help="Introduce your product or service as the solution to the question.") + + transform = st.text_area('**✨ Describe the Transformation**', + placeholder="e.g., Imagine having more time to focus on strategy while maintaining consistent, high-quality content...", + help="Describe the transformation or improvement your solution offers to your audience.") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate QUEST Copy**', type="primary"): + if not brand_name or not description or not question or not unpack or not emphasize or not solution or not transform: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all QUEST elements)!") + else: + with st.spinner("✨ Crafting compelling QUEST copy..."): + quest_copy = generate_quest_copy( + brand_name, + description, + question, + unpack, + emphasize, + solution, + transform, + target_audience, + unique_selling_point, + tone_style + ) + + if quest_copy: + st.markdown(""" +
+

🔍 Your QUEST Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(quest_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy + with st.expander("💡 Tips for Using Your QUEST Copy", expanded=False): + st.markdown(""" + ### How to Use Your QUEST Copy Effectively + + 1. **Follow the journey**: The QUEST framework creates a natural flow - make sure your copy maintains this progression + + 2. **Test different questions**: A/B test different opening questions to see which resonates most with your audience + + 3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the QUEST journey + + 4. **Consider the context**: Adapt the copy based on where it will appear (blog post, landing page, email, etc.) + + 5. **Measure results**: Track engagement metrics to see how your QUEST copy performs + + 6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate QUEST Copy. Please try again!**") + + +@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) +def generate_quest_copy(brand_name, description, question, unpack, emphasize, solution, transform, + target_audience, unique_selling_point, tone_style): + system_prompt = """You are an expert copywriter specializing in the QUEST (Question-Unpack-Emphasize-Solution-Transform) framework. + Your expertise is in creating compelling, narrative-driven marketing copy that guides readers through a journey. + Your copy is authentic, specific to the brand, and focused on connecting with the audience's needs and desires.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the QUEST framework with these elements: + - **Question**: {question} + - **Unpack**: {unpack} + - **Emphasize**: {emphasize} + - **Solution**: {solution} + - **Transform**: {transform} + + For each campaign: + 1. Start with the thought-provoking question to engage the audience + 2. Unpack the question by elaborating on its implications + 3. Emphasize the importance of addressing this issue + 4. Present your solution clearly and convincingly + 5. Describe the transformation that your solution offers + 6. End with a strong call to action + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/ai_writers/ai_copywriter/star_copywriter.py b/lib/ai_writers/ai_copywriter/star_copywriter.py new file mode 100644 index 00000000..01e1b855 --- /dev/null +++ b/lib/ai_writers/ai_copywriter/star_copywriter.py @@ -0,0 +1,182 @@ +import streamlit as st +from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen + +def input_section(): + st.markdown(""" +
+

⭐ STAR Copywriting Generator

+

Create compelling marketing copy using the proven STAR (Situation-Task-Action-Result) framework.

+
+ """, unsafe_allow_html=True) + + # Educational content about STAR copywriting + with st.expander("📚 What is STAR Copywriting?", expanded=False): + st.markdown(""" + ### Understanding the STAR Copywriting Framework + + The STAR framework is a powerful storytelling structure that creates compelling narratives: + + - **Situation**: Set the context and background for the problem or need + - **Task**: Describe the specific challenge or objective that needs to be addressed + - **Action**: Explain the specific actions taken to address the challenge + - **Result**: Highlight the positive outcomes and benefits achieved + + ### Why STAR Copywriting Works + + The STAR framework works because it: + + - Creates a complete narrative arc that engages readers + - Demonstrates problem-solving capabilities + - Shows concrete results and benefits + - Builds credibility through specific examples + - Makes abstract benefits tangible through storytelling + + ### When to Use STAR Copywriting + + The STAR framework is particularly effective for: + + - Case studies and success stories + - Product or service demonstrations + - Customer testimonials + - Company achievements and milestones + - Problem-solution marketing + - Portfolio showcases + """) + + # Main input form + with st.expander("✍️ Create Your STAR Copy", expanded=True): + col1, col2 = st.columns([1, 1]) + + with col1: + brand_name = st.text_input('**🏢 Brand/Company Name**', + placeholder="e.g., Alwrity", + help="Enter the name of your brand or company.") + + target_audience = st.text_input('**👥 Target Audience**', + placeholder="e.g., Small business owners, Tech professionals", + help="Who is your ideal customer? Be specific about demographics and psychographics.") + + situation = st.text_area('**🌍 Situation (Context)**', + placeholder="In a busy city, Late Delivery, Unsafe Activities, Unprofessional Service..", + help="Describe the background context or problem that needs to be addressed.") + + action = st.text_area('**⚡ Action (Solution)**', + placeholder="New strategy, launched campaign, better service, New product...", + help="Describe the specific actions taken to address the challenge or objective.") + + with col2: + description = st.text_input('**📝 Brand Description** (In 2-3 words)', + placeholder="e.g., AI writing tools", + help="Describe your product or service briefly.") + + unique_selling_point = st.text_input('**💎 Unique Selling Point**', + placeholder="e.g., 10x faster content creation", + help="What makes your product/service different from competitors?") + + task = st.text_area('**🎯 Task (Challenge)**', + placeholder="Increase website traffic by 30%, improve customer satisfaction, Safe Travels...", + help="Describe the specific challenge or objective that needs to be addressed.") + + result = st.text_area('**✨ Result (Outcome)**', + placeholder="Improved customer engagement, sales revenue, Happy customers, Improved Service X...", + help="Highlight the positive outcomes and benefits achieved from the actions taken.") + + tone_style = st.selectbox( + '**🎭 Copy Tone & Style**', + options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'], + help="Select the tone and style for your copy." + ) + + if st.button('**🚀 Generate STAR Copy**', type="primary"): + if not brand_name or not description or not situation or not task or not action or not result: + st.error("⚠️ Please fill in all required fields (Brand Name, Description, Situation, Task, Action, and Result)!") + else: + with st.spinner("✨ Crafting compelling STAR copy..."): + star_copy = generate_star_copy( + brand_name, + description, + situation, + task, + action, + result, + target_audience, + unique_selling_point, + tone_style + ) + + if star_copy: + st.markdown(""" +
+

⭐ Your STAR Copy

+
+ """, unsafe_allow_html=True) + + # Display the copy with a nice format + st.markdown(star_copy) + + # Add copy button + st.markdown(""" +
+ +
+ """, unsafe_allow_html=True) + + # Add tips for using the copy - using a container instead of an expander + st.markdown(""" +
+

💡 Tips for Using Your STAR Copy

+
+ """, unsafe_allow_html=True) + + st.markdown(""" + ### How to Use Your STAR Copy Effectively + + 1. **Test different versions**: A/B test your copy to see which version resonates most with your audience + + 2. **Pair with visuals**: Combine your copy with images that illustrate each stage of the STAR framework + + 3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.) + + 4. **Measure results**: Track engagement metrics to see how your STAR copy performs + + 5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data + """) + else: + st.error("💥 **Failed to generate STAR Copy. Please try again!**") + + +def generate_star_copy(brand_name, description, situation, task, action, result, target_audience, + unique_selling_point, tone_style): + system_prompt = """You are an expert copywriter specializing in the STAR (Situation-Task-Action-Result) framework. + Your expertise is in creating compelling, narrative-driven marketing copy that tells a complete story from problem to solution. + Your copy is authentic, specific to the brand, and focused on demonstrating concrete results and benefits.""" + + prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}. + + TARGET AUDIENCE: {target_audience} + UNIQUE SELLING POINT: {unique_selling_point} + TONE & STYLE: {tone_style} + + Use the STAR framework with these elements: + - **Situation**: {situation} + - **Task**: {task} + - **Action**: {action} + - **Result**: {result} + + For each campaign: + 1. Create a compelling headline that captures attention + 2. Write 2-3 paragraphs that follow the STAR framework + 3. End with a strong call to action + 4. Explain how each element of the STAR framework is used in the copy + + Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers. + Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires. + """ + + try: + return llm_text_gen(prompt, system_prompt=system_prompt) + except Exception as e: + st.error(f"Error generating copy: {str(e)}") + return None \ No newline at end of file diff --git a/lib/gpt_providers/text_generation/main_text_generation.py b/lib/gpt_providers/text_generation/main_text_generation.py index f590e11f..1c92491f 100644 --- a/lib/gpt_providers/text_generation/main_text_generation.py +++ b/lib/gpt_providers/text_generation/main_text_generation.py @@ -19,11 +19,12 @@ from .deepseek_text_gen import deepseek_text_response from ...utils.read_main_config_params import read_return_config_section -def llm_text_gen(prompt): +def llm_text_gen(prompt, system_prompt=None): """ Generate text using Language Model (LLM) based on the provided prompt. Args: prompt (str): The prompt to generate text from. + system_prompt (str, optional): Custom system prompt to use instead of the default one. Returns: str: Generated text based on the prompt. """ @@ -43,27 +44,31 @@ def llm_text_gen(prompt): logger.error(f"[llm_text_gen] Error reading config params: {err}") raise err - # Construct the system prompt with the sidebar config params. - system_instructions = f"""You are a highly skilled content writer with a knack for creating engaging and informative content. - Your expertise spans various writing styles and formats. + # Construct the system prompt with the sidebar config params if no custom system_prompt is provided + if system_prompt is None: + system_instructions = f"""You are a highly skilled content writer with a knack for creating engaging and informative content. + Your expertise spans various writing styles and formats. - Here's a breakdown of the instructions for this writing task: + Here's a breakdown of the instructions for this writing task: - **Content Guidelines:** + **Content Guidelines:** - 1. **Language:** Your response must be in **{blog_language}** language. - 2. **Tone and Brand Alignment:** Adjust your tone, voice, and personality to be appropriate for a **{blog_tone}** audience. - 3. **Content Length:** Ensure your response is approximately **{blog_length}** words in length. - 4. **Blog Type:** The type of blog is **{blog_type}**. Write accordingly, adhering to the conventions and expectations of this type of content. - 5. **Target Audience:** The demographic for this content is **{blog_demographic}**. Keep their interests and needs in mind. - 6. **Output Format:** Your response should be in **{blog_output_format}** format. This could be Markdown, HTML, or a specific structured format, depending on the user's preference. + 1. **Language:** Your response must be in **{blog_language}** language. + 2. **Tone and Brand Alignment:** Adjust your tone, voice, and personality to be appropriate for a **{blog_tone}** audience. + 3. **Content Length:** Ensure your response is approximately **{blog_length}** words in length. + 4. **Blog Type:** The type of blog is **{blog_type}**. Write accordingly, adhering to the conventions and expectations of this type of content. + 5. **Target Audience:** The demographic for this content is **{blog_demographic}**. Keep their interests and needs in mind. + 6. **Output Format:** Your response should be in **{blog_output_format}** format. This could be Markdown, HTML, or a specific structured format, depending on the user's preference. - **Additional Instructions:** + **Additional Instructions:** - * **SEO Optimization:** Incorporate relevant keywords naturally throughout the content to improve its search engine visibility. - * **Call to Action:** Include a call to action if appropriate for the blog type and target audience. - * **Factual Accuracy:** Ensure your content is accurate and reliable. Back up any claims with credible sources. - * **Unique Voice and Style:** Inject your unique voice and writing style to make the content engaging and memorable. """ + * **SEO Optimization:** Incorporate relevant keywords naturally throughout the content to improve its search engine visibility. + * **Call to Action:** Include a call to action if appropriate for the blog type and target audience. + * **Factual Accuracy:** Ensure your content is accurate and reliable. Back up any claims with credible sources. + * **Unique Voice and Style:** Inject your unique voice and writing style to make the content engaging and memorable. """ + else: + system_instructions = system_prompt + logger.info("[llm_text_gen] Using custom system prompt") # Check if API key is provided for the given gpt_provider get_api_key(gpt_provider) @@ -88,7 +93,7 @@ def llm_text_gen(prompt): elif 'anthropic' in gpt_provider.lower(): try: logger.info(f"Using Anthropic Model: {model} for text Generation.") - response = anthropic_text_response(prompt) + response = anthropic_text_response(prompt, model, temperature, max_tokens, top_p, n, system_instructions) return response except Exception as err: logger.error(f"Failed to get response from Anthropic: {err}") diff --git a/lib/utils/content_generators.py b/lib/utils/content_generators.py index f0f02cbf..e76f4a49 100644 --- a/lib/utils/content_generators.py +++ b/lib/utils/content_generators.py @@ -7,6 +7,7 @@ from lib.alwrity_ui.similar_analysis import competitor_analysis from lib.alwrity_ui.keyword_web_researcher import do_web_research from lib.ai_writers.ai_story_writer.story_writer import story_input_section from lib.ai_writers.ai_product_description_writer import write_ai_prod_desc +from lib.ai_writers.ai_copywriter.copywriter_dashboard import copywriter_dashboard #from lib.content_planning_calender.content_planning_agents_alwrity_crew import ai_agents_content_planner @@ -35,8 +36,12 @@ def ai_writers(): ai_finance_ta_writer() elif choice == "AI Product Description Writer": write_ai_prod_desc() + elif choice == "AI Copywriter": + # Initialize the copywriter dashboard + copywriter_dashboard() elif choice == "Quit": - st.subheader("Exiting, Getting Lost. But.... I have nowhere to go 🥹🥹") + st.info("Thank you for using Alwrity. Goodbye!") + st.stop() def content_planning_tools():