ngandugilbert commited on
Commit
212b21f
·
verified ·
1 Parent(s): 4976e37

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. main.py +12 -2
main.py CHANGED
@@ -1,9 +1,19 @@
1
- from smolagents import LiteLLMModel, CodeAgent, WebSearchTool, GradioUI, Tool, ToolCollection
2
 
3
  model = LiteLLMModel(model_id="groq/llama-3.3-70b-versatile")
4
 
5
 
6
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  image_generation_tool = Tool.from_space(
9
  "black-forest-labs/FLUX.1-schnell",
@@ -11,6 +21,6 @@ image_generation_tool = Tool.from_space(
11
  description="Generate an image from a prompt"
12
  )
13
  # with ToolCollection.from_mcp({"url": "http://127.0.0.1:9000/mcp", "transport": "streamable-http"}, trust_remote_code=True) as tool_collection:
14
- agent = CodeAgent(model=model, tools=[WebSearchTool(),image_generation_tool])
15
 
16
  GradioUI(agent).launch()
 
1
+ from smolagents import LiteLLMModel, CodeAgent, WebSearchTool, GradioUI, Tool, ToolCollection, tool
2
 
3
  model = LiteLLMModel(model_id="groq/llama-3.3-70b-versatile")
4
 
5
 
6
 
7
+ @tool
8
+ def weather_tool(city: str)-> str:
9
+ """
10
+ This is a tool to get weather information about a particular city
11
+
12
+ args:
13
+ city: str
14
+ """
15
+
16
+ return f"The current weather in {city} is 25 degrees celsius."
17
 
18
  image_generation_tool = Tool.from_space(
19
  "black-forest-labs/FLUX.1-schnell",
 
21
  description="Generate an image from a prompt"
22
  )
23
  # with ToolCollection.from_mcp({"url": "http://127.0.0.1:9000/mcp", "transport": "streamable-http"}, trust_remote_code=True) as tool_collection:
24
+ agent = CodeAgent(model=model, tools=[WebSearchTool(),image_generation_tool, weather_tool])
25
 
26
  GradioUI(agent).launch()