jinysun commited on
Commit
c5b57db
·
verified ·
1 Parent(s): 493ba1e

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +77 -20
tools.py CHANGED
@@ -5,8 +5,7 @@ from langchain.base_language import BaseLanguageModel
5
 
6
  from tool import *
7
 
8
-
9
- def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = r"...", file_path = r"..."):
10
  serp_api_key = api_keys.get("SERP_API_KEY") or os.getenv("SERP_API_KEY")
11
  image_path = image_path
12
  file_path = file_path
@@ -17,22 +16,84 @@ def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
17
  semantic_scholar_api_key = api_keys.get("SEMANTIC_SCHOLAR_API_KEY") or os.getenv(
18
  "SEMANTIC_SCHOLAR_API_KEY"
19
  )
20
-
21
  all_tools = load_tools(
22
  [
23
  #"python_repl",
24
  # "ddg-search",
25
  "wikipedia",
26
- # "human"
27
  ]
28
  )
29
-
30
  all_tools += [
31
- browseruse(openai_api_key),
 
 
 
32
 
33
- rag(openai_api_key),
34
- codewriter(llm=llm ,openai_api_key= openai_api_key),
 
 
 
 
 
 
 
 
 
 
 
35
  graphconverter(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  Query2SMILES(chemspace_api_key),
37
  Mol2SMILES(chemspace_api_key) ,
38
  Query2CAS(),
@@ -47,18 +108,15 @@ def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
47
  acceptor_predictor(),
48
  homolumo_predictor(),
49
  dap_screen(),
50
-
51
  molgen(),
52
  dap_predictor(),
53
-
 
 
 
54
  ]
55
- if semantic_scholar_api_key:
56
- all_tools += [ LiteratureSearch(
57
- llm=llm,
58
- openai_api_key=openai_api_key,
59
- semantic_scholar_api_key=semantic_scholar_api_key ),
60
- ]
61
-
62
  if serp_api_key:
63
  all_tools += [WebSearch(serp_api_key)
64
  ]
@@ -68,7 +126,6 @@ def make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image
68
  ]
69
  if file_path is not None:
70
  all_tools += [pdfreader(file_path),
71
- ]
72
 
73
- return all_tools
74
-
 
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
 
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 make_tools(llm: BaseLanguageModel, api_keys: dict = {}, verbose=True, image_path = None, file_path = None):
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
+ "human"
88
+ ]
89
+ )
90
+
91
+ all_tools += [
92
+ browseruse(),
93
+
94
+ rag(),
95
+ codewriter(),
96
+
97
  Query2SMILES(chemspace_api_key),
98
  Mol2SMILES(chemspace_api_key) ,
99
  Query2CAS(),
 
108
  acceptor_predictor(),
109
  homolumo_predictor(),
110
  dap_screen(),
111
+ graphconverter(),
112
  molgen(),
113
  dap_predictor(),
114
+ LiteratureSearch(
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
  ]
 
126
  ]
127
  if file_path is not None:
128
  all_tools += [pdfreader(file_path),
129
+ ]
130
 
131
+ return all_tools