File size: 971 Bytes
8afb52b
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from huggingface_hub import login
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
from smolagents.prompts import CODE_SYSTEM_PROMPT



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."

agent = CodeAgent(tools=[DuckDuckGoSearchTool], model=InferenceClientModel())


if __name__ == "__main__":
    agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")