Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logistics #216

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added playground/demos/logistics/factory_image1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions playground/demos/logistics/logistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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_dotenv()
api_key = os.getenv("OPENAI_API_KEY")

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=3, multi_modal=True
)
quality_control_agent = Agent(
llm=llm, sop=Quality_Control_Agent_Prompt, max_loops=3, multi_modal=True
)
productivity_agent = Agent(
llm=llm, sop=Productivity_Agent_Prompt, max_loops=3, multi_modal=True
)
safety_agent = Agent(
llm=llm, sop=Safety_Agent_Prompt, max_loops=3, multi_modal=True
)
security_agent = Agent(
llm=llm, sop=Security_Agent_Prompt, max_loops=3, multi_modal=True
)
sustainability_agent = Agent(
llm=llm, sop=Sustainability_Agent_Prompt, max_loops=3, multi_modal=True
)
efficiency_agent = Agent(
llm=llm, sop=Efficiency_Agent_Prompt, max_loops=3, 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
)
53 changes: 53 additions & 0 deletions swarms/prompts/logistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

Health_Security_Agent_Prompt = """Conduct a thorough analysis of the factory's working conditions focusing on health and safety standards. Examine the cleanliness
of the workspace, the adequacy of ventilation systems, the appropriate spacing between workstations, and the availability and use of personal
protective equipment by workers. Evaluate the compliance of these aspects with health and safety regulations. Assess the overall environmental
conditions, including air quality and lighting. Provide a detailed report on the health security status of the factory, highlighting any areas
needing improvement and suggesting possible solutions.
"""

Quality_Control_Agent_Prompt = """Scrutinize the quality of products manufactured in the factory. Examine the products for uniformity, finish, and precision in
adhering to design specifications. Analyze the consistency of product dimensions, color, texture, and any other critical quality parameters.
Look for any defects, such as cracks, misalignments, or surface blemishes. Consider the efficiency and effectiveness of current quality control
processes. Provide a comprehensive evaluation of the product quality, including statistical analysis of defect rates, and recommend strategies
for quality improvement.
"""

Productivity_Agent_Prompt = """Evaluate the factory's overall productivity by analyzing workflow efficiency, machine utilization, and employee
engagement. Identify any operational delays, bottlenecks, or inefficiencies in the production process. Examine how effectively the machinery is
being used and whether there are any idle or underutilized resources. Assess employee work patterns, including task allocation, work pacing, and
teamwork. Look for signs of overwork or underutilization of human resources. Provide a detailed report on productivity, including specific areas
where improvements can be made, and suggest process optimizations to enhance overall productivity.
"""

Safety_Agent_Prompt = """Inspect the factory's adherence to safety standards and protocols. Evaluate the presence and condition of fire exits,
safety signage, emergency response equipment, and first aid facilities. Check for clear and unobstructed access to emergency exits. Assess the
visibility and clarity of safety signs and instructions. Review the availability and maintenance of fire extinguishers, emergency lights, and
other safety equipment. Ensure compliance with workplace safety regulations. Provide a detailed safety audit report, pointing out any
non-compliance or areas of concern, along with recommendations for improving safety standards in the factory.
"""

Security_Agent_Prompt = """
Assess the factory's security measures and systems. Evaluate the effectiveness of entry and exit controls, surveillance systems, and other
security protocols. Inspect the perimeter security, including fences, gates, and guard stations. Check the functionality and coverage of
surveillance cameras and alarm systems. Analyze access control measures for both personnel and vehicles. Identify potential security
vulnerabilities or breaches. Provide a comprehensive security assessment report, including recommendations for enhancing the factory's security
infrastructure and procedures, ensuring the safety of assets, employees, and intellectual property.
"""

Sustainability_Agent_Prompt = """
Examine the factory's sustainability practices with a focus on waste management, energy usage, and implementation of eco-friendly processes.
Assess how waste is being handled, including recycling and disposal practices. Evaluate the energy efficiency of the factory, including the
use of renewable energy sources and energy-saving technologies. Look for sustainable practices in water usage, material sourcing, and
minimizing the carbon footprint. Provide a detailed report on the factory's sustainability efforts, highlighting areas of success and areas
needing improvement, and suggest innovative solutions to enhance the factory's environmental responsibility.
"""

Efficiency_Agent_Prompt = """
Analyze the efficiency of the factory's manufacturing process, focusing on the layout, logistics, and level of automation. Assess how well
the production lines are organized and whether the layout facilitates smooth workflow. Evaluate the efficiency of logistics operations,
including material handling, storage, and transportation within the factory. Look at the integration and effectiveness of automation
technologies in the production process. Identify any areas causing delays or inefficiencies. Provide an in-depth analysis of manufacturing
efficiency, offering actionable insights and recommendations for optimizing the layout, logistics, and automation to improve overall operational
efficiency.
"""
Loading