|
|
|
@ -203,7 +203,117 @@ response = agent.run("Generate a video of a swarm of fish and then make an image
|
|
|
|
|
print(response)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### Multi-Agent Swarm for Logistics
|
|
|
|
|
- Swarms is a framework designed for real-world deployment here is a demo presenting a fully ready to use Swarm for a vast array of logistics tasks.
|
|
|
|
|
- Swarms is designed to be modular and reliable for real-world deployments.
|
|
|
|
|
- Swarms is the first framework that unleases multi-modal autonomous agents in the real world.
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
from swarms.structs import Agent
|
|
|
|
|
import os
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
from swarms.models import GPT4VisionAPI
|
|
|
|
|
from swarms.prompts.logistics import (
|
|
|
|
|
Health_Security_Agent_Prompt,
|
|
|
|
|
Quality_Control_Agent_Prompt,
|
|
|
|
|
Productivity_Agent_Prompt,
|
|
|
|
|
Safety_Agent_Prompt,
|
|
|
|
|
Security_Agent_Prompt,
|
|
|
|
|
Sustainability_Agent_Prompt,
|
|
|
|
|
Efficiency_Agent_Prompt,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Load ENV
|
|
|
|
|
load_dotenv()
|
|
|
|
|
api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
# GPT4VisionAPI
|
|
|
|
|
llm = GPT4VisionAPI(openai_api_key=api_key)
|
|
|
|
|
|
|
|
|
|
# Image for analysis
|
|
|
|
|
factory_image = "factory_image1.jpg"
|
|
|
|
|
|
|
|
|
|
# Initialize agents with respective prompts
|
|
|
|
|
health_security_agent = Agent(
|
|
|
|
|
llm=llm,
|
|
|
|
|
sop=Health_Security_Agent_Prompt,
|
|
|
|
|
max_loops=1,
|
|
|
|
|
multi_modal=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Quality control agent
|
|
|
|
|
quality_control_agent = Agent(
|
|
|
|
|
llm=llm,
|
|
|
|
|
sop=Quality_Control_Agent_Prompt,
|
|
|
|
|
max_loops=1,
|
|
|
|
|
multi_modal=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Productivity Agent
|
|
|
|
|
productivity_agent = Agent(
|
|
|
|
|
llm=llm,
|
|
|
|
|
sop=Productivity_Agent_Prompt,
|
|
|
|
|
max_loops=1,
|
|
|
|
|
multi_modal=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Initiailize safety agent
|
|
|
|
|
safety_agent = Agent(
|
|
|
|
|
llm=llm, sop=Safety_Agent_Prompt, max_loops=1, multi_modal=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Init the security agent
|
|
|
|
|
security_agent = Agent(
|
|
|
|
|
llm=llm, sop=Security_Agent_Prompt, max_loops=1, multi_modal=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize sustainability agent
|
|
|
|
|
sustainability_agent = Agent(
|
|
|
|
|
llm=llm,
|
|
|
|
|
sop=Sustainability_Agent_Prompt,
|
|
|
|
|
max_loops=1,
|
|
|
|
|
multi_modal=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize efficincy agent
|
|
|
|
|
efficiency_agent = Agent(
|
|
|
|
|
llm=llm,
|
|
|
|
|
sop=Efficiency_Agent_Prompt,
|
|
|
|
|
max_loops=1,
|
|
|
|
|
multi_modal=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Run agents with respective tasks on the same image
|
|
|
|
|
health_analysis = health_security_agent.run(
|
|
|
|
|
"Analyze the safety of this factory", factory_image
|
|
|
|
|
)
|
|
|
|
|
quality_analysis = quality_control_agent.run(
|
|
|
|
|
"Examine product quality in the factory", factory_image
|
|
|
|
|
)
|
|
|
|
|
productivity_analysis = productivity_agent.run(
|
|
|
|
|
"Evaluate factory productivity", factory_image
|
|
|
|
|
)
|
|
|
|
|
safety_analysis = safety_agent.run(
|
|
|
|
|
"Inspect the factory's adherence to safety standards",
|
|
|
|
|
factory_image,
|
|
|
|
|
)
|
|
|
|
|
security_analysis = security_agent.run(
|
|
|
|
|
"Assess the factory's security measures and systems",
|
|
|
|
|
factory_image,
|
|
|
|
|
)
|
|
|
|
|
sustainability_analysis = sustainability_agent.run(
|
|
|
|
|
"Examine the factory's sustainability practices", factory_image
|
|
|
|
|
)
|
|
|
|
|
efficiency_analysis = efficiency_agent.run(
|
|
|
|
|
"Analyze the efficiency of the factory's manufacturing process",
|
|
|
|
|
factory_image,
|
|
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Features 🤖
|
|
|
|
|