Spaces:
Running
Running
from serp_tool import search_google | |
from llm_tool import analyze_data | |
def run_analysis(input_type, query): | |
""" | |
Core agent logic to handle different analysis types | |
""" | |
if input_type == "Competitor Analysis": | |
raw_data = search_google(f"site:{query} reviews pricing features") | |
prompt = f"""Analyze competitor {query} using these reviews and features: {raw_data} | |
Generate a detailed SWOT analysis: | |
1. Strengths | |
2. Weaknesses | |
3. Opportunities | |
4. Threats | |
Include pricing strategy insights and customer sentiment summary.""" | |
elif input_type == "Keyword Research": | |
raw_data = search_google(f"best keywords for {query}") | |
prompt = f"""Generate SEO keyword report for "{query}" using: {raw_data} | |
List: | |
1. Top 5 keywords (with search volume and CPC) | |
2. Content gap opportunities | |
3. Backlink strategies | |
4. Competitor keyword analysis""" | |
elif input_type == "Trend Discovery": | |
raw_data = search_google(f"latest trends in {query} 2024") | |
prompt = f"""Identify emerging trends in "{query}" using: {raw_data} | |
Report: | |
1. Top 3 trends | |
2. Viral content patterns | |
3. Customer pain points | |
4. Opportunity areas""" | |
elif input_type == "Idea Validation": | |
raw_data = search_google(f"market demand for {query}") | |
prompt = f"""Validate business idea "{query}" using market data: {raw_data} | |
Assess: | |
1. Market demand score (1-10) | |
2. Competitor saturation | |
3. Pricing benchmarks | |
4. Go-to-market strategy""" | |
else: | |
return "Invalid analysis type selected" | |
return analyze_data(prompt) |