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.
swarms/example.py

46 lines
1.3 KiB

4 days ago
import os
from swarm_models import OpenAIChat
2 months ago
from swarms import Agent
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
)
4 days ago
from dotenv import load_dotenv
load_dotenv()
# Get the OpenAI API key from the environment variable
api_key = os.getenv("GROQ_API_KEY")
# Model
model = OpenAIChat(
openai_api_base="https://api.groq.com/openai/v1",
openai_api_key=api_key,
model_name="llama-3.1-70b-versatile",
temperature=0.1,
)
4 months ago
5 months ago
# Initialize the agent
agent = Agent(
4 months ago
agent_name="Financial-Analysis-Agent",
3 weeks ago
agent_description="Personal finance advisor agent",
2 weeks ago
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
max_loops=1,
4 days ago
llm=model,
5 months ago
dynamic_temperature_enabled=True,
2 weeks ago
user_name="swarms_corp",
1 month ago
retry_attempts=3,
context_length=8192,
1 month ago
return_step_meta=False,
1 month ago
output_type="str", # "json", "dict", "csv" OR "string" "yaml" and
2 months ago
auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task
max_tokens=4000, # max output tokens
saved_state_path="agent_00.json",
interactive=False,
5 months ago
)
2 months ago
agent.run(
1 month ago
"Create a table of super high growth opportunities for AI. I have $40k to invest in ETFs, index funds, and more. Please create a table in markdown.",
2 months ago
all_cores=True,
5 months ago
)