Update tools.py
Browse files
tools.py
CHANGED
|
@@ -5,68 +5,6 @@ from langchain.base_language import BaseLanguageModel
|
|
| 5 |
|
| 6 |
from tool import *
|
| 7 |
|
| 8 |
-
def drug_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = None, file_path = None):
|
| 9 |
-
serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
|
| 10 |
-
image_path = image_path
|
| 11 |
-
file_path = file_path
|
| 12 |
-
openai_api_key = api_keys.get("OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
| 13 |
-
chemspace_api_key = api_keys.get("CHEMSPACE_API_KEY") or os.getenv(
|
| 14 |
-
"CHEMSPACE_API_KEY"
|
| 15 |
-
)
|
| 16 |
-
semantic_scholar_api_key = api_keys.get("SEMANTIC_SCHOLAR_API_KEY") or os.getenv(
|
| 17 |
-
"SEMANTIC_SCHOLAR_API_KEY"
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
all_tools = load_tools(
|
| 21 |
-
[
|
| 22 |
-
#"python_repl",
|
| 23 |
-
# "ddg-search",
|
| 24 |
-
"wikipedia",
|
| 25 |
-
"human"
|
| 26 |
-
]
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
all_tools += [
|
| 30 |
-
browseruse(),
|
| 31 |
-
|
| 32 |
-
rag(),
|
| 33 |
-
codewriter(),
|
| 34 |
-
|
| 35 |
-
Query2SMILES(chemspace_api_key),
|
| 36 |
-
Mol2SMILES(chemspace_api_key) ,
|
| 37 |
-
Query2CAS(),
|
| 38 |
-
SMILES2Name(),
|
| 39 |
-
SMILES2SAScore(),
|
| 40 |
-
SMILES2LogP(),
|
| 41 |
-
SMILES2Properties(),
|
| 42 |
-
MolSimilarity(),
|
| 43 |
-
SMILES2Weight(),
|
| 44 |
-
FuncGroups(),
|
| 45 |
-
druglike(),
|
| 46 |
-
ADMETLab(),
|
| 47 |
-
|
| 48 |
-
graphconverter(),
|
| 49 |
-
molgen(),
|
| 50 |
-
|
| 51 |
-
LiteratureSearch(
|
| 52 |
-
llm=llm,
|
| 53 |
-
openai_api_key=openai_api_key,
|
| 54 |
-
semantic_scholar_api_key=semantic_scholar_api_key ),
|
| 55 |
-
]
|
| 56 |
-
|
| 57 |
-
if serp_api_key:
|
| 58 |
-
all_tools += [WebSearch(serp_api_key)
|
| 59 |
-
]
|
| 60 |
-
if image_path is not None:
|
| 61 |
-
all_tools += [Imageanalysis(image_path),
|
| 62 |
-
|
| 63 |
-
]
|
| 64 |
-
if file_path is not None:
|
| 65 |
-
all_tools += [pdfreader(file_path),
|
| 66 |
-
]
|
| 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
|
|
@@ -106,7 +44,7 @@ def drug_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
|
|
| 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 |
]
|
|
@@ -157,7 +95,7 @@ def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
|
|
| 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 |
]
|
|
|
|
| 5 |
|
| 6 |
from tool import *
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def drug_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = r"...", file_path = r"..."):
|
| 9 |
serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
|
| 10 |
image_path = image_path
|
|
|
|
| 44 |
if serp_api_key:
|
| 45 |
all_tools += [WebSearch(serp_api_key)
|
| 46 |
]
|
| 47 |
+
|
| 48 |
if file_path is not None:
|
| 49 |
all_tools += [pdfreader(file_path),
|
| 50 |
]
|
|
|
|
| 95 |
if serp_api_key:
|
| 96 |
all_tools += [WebSearch(serp_api_key)
|
| 97 |
]
|
| 98 |
+
|
| 99 |
if file_path is not None:
|
| 100 |
all_tools += [pdfreader(file_path),
|
| 101 |
]
|