menikev commited on
Commit
aada211
·
verified ·
1 Parent(s): e3ee57f

Update crypto_analysis_agents.py

Browse files
Files changed (1) hide show
  1. crypto_analysis_agents.py +7 -11
crypto_analysis_agents.py CHANGED
@@ -1,32 +1,28 @@
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
- from litellm import completion
8
 
9
  # Import the CrewAI native tool classes
10
  from crypto_tools import CryptoPriceTool, MarketCapTool, RSITool, MovingAverageTool
11
  from news_tools import NewsSearchTool
12
  from sentiment_tools import SentimentTool
13
 
14
-
15
  load_dotenv()
16
  TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
17
 
18
  class CryptoAnalysisAgents:
19
  def __init__(self):
20
- # Use Together AI's fast inference
21
- self.llm = Together(
22
  model="together_ai/meta-llama/Llama-2-7b-chat-hf",
23
- together_api_key=TOGETHER_API_KEY,
 
24
  temperature=0.7,
25
  max_tokens=512,
26
  top_p=0.9
27
  )
28
 
29
-
30
  def market_analyst(self):
31
  return Agent(
32
  role='Crypto Market Analyst',
@@ -66,4 +62,4 @@ class CryptoAnalysisAgents:
66
  CryptoPriceTool(),
67
  SentimentTool()
68
  ]
69
- )
 
1
+ # crypto_analysis_agents.py - CrewAI Native Version (CORRECTED)
2
+ from crewai import Agent, LLM
 
 
3
  import os
4
  from dotenv import load_dotenv
 
5
 
6
  # Import the CrewAI native tool classes
7
  from crypto_tools import CryptoPriceTool, MarketCapTool, RSITool, MovingAverageTool
8
  from news_tools import NewsSearchTool
9
  from sentiment_tools import SentimentTool
10
 
 
11
  load_dotenv()
12
  TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
13
 
14
  class CryptoAnalysisAgents:
15
  def __init__(self):
16
+ # Use CrewAI's LLM class with proper Together AI configuration
17
+ self.llm = LLM(
18
  model="together_ai/meta-llama/Llama-2-7b-chat-hf",
19
+ api_key=TOGETHER_API_KEY,
20
+ base_url="https://api.together.xyz/v1",
21
  temperature=0.7,
22
  max_tokens=512,
23
  top_p=0.9
24
  )
25
 
 
26
  def market_analyst(self):
27
  return Agent(
28
  role='Crypto Market Analyst',
 
62
  CryptoPriceTool(),
63
  SentimentTool()
64
  ]
65
+ )