| | from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, InferenceClientModel, load_tool, tool |
| | import datetime |
| |
|
| | @tool |
| | def get_today_(date) |
| | """return's today's_date""" |
| | return datetime.datetime.now().strftime("%Y-%m-%d") |
| | model = InferenceClientModel( model_id="HuggingFaceH4/zephyr-7b-beta") |
| | tools = [ DuckDuckGoSearchTool(), get_today_date, FinalAnswerTool() ] |
| | agent = CodeAgentmodel=model,(model=model, tools=tools, max_steps=5 ) |
| | response = agent.run( "What is Bitcoin and what is today's date?" ) |
| | print(response) |
| |
|
| | |
| |
|
| |
|
| | |
| | |
| |
|
| | |
| |
|
| | |
| |
|
| |
|
| | |
| |
|
| |
|
| |
|
| |
|
| | GradioUI(agent).launch() |