@ -131,6 +131,13 @@ The `run` method is the primary entry point for executing tasks with an `Agent`
```python
```python
from swarms import Agent
from swarms import Agent
from swarms.models import OpenAIChat
model = OpenAIChat(
openai_api_key="your-api-key",
model_name="gpt-4o-mini",
temperature=0.1
)
agent = Agent(
agent = Agent(
agent_name="Stock-Analysis-Agent",
agent_name="Stock-Analysis-Agent",
@ -168,7 +175,7 @@ The `Agent` class offers a range of settings to tailor its behavior to specific
```python
```python
import os
import os
from swarms import Agent
from swarms import Agent
from swarm_models import OpenAIChat
from swarms.models import OpenAIChat
from swarms.prompts.finance_agent_sys_prompt import (
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
FINANCIAL_AGENT_SYS_PROMPT,
@ -231,7 +238,7 @@ graph TD
```python
```python
import os
import os
from swarms_memory import ChromaDB
from swarms.memory import ChromaDB
# Initialize the ChromaDB client for long-term memory management
# Initialize the ChromaDB client for long-term memory management
chromadb = ChromaDB(
chromadb = ChromaDB(
@ -243,7 +250,7 @@ chromadb = ChromaDB(
**Step 2: Define the Model**
**Step 2: Define the Model**
```python
```python
from swarm_models import Anthropic
from swarms.models import Anthropic
from swarms.prompts.finance_agent_sys_prompt import (
from swarms.prompts.finance_agent_sys_prompt import (
FINANCIAL_AGENT_SYS_PROMPT,
FINANCIAL_AGENT_SYS_PROMPT,
)
)
@ -378,7 +385,7 @@ The following is an example of an agent that intakes a pydantic basemodel and ou
```python
```python
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field
from swarms import Agent
from swarms import Agent
from swarm_models import Anthropic
from swarms.models import OpenAIChat
# Initialize the schema for the person's information
# Initialize the schema for the person's information
@ -410,7 +417,11 @@ agent = Agent(
),
),
# Set the tool schema to the JSON string -- this is the key difference
# Set the tool schema to the JSON string -- this is the key difference
tool_schema=tool_schema,
tool_schema=tool_schema,
llm=Anthropic(),
llm=OpenAIChat(
openai_api_key="your-api-key",
model_name="gpt-4o",
temperature=0.1
),
max_loops=3,
max_loops=3,
autosave=True,
autosave=True,
dashboard=False,
dashboard=False,
@ -442,6 +453,7 @@ Run the agent with multiple modalities useful for various real-world tasks in ma
import os
import os
from dotenv import load_dotenv
from dotenv import load_dotenv
from swarms import Agent
from swarms import Agent
from swarms.models import OpenAIChat
from swarm_models import GPT4VisionAPI
from swarm_models import GPT4VisionAPI
@ -450,7 +462,7 @@ load_dotenv()
# Initialize the language model
# Initialize the language model
llm = GPT4VisionAPI(
llm = OpenAIChat(
openai_api_key=os.environ.get("OPENAI_API_KEY"),
openai_api_key=os.environ.get("OPENAI_API_KEY"),
max_tokens=500,
max_tokens=500,
)
)
@ -552,7 +564,7 @@ Steps:
For example, here's an example on how to create an agent from griptape.
For example, here's an example on how to create an agent from griptape.
Here’s how you can create a custom **Griptape** agent that integrates with the **Swarms** framework by inheriting from the `Agent` class in **Swarms** and overriding the `run(task: str) -> str` method.
Here's how you can create a custom **Griptape** agent that integrates with the **Swarms** framework by inheriting from the `Agent` class in **Swarms** and overriding the `run(task: str) -> str` method.
```python
```python
@ -694,7 +706,7 @@ In this example, each `Agent` represents a task that is executed sequentially. T
```python
```python
import os
import os
from swarms import Agent, SequentialWorkflow
from swarms import Agent, SequentialWorkflow
from swarm_models import OpenAIChat
from swarms.models import OpenAIChat
# model = Anthropic(anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"))
# model = Anthropic(anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"))
company = "Nvidia"
company = "Nvidia"
@ -911,7 +923,7 @@ The `run` method returns the final output after all agents have processed the in
from swarms import Agent, AgentRearrange
from swarms import Agent, AgentRearrange
from swarm_models import Anthropic
from swarm.models import Anthropic
# Initialize the director agent
# Initialize the director agent
@ -1288,7 +1300,7 @@ The `run` method returns a dictionary containing the outputs of each agent that
```python
```python
import os
import os
from swarms import Agent
from swarms import Agent
from swarm_models import OpenAIChat
from swarms.models import OpenAIChat
from swarms.structs.spreadsheet_swarm import SpreadSheetSwarm
from swarms.structs.spreadsheet_swarm import SpreadSheetSwarm
# Define custom system prompts for each social media platform
# Define custom system prompts for each social media platform
@ -1613,7 +1625,7 @@ The `SwarmRouter` class is a flexible routing system designed to manage differen
import os
import os
from dotenv import load_dotenv
from dotenv import load_dotenv
from swarms import Agent
from swarms import Agent
from swarm_models import OpenAIChat
from swarms.models import OpenAIChat
from swarms.structs.swarm_router import SwarmRouter, SwarmType
from swarms.structs.swarm_router import SwarmRouter, SwarmType