Gonzalo Lope commited on
Commit
ee1ba96
·
1 Parent(s): 3eb5975

fixed imports and added a wikipedia and reverse string tool

Browse files
Files changed (2) hide show
  1. requirements.txt +2 -1
  2. smolagents_test_new.py +12 -3
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  gradio
2
  requests
3
- smolagents
 
 
1
  gradio
2
  requests
3
+ smolagents
4
+ duckduckgo-search
smolagents_test_new.py CHANGED
@@ -1,11 +1,20 @@
1
  from huggingface_hub import login
2
- from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
 
3
 
4
 
5
 
 
 
 
 
 
 
 
 
 
6
 
7
-
8
- agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel())
9
 
10
 
11
  if __name__ == "__main__":
 
1
  from huggingface_hub import login
2
+ from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool, WikipediaSearchTool
3
+ from smolagents import tool
4
 
5
 
6
 
7
+ @tool
8
+ def reverse_string(input_string: str) -> str:
9
+ """This is a tool that given a string, returns the reversed string.
10
+
11
+ Args:
12
+ input_string (str): The string to reverse.
13
+
14
+ """
15
+ return input_string[::-1]
16
 
17
+ agent = CodeAgent(tools=[DuckDuckGoSearchTool(),reverse_string,WikipediaSearchTool()], model=InferenceClientModel())
 
18
 
19
 
20
  if __name__ == "__main__":