Gonzalo Lope commited on
Commit
8afb52b
·
1 Parent(s): 6607ca7

added smolagents file

Browse files
Files changed (2) hide show
  1. .gitignore +1 -2
  2. smolagents_test_new.py +13 -0
.gitignore CHANGED
@@ -1,2 +1 @@
1
- .env
2
- smolagents_test_new.py
 
1
+ .env
 
smolagents_test_new.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import login
2
+ from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
3
+ from smolagents.prompts import CODE_SYSTEM_PROMPT
4
+
5
+
6
+
7
+ sys_prompt = CODE_SYSTEM_PROMPT + '\n\n' + "YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."
8
+
9
+ agent = CodeAgent(tools=[DuckDuckGoSearchTool], model=InferenceClientModel())
10
+
11
+
12
+ if __name__ == "__main__":
13
+ agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")