Update summarizer.py
Browse files- summarizer.py +4 -0
summarizer.py
CHANGED
|
@@ -3,6 +3,8 @@ from typing import Callable
|
|
| 3 |
from crewai import Agent, Task, Crew, Process
|
| 4 |
from crewai_tools import tool
|
| 5 |
from langchain_community.vectorstores import Chroma
|
|
|
|
|
|
|
| 6 |
|
| 7 |
class PatientChartSummarizer:
|
| 8 |
"""
|
|
@@ -11,6 +13,7 @@ class PatientChartSummarizer:
|
|
| 11 |
"""
|
| 12 |
def __init__(self, vectordb: Chroma):
|
| 13 |
self.vectordb = vectordb
|
|
|
|
| 14 |
|
| 15 |
@tool("patient_chart_search")
|
| 16 |
def patient_chart_search(query: str) -> str:
|
|
@@ -28,6 +31,7 @@ class PatientChartSummarizer:
|
|
| 28 |
"You coordinate information extraction for diagnoses, procedures, labs, vitals, and medications, "
|
| 29 |
"then synthesize a clear, clinically relevant chart summary."
|
| 30 |
),
|
|
|
|
| 31 |
)
|
| 32 |
|
| 33 |
self.summary_task = Task(
|
|
|
|
| 3 |
from crewai import Agent, Task, Crew, Process
|
| 4 |
from crewai_tools import tool
|
| 5 |
from langchain_community.vectorstores import Chroma
|
| 6 |
+
from langchain_openai import ChatOpenAI
|
| 7 |
+
|
| 8 |
|
| 9 |
class PatientChartSummarizer:
|
| 10 |
"""
|
|
|
|
| 13 |
"""
|
| 14 |
def __init__(self, vectordb: Chroma):
|
| 15 |
self.vectordb = vectordb
|
| 16 |
+
self.model = ChatOpenAI(model="gpt-4o", temperature=0, max_new_tokens=10000)
|
| 17 |
|
| 18 |
@tool("patient_chart_search")
|
| 19 |
def patient_chart_search(query: str) -> str:
|
|
|
|
| 31 |
"You coordinate information extraction for diagnoses, procedures, labs, vitals, and medications, "
|
| 32 |
"then synthesize a clear, clinically relevant chart summary."
|
| 33 |
),
|
| 34 |
+
llm=self.model
|
| 35 |
)
|
| 36 |
|
| 37 |
self.summary_task = Task(
|