-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathagents.py
83 lines (76 loc) · 3.18 KB
/
agents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from crewai import Agent
from langchain_nvidia_ai_endpoints import ChatNVIDIA
from tools.browser_tools import ScrapingAnt
from tools.calculator_tools import CalculatorTools
from tools.search_tools import SearchTools
import os
# from langchain.tools.yahoo_finance_news import YahooFinanceNewsTool
from langchain_community.tools import YahooFinanceNewsTool
from dotenv import load_dotenv
load_dotenv()
## call the LLM model
llm=ChatNVIDIA(model="meta/llama3-70b-instruct",
verbose=True,
temperature=0.5,
google_api_key=os.getenv("NVIDIA_API_KEY"),
top_p=0.5,
max_tokens=512,
stream=False
)
class StockAnalysisAgents(object):
def financial_analyst(self):
return Agent(
role='The Best Financial Analyst',
goal="""Impress all customers with your financial data
and market trends analysis""",
backstory="""The most seasoned financial analyst with
lots of expertise in stock market analysis and investment
strategies that is working for a super important customer.""",
verbose=True,
tools=[
ScrapingAnt.scrape_and_summarize_website,
SearchTools.search_internet,
CalculatorTools.calculate,
],
llm=llm,
allow_delegation=True
)
def research_analyst(self):
return Agent(
role='Staff Research Analyst',
goal="""Be the best at gathering and interpreting data, and amaze
your customer with it""",
backstory="""Known as the BEST research analyst, you're
skilled in sifting through news, company announcements,
and market sentiments. Now you're working on a super
important customer""",
verbose=True,
tools=[
ScrapingAnt.scrape_and_summarize_website,
SearchTools.search_internet,
SearchTools.search_news,
YahooFinanceNewsTool()
],
llm=llm,
allow_delegation=True
)
def investment_advisor(self):
return Agent(
role='Private Investment Advisor',
goal="""Impress your customers with thorough analyses of stocks
and complete investment recommendations""",
backstory="""You're the most experienced investment advisor
and you combine various analytical insights to formulate
strategic investment advice. You are now working for
a super important customer you need to impress.""",
verbose=True,
tools=[
ScrapingAnt.scrape_and_summarize_website,
SearchTools.search_internet,
SearchTools.search_news,
CalculatorTools.calculate,
YahooFinanceNewsTool()
],
llm=llm,
allow_delegation=True
)