Update tools.py
Browse files
tools.py
CHANGED
|
@@ -67,65 +67,99 @@ def drug_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
|
|
| 67 |
|
| 68 |
return all_tools
|
| 69 |
|
| 70 |
-
def
|
| 71 |
serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
|
| 72 |
image_path = image_path
|
| 73 |
file_path = file_path
|
| 74 |
-
openai_api_key = api_keys.get("OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
| 75 |
-
chemspace_api_key = api_keys.get("CHEMSPACE_API_KEY") or os.getenv(
|
| 76 |
-
"CHEMSPACE_API_KEY"
|
| 77 |
-
)
|
| 78 |
semantic_scholar_api_key = api_keys.get("SEMANTIC_SCHOLAR_API_KEY") or os.getenv(
|
| 79 |
"SEMANTIC_SCHOLAR_API_KEY"
|
| 80 |
)
|
| 81 |
-
|
| 82 |
all_tools = load_tools(
|
| 83 |
[
|
| 84 |
#"python_repl",
|
| 85 |
# "ddg-search",
|
| 86 |
"wikipedia",
|
| 87 |
-
|
| 88 |
]
|
| 89 |
)
|
| 90 |
-
|
| 91 |
all_tools += [
|
| 92 |
-
browseruse(),
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
Query2SMILES(chemspace_api_key),
|
| 98 |
Mol2SMILES(chemspace_api_key) ,
|
| 99 |
Query2CAS(),
|
| 100 |
-
SMILES2Name(),
|
| 101 |
-
SMILES2SAScore(),
|
| 102 |
-
SMILES2LogP(),
|
| 103 |
-
SMILES2Properties(),
|
| 104 |
-
MolSimilarity(),
|
| 105 |
-
SMILES2Weight(),
|
| 106 |
-
FuncGroups(),
|
| 107 |
-
donor_predictor(),
|
| 108 |
acceptor_predictor(),
|
| 109 |
homolumo_predictor(),
|
| 110 |
dap_screen(),
|
| 111 |
-
|
| 112 |
molgen(),
|
| 113 |
dap_predictor(),
|
| 114 |
-
|
| 115 |
-
llm=llm,
|
| 116 |
-
openai_api_key=openai_api_key,
|
| 117 |
-
semantic_scholar_api_key=semantic_scholar_api_key ),
|
| 118 |
]
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
if serp_api_key:
|
| 121 |
all_tools += [WebSearch(serp_api_key)
|
| 122 |
]
|
| 123 |
-
if image_path is not None:
|
| 124 |
-
all_tools += [Imageanalysis(image_path),
|
| 125 |
-
|
| 126 |
]
|
| 127 |
if file_path is not None:
|
| 128 |
all_tools += [pdfreader(file_path),
|
| 129 |
-
]
|
| 130 |
|
| 131 |
return all_tools
|
|
|
|
| 67 |
|
| 68 |
return all_tools
|
| 69 |
|
| 70 |
+
def drug_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = r"...", file_path = r"..."):
|
| 71 |
serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
|
| 72 |
image_path = image_path
|
| 73 |
file_path = file_path
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
semantic_scholar_api_key = api_keys.get("SEMANTIC_SCHOLAR_API_KEY") or os.getenv(
|
| 75 |
"SEMANTIC_SCHOLAR_API_KEY"
|
| 76 |
)
|
| 77 |
+
|
| 78 |
all_tools = load_tools(
|
| 79 |
[
|
| 80 |
#"python_repl",
|
| 81 |
# "ddg-search",
|
| 82 |
"wikipedia",
|
| 83 |
+
"human"
|
| 84 |
]
|
| 85 |
)
|
| 86 |
+
|
| 87 |
all_tools += [
|
| 88 |
+
browseruse(openai_api_key),
|
| 89 |
+
rag(openai_api_key),
|
| 90 |
+
codewriter(llm=llm ,openai_api_key= openai_api_key),
|
| 91 |
+
graphconverter(),
|
| 92 |
+
Query2SMILES(chemspace_api_key),
|
| 93 |
+
Mol2SMILES(chemspace_api_key) ,
|
| 94 |
+
Query2CAS(),
|
| 95 |
+
druglike(),
|
| 96 |
+
ADMETLab(),
|
| 97 |
+
|
| 98 |
+
]
|
| 99 |
+
# if semantic_scholar_api_key:
|
| 100 |
+
# all_tools += [ LiteratureSearch(
|
| 101 |
+
# llm=llm,
|
| 102 |
+
# openai_api_key=openai_api_key,
|
| 103 |
+
# semantic_scholar_api_key=semantic_scholar_api_key ),
|
| 104 |
+
# ]
|
| 105 |
|
| 106 |
+
if serp_api_key:
|
| 107 |
+
all_tools += [WebSearch(serp_api_key)
|
| 108 |
+
]
|
| 109 |
+
]
|
| 110 |
+
if file_path is not None:
|
| 111 |
+
all_tools += [pdfreader(file_path),
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
return all_tools
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = r"...", file_path = r"..."):
|
| 118 |
+
serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
|
| 119 |
+
image_path = image_path
|
| 120 |
+
file_path = file_path
|
| 121 |
+
semantic_scholar_api_key = api_keys.get("SEMANTIC_SCHOLAR_API_KEY") or os.getenv(
|
| 122 |
+
"SEMANTIC_SCHOLAR_API_KEY"
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
all_tools = load_tools(
|
| 126 |
+
[
|
| 127 |
+
#"python_repl",
|
| 128 |
+
# "ddg-search",
|
| 129 |
+
"wikipedia",
|
| 130 |
+
"human"
|
| 131 |
+
]
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
all_tools += [
|
| 135 |
+
browseruse(openai_api_key),
|
| 136 |
+
rag(openai_api_key),
|
| 137 |
+
codewriter(llm=llm ,openai_api_key= openai_api_key),
|
| 138 |
+
graphconverter(),
|
| 139 |
Query2SMILES(chemspace_api_key),
|
| 140 |
Mol2SMILES(chemspace_api_key) ,
|
| 141 |
Query2CAS(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
acceptor_predictor(),
|
| 143 |
homolumo_predictor(),
|
| 144 |
dap_screen(),
|
| 145 |
+
|
| 146 |
molgen(),
|
| 147 |
dap_predictor(),
|
| 148 |
+
|
|
|
|
|
|
|
|
|
|
| 149 |
]
|
| 150 |
+
# if semantic_scholar_api_key:
|
| 151 |
+
# all_tools += [ LiteratureSearch(
|
| 152 |
+
# llm=llm,
|
| 153 |
+
# openai_api_key=openai_api_key,
|
| 154 |
+
# semantic_scholar_api_key=semantic_scholar_api_key ),
|
| 155 |
+
# ]
|
| 156 |
+
|
| 157 |
if serp_api_key:
|
| 158 |
all_tools += [WebSearch(serp_api_key)
|
| 159 |
]
|
|
|
|
|
|
|
|
|
|
| 160 |
]
|
| 161 |
if file_path is not None:
|
| 162 |
all_tools += [pdfreader(file_path),
|
| 163 |
+
]
|
| 164 |
|
| 165 |
return all_tools
|