Gain a Competitive Edge with Lyzr's Analyze Competitor Content App
Published: 2024-04-04 17:49:02

In today’s dynamic digital landscape, understanding your competitors and devising a robust content strategy are paramount to success. Enter the Analyze Competitor Content app by [Lyzr](lyzr.ai), an innovative tool that harnesses the power of AI to provide actionable insights into competitors’ content strategies. In this article, we’ll explore how this cutting-edge tool revolutionizes content strategy and empowers brands to differentiate themselves in the market.

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-----d489e660352b-------------------------------- %}
---


## Setting up the Project

To get started with Lyzr's Analyze Competitor Content app, follow these steps:

**Clone the App**: Clone the Analyze Competitor Content app repository from GitHub.

   ```bash
   git clone https://github.com/PrajjwalLyzr/Analyze-Competitor-Content
   ```

**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
   ```
## Structure

```scss
Analyze-Competitor-Content
│
│
├── app.py
│
├── README.md
│
├── .gitignore
│
└── requirements.txt

```
## Core Components of the Analyze Competitor Content App

Let's explore the key components of Lyzr's Analyze Competitor Content 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 analyze_competitor_content(content_title, target_audience):
    content_strategy_analyst = Agent(
        prompt_persona="""You are a Content Strategy Analyst expert who analyzes a list of competitor content titles and devises a comprehensive strategy to differentiate our brand. Your task is to meticulously examine the competitor landscape, identify gaps, and propose 10 unique content topics that showcase our brand's expertise and distinct value proposition. Leveraging your expertise in content analysis, market research, and strategic planning, you'll develop innovative ideas that resonate with our target audience and set us apart from the competition.""",
        role="Content Strategy Analyst",
    )

    contnet_generator =  Task(
        name="Campaign Generator",
        agent=content_strategy_analyst,
        output_type=OutputType.TEXT,
        input_type=InputType.TEXT,
        model=open_ai_model_text,
        instructions=f"Use the description provided, given a list of competitor content titles, analyze and suggest 10 unique content topics that would differentiate our brand, and the Target Audience: {target_audience}. [IMPORTANT!] Setup the events in a detailed manner",
        log_output=True,
        enhance_prompt=False,
        default_input=content_title
    )

    logger = Logger()

    main_output = LinearSyncPipeline(
        logger=logger,
        name="Analyze Competitor Content",
        completion_message="App Generated all things!",
        tasks=[
            contnet_generator,
        ],
    ).run()

    return main_output
```

## Executing the Application

To run Lyzr's Analyze Competitor Content app:

```python
if __name__ == "__main__":
    titles = st.text_area("Write down list of competitor content titles")
    audience = st.text_area('Targeted Audience')

    button=st.button('Submit')
    if (button==True):
        generated_output = analyze_competitor_content(content_title=titles, target_audience=audience)
        title_output = generated_output[0]['task_output']
        st.write(title_output)
        st.markdown('---')
```

Upon clicking the “Submit” button, the app triggers the `analyze_competitor_content` function, passing the entered titles and audience description as arguments. The generated output includes ten unique content topics suggested by the Lyzr Automata Agent.

## Conclusion

With Lyzr's Analyze Competitor Content app, content strategists can gain invaluable insights into competitors’ content strategies and devise compelling strategies to differentiate their brand. Embrace the power of AI to stay ahead of the competition and captivate your target audience.

## References

- [Analyze Competitor Content GitHub Repository](https://github.com/PrajjwalLyzr/Analyze-Competitor-Content)
- [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)