Spaces:
Sleeping
Sleeping
Create Phase2Agent.py
Browse files- Phase2Agent.py +65 -0
Phase2Agent.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from phi.agent import Agent
|
| 3 |
+
from phi.tools.duckduckgo import DuckDuckGo
|
| 4 |
+
from phi.tools.exa import ExaTools
|
| 5 |
+
from phi.model.openai import OpenAIChat
|
| 6 |
+
from typing import List
|
| 7 |
+
from pydantic import BaseModel, Field
|
| 8 |
+
|
| 9 |
+
# Load environment variables (API keys, etc.)
|
| 10 |
+
from dotenv import load_dotenv
|
| 11 |
+
load_dotenv()
|
| 12 |
+
|
| 13 |
+
#####################################################################################
|
| 14 |
+
# PHASE 2 #
|
| 15 |
+
#####################################################################################
|
| 16 |
+
|
| 17 |
+
##############################
|
| 18 |
+
# 1️⃣ Industry Trends Agent #
|
| 19 |
+
##############################
|
| 20 |
+
industry_trends_agent = Agent(
|
| 21 |
+
name="Industry Trends Agent",
|
| 22 |
+
model=OpenAIChat(id="gpt-4o"),
|
| 23 |
+
tools=[ExaTools(include_domains=["cnbc.com", "reuters.com", "bloomberg.com"])],
|
| 24 |
+
description="Finds the latest AI advancements in a given industry.",
|
| 25 |
+
show_tool_calls=True,
|
| 26 |
+
markdown=True,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
def get_industry_trends(industry: str):
|
| 30 |
+
query = f"Find the latest AI advancements, innovations, and emerging technologies in the {industry} sector. Include breakthroughs, adoption trends, and notable implementations by leading companies. Provide references and insights from credible sources."
|
| 31 |
+
return industry_trends_agent.print_response(query)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
##################################
|
| 35 |
+
# 2️⃣ AI Use Case Discovery Agent #
|
| 36 |
+
##################################
|
| 37 |
+
ai_use_case_agent = Agent(
|
| 38 |
+
name="AI Use Case Discovery Agent",
|
| 39 |
+
model=OpenAIChat(id="gpt-4o"),
|
| 40 |
+
tools=[DuckDuckGo()],
|
| 41 |
+
description="Identifies AI applications relevant to a given industry.",
|
| 42 |
+
show_tool_calls=True,
|
| 43 |
+
markdown=True,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
def get_ai_use_cases(industry: str):
|
| 47 |
+
query = f"Identify the most impactful AI use cases in the {industry} sector. Include real-world applications, automation improvements, cost-saving innovations, and data-driven decision-making processes. Provide case studies and examples of successful AI implementation."
|
| 48 |
+
return ai_use_case_agent.print_response(query)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
####################################
|
| 52 |
+
# 3️⃣ Competitive Analysis Agent #
|
| 53 |
+
####################################
|
| 54 |
+
competitive_analysis_agent = Agent(
|
| 55 |
+
name="Competitive Analysis Agent",
|
| 56 |
+
model=OpenAIChat(id="gpt-4o"),
|
| 57 |
+
tools=[DuckDuckGo(), ExaTools(include_domains=["techcrunch.com", "forbes.com", "businessinsider.com"])],
|
| 58 |
+
description="Analyzes how competitors are using AI in their businesses.",
|
| 59 |
+
show_tool_calls=True,
|
| 60 |
+
markdown=True,
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
def get_competitor_ai_strategies(company_name: str):
|
| 64 |
+
query = f"Analyze how {company_name} is leveraging AI in its business operations. Find recent reports, product innovations, automation strategies, and AI-driven transformations. Highlight competitive advantages gained through AI adoption. Provide references and sources."
|
| 65 |
+
return competitive_analysis_agent.print_response(query)
|