menikev commited on
Commit
514fa3b
·
verified ·
1 Parent(s): 457dad0

Update crypto_analysis_agents.py

Browse files
Files changed (1) hide show
  1. crypto_analysis_agents.py +12 -17
crypto_analysis_agents.py CHANGED
@@ -2,9 +2,9 @@ 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 CryptoTools
6
- from news_tools import NewsTools
7
- from sentiment_tools import SentimentTools
8
  import os
9
  from dotenv import load_dotenv
10
 
@@ -17,16 +17,11 @@ class CryptoAnalysisAgents:
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, # Use the loaded variable
21
  temperature=0.7,
22
  max_tokens=512,
23
  top_p=0.9
24
  )
25
-
26
- # Initialize tools once to avoid repeated loading
27
- self.crypto_tools = CryptoTools()
28
- self.news_tools = NewsTools()
29
- self.sentiment_tools = SentimentTools()
30
 
31
  def market_analyst(self):
32
  return Agent(
@@ -36,9 +31,9 @@ class CryptoAnalysisAgents:
36
  verbose=False, # Reduce verbosity for speed
37
  llm=self.llm,
38
  tools=[
39
- self.crypto_tools.get_crypto_price,
40
- self.crypto_tools.get_market_cap,
41
- self.news_tools.search_crypto_news
42
  ]
43
  )
44
 
@@ -50,9 +45,9 @@ class CryptoAnalysisAgents:
50
  verbose=False,
51
  llm=self.llm,
52
  tools=[
53
- self.crypto_tools.get_crypto_price,
54
- self.crypto_tools.calculate_rsi,
55
- self.crypto_tools.calculate_moving_average
56
  ]
57
  )
58
 
@@ -64,7 +59,7 @@ class CryptoAnalysisAgents:
64
  verbose=False,
65
  llm=self.llm,
66
  tools=[
67
- self.crypto_tools.get_crypto_price,
68
- self.sentiment_tools.analyze_sentiment
69
  ]
70
  )
 
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
 
 
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,
23
  top_p=0.9
24
  )
 
 
 
 
 
25
 
26
  def market_analyst(self):
27
  return Agent(
 
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
  verbose=False,
46
  llm=self.llm,
47
  tools=[
48
+ get_crypto_price,
49
+ calculate_rsi,
50
+ calculate_moving_average
51
  ]
52
  )
53
 
 
59
  verbose=False,
60
  llm=self.llm,
61
  tools=[
62
+ get_crypto_price,
63
+ analyze_sentiment
64
  ]
65
  )