|
|
@ -234,24 +234,14 @@ pip3 install -U swarms
|
|
|
|
Then, you can initialize and use the agent as follows:
|
|
|
|
Then, you can initialize and use the agent as follows:
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
import os
|
|
|
|
from swarms.structs.agent import Agent
|
|
|
|
from swarms import Agent
|
|
|
|
|
|
|
|
from swarm_models import OpenAIChat
|
|
|
|
|
|
|
|
from swarms.prompts.finance_agent_sys_prompt import FINANCIAL_AGENT_SYS_PROMPT
|
|
|
|
from swarms.prompts.finance_agent_sys_prompt import FINANCIAL_AGENT_SYS_PROMPT
|
|
|
|
|
|
|
|
|
|
|
|
# Get the OpenAI API key from the environment variable
|
|
|
|
# Initialize the Financial Analysis Agent with GPT-4o-mini model
|
|
|
|
api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create an instance of the OpenAIChat class
|
|
|
|
|
|
|
|
model = OpenAIChat(
|
|
|
|
|
|
|
|
api_key=api_key, model_name="gpt-4-0613", temperature=0.1
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize the agent
|
|
|
|
|
|
|
|
agent = Agent(
|
|
|
|
agent = Agent(
|
|
|
|
agent_name="Financial-Analysis-Agent",
|
|
|
|
agent_name="Financial-Analysis-Agent",
|
|
|
|
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
|
|
|
|
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
|
|
|
|
llm=model,
|
|
|
|
model_name="gpt-4o-mini",
|
|
|
|
max_loops=1,
|
|
|
|
max_loops=1,
|
|
|
|
autosave=True,
|
|
|
|
autosave=True,
|
|
|
|
dashboard=False,
|
|
|
|
dashboard=False,
|
|
|
@ -270,6 +260,7 @@ response = agent.run(
|
|
|
|
"How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?"
|
|
|
|
"How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
print(response)
|
|
|
|
print(response)
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Advanced Usage
|
|
|
|
## Advanced Usage
|
|
|
|