crypto_crewAI / agents.py
quocdat25's picture
Upload folder using huggingface_hub
b252213 verified
from crewai import Agent
# from langchain_community.tools import DuckDuckGoSearchRun
from crewai_tools import tool, SerperDevTool
from langchain_community.llms import HuggingFaceEndpoint
from tools.crypt_news_tool import GetCryptoNews
from tools.search_duckduckgo_tool import SearchDuckDuckGo
# from tools.crypt_news_tool import GetCryptoNews
search_tool = SerperDevTool()
repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
llm = HuggingFaceEndpoint(
repo_id = repo_id,
# huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
)
class CryptoAnalysisAgents():
def crypto_analyst(self):
return Agent(
role='Crypto Analyst',
goal='Scrape the latest cryptocurrency news, indicators, tweets and current price of the target coin.',
backstory=(
'Keen on staying ahead with the most current information, '
'the Crypto Analyst scours through various media to gather the latest news and social sentiments.'
),
tools=[
search_tool,
GetCryptoNews(),
# SearchDuckDuckGo()
],
allow_delegation=False,
llm=llm,
verbose=True,
cache=True,
max_iter=20,
)
def content_writer(self):
return Agent(
role='Content Writer',
goal='Synthesize data and write engaging articles on latest trend of the target coin',
backstory=(
'Armed with a flair for storytelling, the Content Writer transforms intricate crypto data into captivating narratives,'
'illuminating the latest trends for a wide audience.'
),
tools=[
# search_tool,
# AskWolframAlpha(),
],
allow_delegation=False,
llm=llm,
verbose=True,
cache=True,
max_iter=20,
)