from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain

def email_marketing_campaigns_gen(product_name, product_description, target_audience, goal, llm):
    
    email_prompt = f"Generate a high-converting email marketing campaign for {product_name}. {product_name} is {product_description}. that is targeted at {target_audience} and has the goal of {goal}. The campaign should include a welcome email, a nurture sequence, and a promotional email."
        
    email_promptTemp = PromptTemplate(
    input_variables=["text_input"],
    template="You are a Professional Email Marketing Copywriter:\n{text_input}\nEmail Marketing Campaign:")
   
    email_extraction_chain = LLMChain(llm=llm, prompt=email_promptTemp)
    email = email_extraction_chain.run(email_prompt)
    
    return email