CindyDelage commited on
Commit
63b8e47
·
verified ·
1 Parent(s): 8bccebf

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +21 -0
tools.py CHANGED
@@ -19,6 +19,27 @@ class Web_research(Tool):
19
  results = search_tool(f"{topic}")
20
  return f"Here is what we can find on the web for {topic} : str({results})"
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  class translate_everything(Tool):
23
  name="translator"
24
  description = "You do not understand a sentence? It does not look like any language you know? Try this tool, maybe the sentence is just reversed!"
 
19
  results = search_tool(f"{topic}")
20
  return f"Here is what we can find on the web for {topic} : str({results})"
21
 
22
+ class Find_wikipedia_URL(Tool):
23
+ name="wiki_url"
24
+ description = "Always use to check a wikipedia ENGLISH URL page before trying to acces the URL. For another langage, you just have to change the beginning of the url (here, it is en for english)"
25
+ inputs = {
26
+ "subject": {
27
+ "type": "string",
28
+ "description": "The name or topic on which you want the Wikipedia URL"
29
+ }
30
+ }
31
+ output_type = "string"
32
+
33
+ def forward(self, subject: str):
34
+ words=subject.split()
35
+ url_wiki="https://en.wikipedia.org/wiki/"
36
+ for i in range(len(words)):
37
+ if(i==0):
38
+ url_wiki+=str(words[i])
39
+ if(i!=0):
40
+ url_wiki+='_'+str(words[i])
41
+ return f"Here is what we url to use : str({url_wiki}). If it does not work, change the first letters of {subject} to be upper or lower, but never change anything else"
42
+
43
  class translate_everything(Tool):
44
  name="translator"
45
  description = "You do not understand a sentence? It does not look like any language you know? Try this tool, maybe the sentence is just reversed!"