-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from crewai import Agent | ||
from .tools import scrape_tool, search_tool | ||
from langchain_google_genai import ChatGoogleGenerativeAI | ||
import os | ||
import settings | ||
|
||
llm=ChatGoogleGenerativeAI(model=settings.GEMINI_FLASH, | ||
verbose=True, | ||
temperature=0.7, | ||
google_api_key=os.getenv("GOOGLE_API_KEY")) | ||
|
||
|
||
diagnostician = Agent( | ||
role="Medical Diagnostician", | ||
goal="Analyze patient symptoms and medical history to provide a preliminary diagnosis.", | ||
backstory="This agent specializes in diagnosing medical conditions based on patient-reported symptoms and medical history. It uses advanced algorithms and medical knowledge to identify potential health issues.", | ||
verbose=True, | ||
allow_delegation=False, | ||
tools=[search_tool, scrape_tool], | ||
llm=llm | ||
) | ||
|
||
treatment_advisor = Agent( | ||
role="Treatment Advisor", | ||
goal="Recommend appropriate treatment plans based on the diagnosis provided by the Medical Diagnostician.", | ||
backstory="This agent specializes in creating treatment plans tailored to individual patient needs. It considers the diagnosis, patient history, and current best practices in medicine to recommend effective treatments.", | ||
verbose=True, | ||
allow_delegation=False, | ||
tools=[search_tool, scrape_tool], | ||
llm=llm | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from crewai import Crew | ||
from .agents import treatment_advisor, diagnostician | ||
from .tasks import diagnose_task, treatment_task | ||
|
||
|
||
doc_crew = Crew( | ||
agents=[diagnostician, treatment_advisor], | ||
tasks=[diagnose_task, treatment_task], | ||
verbose=2 | ||
) | ||
|
||
def run_doc_crew(input_data): | ||
result = doc_crew.kickoff(inputs=input_data) | ||
return result | ||
|
||
if __name__=='__main__': | ||
doc_agent_input ={ | ||
'gender': 'Male', | ||
'age': '28', | ||
'symptoms': 'fever, cough, headache', | ||
'medical_history': 'diabetes, hypertension' | ||
} | ||
print(run_doc_crew(input_data=doc_agent_input)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from crewai import Task | ||
from .agents import diagnostician, treatment_advisor | ||
|
||
|
||
diagnose_task = Task( | ||
description=( | ||
"1. Analyze the patient's symptoms ({symptoms}) and medical history ({medical_history}).\n" | ||
"2. Provide a preliminary diagnosis with possible conditions based on the provided information.\n" | ||
"3. Limit the diagnosis to the most likely conditions." | ||
), | ||
expected_output="A preliminary diagnosis with a list of possible conditions.", | ||
agent=diagnostician | ||
) | ||
|
||
treatment_task = Task( | ||
description=( | ||
"1. Based on the diagnosis, recommend appropriate treatment plans step by step.\n" | ||
"2. Consider the patient's medical history ({medical_history}) and current symptoms ({symptoms}).\n" | ||
"3. Provide detailed treatment recommendations, including medications, lifestyle changes, and follow-up care." | ||
), | ||
expected_output="A comprehensive treatment plan tailored to the patient's needs.", | ||
agent=treatment_advisor | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from crewai_tools import ScrapeWebsiteTool, SerperDevTool | ||
import os | ||
from dotenv import load_dotenv | ||
load_dotenv() | ||
|
||
os.environ['SERPER_API_KEY'] = os.getenv('SERPER_API_KEY') | ||
|
||
search_tool = SerperDevTool() | ||
scrape_tool = ScrapeWebsiteTool() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters