You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.7 KiB
60 lines
1.7 KiB
from dotenv import load_dotenv
|
|
|
|
from swarms import Agent
|
|
from swarms.prompts.finance_agent_sys_prompt import (
|
|
FINANCIAL_AGENT_SYS_PROMPT,
|
|
)
|
|
|
|
|
|
load_dotenv()
|
|
|
|
tools = [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_stock_price",
|
|
"description": "Retrieve the current stock price and related information for a specified company.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"ticker": {
|
|
"type": "string",
|
|
"description": "The stock ticker symbol of the company, e.g. AAPL for Apple Inc.",
|
|
},
|
|
"include_history": {
|
|
"type": "boolean",
|
|
"description": "Indicates whether to include historical price data along with the current price.",
|
|
},
|
|
"time": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"description": "Optional parameter to specify the time for which the stock data is requested, in ISO 8601 format.",
|
|
},
|
|
},
|
|
"required": [
|
|
"ticker",
|
|
"include_history",
|
|
"time",
|
|
],
|
|
},
|
|
},
|
|
}
|
|
]
|
|
|
|
|
|
# Initialize the agent
|
|
agent = Agent(
|
|
agent_name="Financial-Analysis-Agent",
|
|
agent_description="Personal finance advisor agent",
|
|
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
|
|
max_loops=1,
|
|
tools_list_dictionary=tools,
|
|
output_type="final",
|
|
)
|
|
|
|
out = agent.run(
|
|
"What is the current stock price for Apple Inc. (AAPL)? Include historical price data.",
|
|
)
|
|
|
|
print(type(out))
|