-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathagents.py
62 lines (53 loc) · 1.84 KB
/
agents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
from textwrap import dedent
from crewai import Agent
from crewai_tools import ScrapeWebsiteTool, SerperDevTool
from dotenv import load_dotenv
from langchain_mistralai import ChatMistralAI
from langchain_openai import ChatOpenAI
from tools import scrape_linkedin_posts_tool
load_dotenv()
openai_llm = ChatOpenAI(api_key=os.environ.get("OPENAI_API_KEY"), model="gpt-3.5-turbo-0125")
mistral_llm = ChatMistralAI(api_key=os.environ.get("MISTRAL_API_KEY"), model="mistral-large-latest")
scrape_website_tool = ScrapeWebsiteTool()
search_tool = SerperDevTool()
linkedin_scraper_agent = Agent(
role="LinkedIn Post Scraper",
goal="Your goal is to scrape a LinkedIn profile to get a list of posts from the given profile",
tools=[scrape_linkedin_posts_tool],
backstory=dedent(
"""
You are an experienced programmer who excels at web scraping.
"""
),
verbose=True,
allow_delegation=False,
llm=openai_llm
)
web_researcher_agent = Agent(
role="Web Researcher",
goal="Your goal is to search for relevant content about the comparison between Llama 2 and Llama 3",
tools=[scrape_website_tool, search_tool],
backstory=dedent(
"""
You are proficient at searching for specific topics in the web, selecting those that provide
more value and information.
"""
),
verbose=True,
allow_delegation=False,
llm=openai_llm
)
doppelganger_agent = Agent(
role="LinkedIn Post Creator",
goal="You will create a LinkedIn post comparing Llama 2 and Llama 3 following the writing style "
"observed in the LinkedIn posts scraped by the LinkedIn Post Scraper.",
backstory=dedent(
"""
You are an expert in writing LinkedIn posts replicating any influencer style
"""
),
verbose=True,
allow_delegation=False,
llm=mistral_llm
)