rakesh-dvg commited on
Commit
b1bd720
·
verified ·
1 Parent(s): 4241f88

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +5 -42
tools.py CHANGED
@@ -1,43 +1,6 @@
1
- from langchain.tools import Tool
2
- from langchain_tavily import TavilySearch
3
- from huggingface_hub import list_models
4
- import random
5
- import os
6
 
7
- search_tool = TavilySearch(tavily_api_key=os.getenv("TAVILY_API_KEY"))
8
-
9
-
10
- def get_weather_info(location: str) -> str:
11
- weather_conditions = [
12
- {"condition": "Rainy", "temp_c": 15},
13
- {"condition": "Clear", "temp_c": 25},
14
- {"condition": "Windy", "temp_c": 20}
15
- ]
16
- data = random.choice(weather_conditions)
17
- return f"Weather in {location}: {data['condition']}, {data['temp_c']}°C"
18
-
19
-
20
- weather_info_tool = Tool(
21
- name="get_weather_info",
22
- func=get_weather_info,
23
- description="Returns dummy weather information for a given location."
24
- )
25
-
26
-
27
- def get_hub_stats(author: str) -> str:
28
- try:
29
- models = list(list_models(author=author, sort="downloads", direction=-1, limit=1))
30
- if models:
31
- model = models[0]
32
- return f"The most downloaded model by {author} is {model.id} with {model.downloads:,} downloads."
33
- else:
34
- return f"No models found for author {author}."
35
- except Exception as e:
36
- return f"Error: {str(e)}"
37
-
38
-
39
- hub_stats_tool = Tool(
40
- name="get_hub_stats",
41
- func=get_hub_stats,
42
- description="Gets the most downloaded model by a Hugging Face author."
43
- )
 
1
+ # tools.py
2
+ # Leave empty or add any utility tools you want to integrate later
 
 
 
3
 
4
+ search_tool = None
5
+ weather_info_tool = None
6
+ hub_stats_tool = None