Skip to content

Commit

Permalink
Create pinecone_swarm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kyegomez authored Nov 14, 2024
1 parent 6ad1d54 commit 43d6df7
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pinecone_swarm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Import the AgentRearrange class for coordinating multiple agents
from swarms import AgentRearrange

# Import specialized medical agents for different aspects of patient care
from multi_agent_rag.agents import (
diagnostic_specialist, # Agent for diagnostic analysis
medical_data_extractor, # Agent for extracting medical data
patient_care_coordinator, # Agent for coordinating patient care
specialist_consultant, # Agent for specialist consultation
treatment_planner, # Agent for treatment planning
)

# Import database class for storing and retrieving medical documents
from multi_agent_rag.pinecone_wrapper import PineconeManager

# Initialize the SwarmRouter to coordinate the medical agents
router = AgentRearrange(
name="medical-diagnosis-treatment-swarm",
description="Collaborative medical team for comprehensive patient diagnosis and treatment planning",
max_loops=1, # Limit to one iteration through the agent flow
agents=[
medical_data_extractor, # First agent to extract medical data
diagnostic_specialist, # Second agent to analyze and diagnose
treatment_planner, # Third agent to plan treatment
specialist_consultant, # Fourth agent to provide specialist input
patient_care_coordinator, # Final agent to coordinate care plan
],
# Configure the document storage and retrieval system
memory_system=PineconeManager(api_key="", index_name="", environment="")
# Define the sequential flow of information between agents
flow=f"{medical_data_extractor.agent_name} -> {diagnostic_specialist.agent_name} -> {treatment_planner.agent_name} -> {specialist_consultant.agent_name} -> {patient_care_coordinator.agent_name}",
)

# Example usage
if __name__ == "__main__":
# Run a comprehensive medical analysis task for patient Lucas Brown
router.run(
"Analyze this Lucas Brown's medical data to provide a diagnosis and treatment plan"
)

0 comments on commit 43d6df7

Please sign in to comment.