Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,218 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
+
|
22 |
+
@tool
|
23 |
+
def get_country_capital(country_name:str)-> str:
|
24 |
+
"""A tool that fetches the country's capital
|
25 |
+
Args:
|
26 |
+
country_name: A string representing the country name
|
27 |
+
"""
|
28 |
+
countries = {
|
29 |
+
"Afghanistan" : "Kabul",
|
30 |
+
"Albania" : "Tirana",
|
31 |
+
"Algeria" : "Algiers",
|
32 |
+
"Andorra" : "Andorra la Vella",
|
33 |
+
"Angola" : "Luanda",
|
34 |
+
"Antigua and Barbuda" : "Saint John’s",
|
35 |
+
"Argentina" : "Buenos Aires",
|
36 |
+
"Armenia" : "Yerevan",
|
37 |
+
"Australia" : "Canberra",
|
38 |
+
"Austria" : "Vienna",
|
39 |
+
"Azerbaijan" : "Baku",
|
40 |
+
"The Bahamas" : "Nassau",
|
41 |
+
"Bahrain" : "Manama",
|
42 |
+
"Bangladesh" : "Dhaka",
|
43 |
+
"Barbados" : "Bridgetown",
|
44 |
+
"Belarus" : "Minsk",
|
45 |
+
"Belgium" : "Brussels",
|
46 |
+
"Belize" : "Belmopan",
|
47 |
+
"Benin" : "Porto-Novo",
|
48 |
+
"Bhutan" : "Thimphu",
|
49 |
+
"Bolivia" : "La Paz, Sucre",
|
50 |
+
"Bosnia and Herzegovina" : "Sarajevo",
|
51 |
+
"Botswana" : "Gaborone",
|
52 |
+
"Brazil" : "Brasilia",
|
53 |
+
"Brunei" : "Bandar Seri Begawan",
|
54 |
+
"Bulgaria" : "Sofia",
|
55 |
+
"Burkina Faso" : "Ouagadougou",
|
56 |
+
"Burundi" : "Bujumbura",
|
57 |
+
"Cambodia" : "Phnom Penh",
|
58 |
+
"Cameroon" : "Yaounde",
|
59 |
+
"Canada" : "Ottawa",
|
60 |
+
"Cape Verde" : "Praia",
|
61 |
+
"Central African Republic" : "Bangui",
|
62 |
+
"Chad" : "N’Djamena",
|
63 |
+
"Chile" : "Santiago",
|
64 |
+
"China" : "Beijing",
|
65 |
+
"Colombia" : "Bogota",
|
66 |
+
"Comoros" : "Moroni",
|
67 |
+
"Republic of the Congo": "Brazzaville",
|
68 |
+
"Democratic Republic of the Congo" : "Kinshasa",
|
69 |
+
"Costa Rica" : "San Jose",
|
70 |
+
"Cote d’Ivoire" : "Yamoussoukro",
|
71 |
+
"Croatia" : "Zagreb",
|
72 |
+
"Cuba" : "Havana",
|
73 |
+
"Cyprus" : "Nicosia",
|
74 |
+
"Czech Republic" : "Prague",
|
75 |
+
"Denmark" : "Copenhagen",
|
76 |
+
"Djibouti" : "Djibouti",
|
77 |
+
"Dominica" : "Roseau",
|
78 |
+
"Dominican Republic" : "Santo Domingo",
|
79 |
+
"East Timor" : "Dili",
|
80 |
+
"Ecuador" : "Quito",
|
81 |
+
"Egypt" : "Cairo",
|
82 |
+
"El Salvador" : "San Salvador",
|
83 |
+
"Equatorial Guinea" : "Malabo",
|
84 |
+
"Eritrea" : "Asmara",
|
85 |
+
"Estonia" : "Tallinn",
|
86 |
+
"Ethiopia" : "Addis Ababa",
|
87 |
+
"Fiji" : "Suva",
|
88 |
+
"Finland" : "Helsinki",
|
89 |
+
"France" : "Paris",
|
90 |
+
"Gabon" : "Libreville",
|
91 |
+
"The Gambia" : "Banjul",
|
92 |
+
"Georgia" : "Tbilisi",
|
93 |
+
"Germany" : "Berlin",
|
94 |
+
"Ghana" : "Accra",
|
95 |
+
"Greece" : "Athens",
|
96 |
+
"Grenada" : "Saint George’s",
|
97 |
+
"Guatemala" : "Guatemala City",
|
98 |
+
"Guinea" : "Conakry",
|
99 |
+
"Guinea-Bissau" : "Bissau",
|
100 |
+
"Guyana" : "Georgetown",
|
101 |
+
"Haiti" : "Port-au-Prince",
|
102 |
+
"Honduras" : "Tegucigalpa",
|
103 |
+
"Hungary" : "Budapest",
|
104 |
+
"Iceland" : "Reykjavik",
|
105 |
+
"India" : "New Delhi",
|
106 |
+
"Indonesia" : "Jakarta",
|
107 |
+
"Iran" : "Tehran",
|
108 |
+
"Iraq" : "Baghdad",
|
109 |
+
"Ireland" : "Dublin",
|
110 |
+
"Israel" : "Jerusalem",
|
111 |
+
"Italy" : "Rome",
|
112 |
+
"Jamaica" : "Kingston",
|
113 |
+
"Japan" : "Tokyo",
|
114 |
+
"Jordan" : "Amman",
|
115 |
+
"Kazakhstan" : "Astana",
|
116 |
+
"Kenya" : "Nairobi",
|
117 |
+
"Kiribati" : "Tarawa Atoll",
|
118 |
+
"North Korea" : "Pyongyang",
|
119 |
+
"South Korea" : "Seoul",
|
120 |
+
"Kosovo" : "Pristina",
|
121 |
+
"Kuwait" : "Kuwait City",
|
122 |
+
"Kyrgyzstan" : "Bishkek",
|
123 |
+
"Laos" : "Vientiane",
|
124 |
+
"Latvia" : "Riga",
|
125 |
+
"Lebanon" : "Beirut",
|
126 |
+
"Lesotho" : "Maseru",
|
127 |
+
"Liberia" : "Monrovia",
|
128 |
+
"Libya" : "Tripoli",
|
129 |
+
"Liechtenstein" : "Vaduz",
|
130 |
+
"Lithuania" : "Vilnius",
|
131 |
+
"Luxembourg" : "Luxembourg",
|
132 |
+
"Macedonia" : "Skopje",
|
133 |
+
"Madagascar" : "Antananarivo",
|
134 |
+
"Malawi" : "Lilongwe",
|
135 |
+
"Malaysia" : "Kuala Lumpur",
|
136 |
+
"Maldives" : "Male",
|
137 |
+
"Mali" : "Bamako",
|
138 |
+
"Malta" : "Valletta",
|
139 |
+
"Marshall Islands" : "Majuro",
|
140 |
+
"Mauritania" : "Nouakchott",
|
141 |
+
"Mauritius" : "Port Louis",
|
142 |
+
"Mexico" : "Mexico City",
|
143 |
+
"Federated States of Micronesia" : "Palikir",
|
144 |
+
"Moldova" : "Chisinau",
|
145 |
+
"Monaco" : "Monaco",
|
146 |
+
"Mongolia" : "Ulaanbaatar",
|
147 |
+
"Montenegro" : "Podgorica",
|
148 |
+
"Morocco" : "Rabat",
|
149 |
+
"Mozambique" : "Maputo",
|
150 |
+
"Myanmar" : "Naypyidaw",
|
151 |
+
"Namibia" : "Windhoek",
|
152 |
+
"Nauru" : "Yaren District",
|
153 |
+
"Nepal" : "Kathmandu",
|
154 |
+
"Netherlands" : "Amsterdam",
|
155 |
+
"New Zealand" : "Wellington",
|
156 |
+
"Nicaragua" : "Managua",
|
157 |
+
"Niger" : "Niamey",
|
158 |
+
"Nigeria" : "Abuja",
|
159 |
+
"Norway" : "Oslo",
|
160 |
+
"Oman" : "Muscat",
|
161 |
+
"Pakistan" : "Islamabad",
|
162 |
+
"Palau" : "Melekeok",
|
163 |
+
"Panama" : "Panama City",
|
164 |
+
"Papua New Guinea" : "Port Moresby",
|
165 |
+
"Paraguay" : "Asuncion",
|
166 |
+
"Peru" : "Lima",
|
167 |
+
"Philippines" : "Manila",
|
168 |
+
"Poland" : "Warsaw",
|
169 |
+
"Portugal" : "Lisbon",
|
170 |
+
"Qatar" : "Doha",
|
171 |
+
"Romania" : "Bucharest",
|
172 |
+
"Russia" : "Moscow",
|
173 |
+
"Rwanda" : "Kigali",
|
174 |
+
"Saint Kitts and Nevis" : "Basseterre",
|
175 |
+
"Saint Lucia" : "Castries",
|
176 |
+
"Saint Vincent and the Grenadines" : "Kingstown",
|
177 |
+
"Samoa" : "Apia",
|
178 |
+
"San Marino" : "San Marino",
|
179 |
+
"Sao Tome and Principe" : "Sao Tome",
|
180 |
+
"Saudi Arabia" : "Riyadh",
|
181 |
+
"Senegal" : "Dakar",
|
182 |
+
"Serbia" : "Belgrade",
|
183 |
+
"Seychelles" : "Victoria",
|
184 |
+
"Sierra Leone" : "Freetown",
|
185 |
+
"Singapore" : "Singapore",
|
186 |
+
"Slovakia" : "Bratislava",
|
187 |
+
"Slovenia" : "Ljubljana",
|
188 |
+
"Solomon Islands" : "Honiara",
|
189 |
+
"Somalia" : "Mogadishu",
|
190 |
+
"South Africa" : "Pretoria, Cape Town, Bloemfontein",
|
191 |
+
"South Sudan" : "Juba",
|
192 |
+
"Spain" : "Madrid",
|
193 |
+
"Sri Lanka" : "Colombo, Sri Jayewardenepura Kotte",
|
194 |
+
"Sudan" : "Khartoum",
|
195 |
+
"Suriname" : "Paramaribo",
|
196 |
+
"Swaziland" : "Mbabane",
|
197 |
+
"Sweden" : "Stockholm",
|
198 |
+
"Switzerland" : "Bern",
|
199 |
+
"Syria" : "Damascus",
|
200 |
+
"Taiwan" : "Taipei",
|
201 |
+
"Tajikistan" : "Dushanbe",
|
202 |
+
"Tanzania" : "Dodoma",
|
203 |
+
"Thailand" : "Bangkok",
|
204 |
+
"Togo" : "Lome",
|
205 |
+
"Tonga" : "Nuku’alofa",
|
206 |
+
"Trinidad and Tobago" : "Port-of-Spain",
|
207 |
+
"Tunisia" : "Tunis",
|
208 |
+
"Turkey" : "Ankara",
|
209 |
+
"Turkmenistan" : "Ashgabat",
|
210 |
+
"Tuvalu" : "Funafuti",
|
211 |
+
"Uganda" : "Kampala",
|
212 |
+
"Ukraine" : "Kyiv",
|
213 |
+
"United Arab Emirates" : "Abu Dhabi",
|
214 |
+
"United Kingdom" : "London",
|
215 |
+
"United States of America" : "Washington D.C.",
|
216 |
+
"Uruguay" : "Montevideo",
|
217 |
+
"Uzbekistan" : "Tashkent",
|
218 |
+
"Vanuatu" : "Port-Vila",
|
219 |
+
"Vatican City" : "Vatican City",
|
220 |
+
"Venezuela" : "Caracas",
|
221 |
+
"Vietnam" : "Hanoi",
|
222 |
+
"Yemen" : "Sanaa",
|
223 |
+
"Zambia" : "Lusaka",
|
224 |
+
"Zimbabwe" : "Harare"
|
225 |
+
}
|
226 |
+
|
227 |
+
capital = countries.get(country_name)
|
228 |
+
if not capital:
|
229 |
+
return f"Cannot find the capital of {country_name} Try to enter the name correct"
|
230 |
+
return f"The Capital of {country_name} is {capital}"
|
231 |
+
|
232 |
+
|
233 |
@tool
|
234 |
def get_current_time_in_timezone(timezone: str) -> str:
|
235 |
"""A tool that fetches the current local time in a specified timezone.
|