Spaces:
Running
Running
Update crypto_analysis_agents.py
Browse files- crypto_analysis_agents.py +19 -17
crypto_analysis_agents.py
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
|
|
| 1 |
from crewai import Agent
|
| 2 |
-
from langchain_together import ChatTogether, Together
|
| 3 |
-
from langchain_huggingface import HuggingFacePipeline
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, GenerationConfig
|
| 5 |
-
from crypto_tools import get_crypto_price, get_market_cap, calculate_rsi, calculate_moving_average
|
| 6 |
-
from news_tools import search_crypto_news
|
| 7 |
-
from sentiment_tools import analyze_sentiment
|
| 8 |
import os
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
|
|
|
| 13 |
TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
|
| 14 |
|
| 15 |
class CryptoAnalysisAgents:
|
| 16 |
def __init__(self):
|
| 17 |
-
# Use Together AI's fast inference
|
| 18 |
self.llm = Together(
|
| 19 |
-
model="meta-llama/Llama-2-7b-chat-hf",
|
| 20 |
together_api_key=TOGETHER_API_KEY,
|
| 21 |
temperature=0.7,
|
| 22 |
max_tokens=512,
|
|
@@ -28,12 +30,12 @@ class CryptoAnalysisAgents:
|
|
| 28 |
role='Crypto Market Analyst',
|
| 29 |
goal="Provide concise market analysis and insights for cryptocurrencies",
|
| 30 |
backstory="Expert crypto analyst with focus on market trends and news impact",
|
| 31 |
-
verbose=False,
|
| 32 |
llm=self.llm,
|
| 33 |
tools=[
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
]
|
| 38 |
)
|
| 39 |
|
|
@@ -45,9 +47,9 @@ class CryptoAnalysisAgents:
|
|
| 45 |
verbose=False,
|
| 46 |
llm=self.llm,
|
| 47 |
tools=[
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
]
|
| 52 |
)
|
| 53 |
|
|
@@ -59,7 +61,7 @@ class CryptoAnalysisAgents:
|
|
| 59 |
verbose=False,
|
| 60 |
llm=self.llm,
|
| 61 |
tools=[
|
| 62 |
-
|
| 63 |
-
|
| 64 |
]
|
| 65 |
)
|
|
|
|
| 1 |
+
# crypto_analysis_agents.py - CrewAI Native Version
|
| 2 |
from crewai import Agent
|
| 3 |
+
from langchain_together import ChatTogether, Together
|
|
|
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, GenerationConfig
|
|
|
|
|
|
|
|
|
|
| 5 |
import os
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
|
| 8 |
+
# Import the CrewAI native tool classes
|
| 9 |
+
from crypto_tools import CryptoPriceTool, MarketCapTool, RSITool, MovingAverageTool
|
| 10 |
+
from news_tools import NewsSearchTool
|
| 11 |
+
from sentiment_tools import SentimentTool
|
| 12 |
+
|
| 13 |
|
| 14 |
+
load_dotenv()
|
| 15 |
TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
|
| 16 |
|
| 17 |
class CryptoAnalysisAgents:
|
| 18 |
def __init__(self):
|
| 19 |
+
# Use Together AI's fast inference
|
| 20 |
self.llm = Together(
|
| 21 |
+
model="meta-llama/Llama-2-7b-chat-hf",
|
| 22 |
together_api_key=TOGETHER_API_KEY,
|
| 23 |
temperature=0.7,
|
| 24 |
max_tokens=512,
|
|
|
|
| 30 |
role='Crypto Market Analyst',
|
| 31 |
goal="Provide concise market analysis and insights for cryptocurrencies",
|
| 32 |
backstory="Expert crypto analyst with focus on market trends and news impact",
|
| 33 |
+
verbose=False,
|
| 34 |
llm=self.llm,
|
| 35 |
tools=[
|
| 36 |
+
CryptoPriceTool(),
|
| 37 |
+
MarketCapTool(),
|
| 38 |
+
NewsSearchTool()
|
| 39 |
]
|
| 40 |
)
|
| 41 |
|
|
|
|
| 47 |
verbose=False,
|
| 48 |
llm=self.llm,
|
| 49 |
tools=[
|
| 50 |
+
CryptoPriceTool(),
|
| 51 |
+
RSITool(),
|
| 52 |
+
MovingAverageTool()
|
| 53 |
]
|
| 54 |
)
|
| 55 |
|
|
|
|
| 61 |
verbose=False,
|
| 62 |
llm=self.llm,
|
| 63 |
tools=[
|
| 64 |
+
CryptoPriceTool(),
|
| 65 |
+
SentimentTool()
|
| 66 |
]
|
| 67 |
)
|