original tools
Browse files
app.py
CHANGED
|
@@ -14,18 +14,10 @@ from medrax.agent import *
|
|
| 14 |
from medrax.tools import *
|
| 15 |
from medrax.utils import *
|
| 16 |
|
| 17 |
-
from huggingface_hub import login
|
| 18 |
-
import os
|
| 19 |
-
|
| 20 |
warnings.filterwarnings("ignore")
|
| 21 |
logging.set_verbosity_error()
|
| 22 |
_ = load_dotenv()
|
| 23 |
|
| 24 |
-
|
| 25 |
-
hf_token = os.getenv("HUGGINGFACE_TOKEN")
|
| 26 |
-
if hf_token:
|
| 27 |
-
login(token=hf_token)
|
| 28 |
-
|
| 29 |
def initialize_agent(
|
| 30 |
prompt_file,
|
| 31 |
tools_to_use=None,
|
|
@@ -38,7 +30,6 @@ def initialize_agent(
|
|
| 38 |
openai_kwargs={}
|
| 39 |
):
|
| 40 |
"""Initialize the MedRAX agent with specified tools and configuration.
|
| 41 |
-
|
| 42 |
Args:
|
| 43 |
prompt_file (str): Path to file containing system prompts
|
| 44 |
tools_to_use (List[str], optional): List of tool names to initialize. If None, all tools are initialized.
|
|
@@ -49,7 +40,6 @@ def initialize_agent(
|
|
| 49 |
temperature (float, optional): Temperature for the model. Defaults to 0.7.
|
| 50 |
top_p (float, optional): Top P for the model. Defaults to 0.95.
|
| 51 |
openai_kwargs (dict, optional): Additional keyword arguments for OpenAI API, such as API key and base URL.
|
| 52 |
-
|
| 53 |
Returns:
|
| 54 |
Tuple[Agent, Dict[str, BaseTool]]: Initialized agent and dictionary of tool instances
|
| 55 |
"""
|
|
@@ -111,9 +101,9 @@ if __name__ == "__main__":
|
|
| 111 |
"ChestXRaySegmentationTool",
|
| 112 |
"ChestXRayReportGeneratorTool",
|
| 113 |
"XRayVQATool",
|
|
|
|
| 114 |
# "XRayPhraseGroundingTool",
|
| 115 |
# "ChestXRayGeneratorTool",
|
| 116 |
-
# "LlavaMedTool",
|
| 117 |
]
|
| 118 |
|
| 119 |
# Collect the ENV variables
|
|
|
|
| 14 |
from medrax.tools import *
|
| 15 |
from medrax.utils import *
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
warnings.filterwarnings("ignore")
|
| 18 |
logging.set_verbosity_error()
|
| 19 |
_ = load_dotenv()
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def initialize_agent(
|
| 22 |
prompt_file,
|
| 23 |
tools_to_use=None,
|
|
|
|
| 30 |
openai_kwargs={}
|
| 31 |
):
|
| 32 |
"""Initialize the MedRAX agent with specified tools and configuration.
|
|
|
|
| 33 |
Args:
|
| 34 |
prompt_file (str): Path to file containing system prompts
|
| 35 |
tools_to_use (List[str], optional): List of tool names to initialize. If None, all tools are initialized.
|
|
|
|
| 40 |
temperature (float, optional): Temperature for the model. Defaults to 0.7.
|
| 41 |
top_p (float, optional): Top P for the model. Defaults to 0.95.
|
| 42 |
openai_kwargs (dict, optional): Additional keyword arguments for OpenAI API, such as API key and base URL.
|
|
|
|
| 43 |
Returns:
|
| 44 |
Tuple[Agent, Dict[str, BaseTool]]: Initialized agent and dictionary of tool instances
|
| 45 |
"""
|
|
|
|
| 101 |
"ChestXRaySegmentationTool",
|
| 102 |
"ChestXRayReportGeneratorTool",
|
| 103 |
"XRayVQATool",
|
| 104 |
+
# "LlavaMedTool",
|
| 105 |
# "XRayPhraseGroundingTool",
|
| 106 |
# "ChestXRayGeneratorTool",
|
|
|
|
| 107 |
]
|
| 108 |
|
| 109 |
# Collect the ENV variables
|