Elevate Your Content Strategy with Lyzr's Content Campaign Generator
Tags: lyzrai, tutorial, beginners, python
Published: 2024-04-04 19:51:41

Crafting compelling content campaigns is essential for enhancing brand visibility and engagement in today's digital landscape. To streamline this process, [Lyzr](lyzr.ai) introduces the Content Campaign Generator, a powerful tool designed to create comprehensive content roadmaps tailored to your business goals and target audience. In this article, we'll explore how this innovative tool simplifies the content planning process and empowers digital marketers to drive success. This utilizes [Lyzr Automata](https://github.com/LyzrCore/lyzr-automata) to generate a 3–5 month content roadmap.

Lyzr offers an agent-centric approach to rapidly developing LLM (Large Language Model) applications with minimal code and time investment. Even if you’re unfamiliar with the GenAI stack, Lyzr empowers you to build your AI applications effortlessly. It is the go-to solution for constructing GenAI apps without requiring an in-depth understanding of Generative AI.

---
{% embed https://docs.lyzr.ai/homepage?source=post_page-----d75ae3ce0c04-------------------------------- %}
---

## Setting up the Project

Getting started with Lyzr's Content Campaign Generator is quick and easy. Follow these steps to set up the project:

**Clone the App**: Clone the Content Campaign Generator app repository from GitHub.

   ```bash
   git clone https://github.com/PrajjwalLyzr/Content-Campaign-Generator
   ```

**Create a Virtual Environment**: Set up a virtual environment and activate it.

   ```bash
   python3 -m venv venv
   source venv/bin/activate
   ```

**Set Environment Variables**: Create a `.env` file and add your OpenAI API key.

   ```python
   OPENAI_API_KEY = "Paste your openai api key here"
   ```

**Install Dependencies**: Install the required dependencies.

   ```bash
   pip install lyzr-automata streamlit python-dotenv
   ```

## Core Components of the Content Campaign Generator App

Let's explore the key components of Lyzr's Content Campaign Generator app:

```python
import os
import streamlit as st
from lyzr_automata.ai_models.openai import OpenAIModel
from lyzr_automata import Agent, Task, Logger
from lyzr_automata.tasks.task_literals import InputType, OutputType
from lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline
from dotenv import load_dotenv

load_dotenv()

API_KEY = os.getenv('OPENAI_API_KEY')

open_ai_model_text = OpenAIModel(
    api_key= API_KEY,
    parameters={
        "model": "gpt-4-turbo-preview",
        "temperature": 0.5,
        "max_tokens": 1500,
    },
)

def content_campaign_generator(campaign_goal, target_audience):
   
    digital_marketer_agent = Agent(
        prompt_persona="""You are an expert Digital Marketer and as a Digital Marketer expert, your mission is to craft and execute innovative digital marketing strategies that elevate brand visibility and drive customer engagement. Utilize your expertise in data analysis, SEO optimization, social media management, and content creation to create compelling campaigns that resonate with target audiences and propel brands to new heights in the digital landscape.""",
        role="Digital Marketer",
    )

    campaign_generator =  Task(
        name="Campaign Generator",
        agent=digital_marketer_agent,
        output_type=OutputType.TEXT,
        input_type=InputType.TEXT,
        model=open_ai_model_text,
        instructions=f"Use the description provided Outline a content roadmap with key topics and formats for a 5-month content marketing campaign, the Campaign Goal : {campaign_goal} for the Target Audience: {target_audience}. [IMPORTANT!] Setup the events in a detailed manner",
        log_output=True,
        enhance_prompt=False,
        default_input=campaign_goal
    )

    logger = Logger()

    main_output = LinearSyncPipeline(
        logger=logger,
        name="Content Campaign Generator",
        completion_message="App Generated all things!",
        tasks=[
            campaign_generator,
        ],
    ).run()

    return main_output
```

## Initializing the Application

The entry point of the Content Campaign Generator application prompts the user to input the campaign goal and target audience via Streamlit text areas. Upon clicking the submit button, it triggers the `content_campaign_generator` function, passing the provided campaign goal and target audience as parameters.

```python
if __name__ == "__main__":
    campaign = st.text_area("Campaign Goal")
    audience = st.text_area('Targeted Audience')

    button = st.button('Submit')
    if button:
        generated_output = content_campaign_generator(campaign_goal=campaign, target_audience=audience)
        title_output = generated_output[0]['task_output']
        st.write(title_output)
        st.markdown('---')
```

The function generates a content roadmap based on the inputs, outlining key topics and formats for a 5-month content marketing campaign tailored to the specified audience.

## Conclusion

Lyzr's Content Campaign Generator, digital marketers can streamline the content planning process and craft innovative content strategies that elevate brand visibility and drive engagement. Embrace the power of AI to create comprehensive content roadmaps tailored to your business goals and target audience.

## References

- [Content Campaign Generator GitHub Repository](https://github.com/PrajjwalLyzr/Content-Campaign-Generator)
- [Lyzr Website](https://www.lyzr.ai/)
- [Book a Demo](https://www.lyzr.ai/book-demo/)
- Lyzr Community Channels: [Discord](https://discord.gg/nm7zSyEFA2), [Slack](https://join.slack.com/t/genaiforenterprise/shared_invite/zt-2a7fr38f7-_QDOY1W1WSlSiYNAEncLGw)