menikev commited on
Commit
475ab32
·
verified ·
1 Parent(s): 942ee62

Update crypto_analysis_agents.py

Browse files
Files changed (1) hide show
  1. 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 # <-- Import Together class here
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
- load_dotenv()
 
 
 
 
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 instead of local models
18
  self.llm = Together(
19
- model="meta-llama/Llama-2-7b-chat-hf", # Fast, efficient model
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, # Reduce verbosity for speed
32
  llm=self.llm,
33
  tools=[
34
- get_crypto_price,
35
- get_market_cap,
36
- search_crypto_news
37
  ]
38
  )
39
 
@@ -45,9 +47,9 @@ class CryptoAnalysisAgents:
45
  verbose=False,
46
  llm=self.llm,
47
  tools=[
48
- get_crypto_price,
49
- calculate_rsi,
50
- calculate_moving_average
51
  ]
52
  )
53
 
@@ -59,7 +61,7 @@ class CryptoAnalysisAgents:
59
  verbose=False,
60
  llm=self.llm,
61
  tools=[
62
- get_crypto_price,
63
- analyze_sentiment
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
  )