Spaces:
Sleeping
Sleeping
from crewai import Agent | |
from langchain.llms import HuggingFaceHub | |
from langchain_community.embeddings import HuggingFaceEmbeddings | |
from langchain_community.llms import HuggingFaceHub | |
from crypto_tools import CryptoTools | |
from news_tools import NewsTools | |
from sentiment_tools import SentimentTools | |
import os | |
class CryptoAnalysisAgents: | |
def __init__(self): | |
self.llm = HuggingFaceHub( | |
repo_id="facebook/opt-125m", | |
model_kwargs={"temperature": 0.7, "max_length": 512}, | |
task="text-generation" | |
) | |
self.embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2") | |
huggingfacehub_api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN") | |
def market_analyst(self): | |
return Agent( | |
role='Crypto Market Analyst', | |
goal="Provide in-depth industry, market analysis and insights for cryptocurrencies. You also provide insight on on our geo-politics and economic policies impact on crypto", | |
backstory="""You are a seasoned crypto market analyst with years of experience in blockchain technology and cryptocurrency markets. Your expertise helps clients navigate the volatile crypto landscape.""", | |
verbose=True, | |
llm=self.llm, | |
tools=[ | |
CryptoTools.get_crypto_price, | |
CryptoTools.get_market_cap, | |
NewsTools.search_crypto_news, | |
SentimentTools.analyze_sentiment | |
] | |
) | |
def technical_analyst(self): | |
return Agent( | |
role='Crypto Technical Analyst', | |
goal="Analyze cryptocurrency price patterns and provide technical insights", | |
backstory="""You are an expert in technical analysis, specializing in cryptocurrency markets. Your chart reading skills and understanding of technical indicators are unparalleled.""", | |
verbose=True, | |
llm=self.llm, | |
tools=[ | |
CryptoTools.get_crypto_price, | |
CryptoTools.calculate_rsi, | |
CryptoTools.calculate_moving_average | |
] | |
) | |
def crypto_advisor(self): | |
return Agent( | |
role='Cryptocurrency Investment Advisor', | |
goal="Provide comprehensive investment advice for cryptocurrency portfolios", | |
backstory="""You are a trusted cryptocurrency investment advisor with a deep understanding of blockchain technology, market dynamics, and risk management in the crypto space.""", | |
verbose=True, | |
llm=self.llm, | |
tools=[ | |
CryptoTools.get_crypto_price, | |
CryptoTools.get_market_cap, | |
NewsTools.search_crypto_news, | |
SentimentTools.analyze_sentiment | |
] | |
) |