Spaces:
Configuration error
Configuration error
Upload scripts/register_tools.py with huggingface_hub
Browse files- scripts/register_tools.py +31 -0
scripts/register_tools.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
# This script would normally interact with the Hermes internal API or config
|
| 5 |
+
# For this deployment, we'll ensure the personality and instructions mention these tools
|
| 6 |
+
|
| 7 |
+
def update_instructions():
|
| 8 |
+
instructions_path = os.path.expanduser("~/.hermes/instructions.md")
|
| 9 |
+
os.makedirs(os.path.dirname(instructions_path), exist_ok=True)
|
| 10 |
+
|
| 11 |
+
tools_desc = """
|
| 12 |
+
# Integrated Free APIs
|
| 13 |
+
You have direct access to over 30 free and unlimited APIs from GitHub collections.
|
| 14 |
+
Use the `execute_code` tool to call these APIs using the `scripts/free_apis_tool.py` module.
|
| 15 |
+
|
| 16 |
+
Available APIs:
|
| 17 |
+
- weather, cat_fact, dog_fact, joke, ip_info, bitcoin_price, agify, genderize, nationalize, bored, random_user, country_info, dictionary, university_list, zip_code, quote, anime_quote, pokemon, space_news, art_institute_chicago, cocktail, meal, advice, binary, data_usa, ghibli, holiday, open_library, skyscanner, world_bank, nasa, wallhaven, coingecko, binance, exchange_rate.
|
| 18 |
+
|
| 19 |
+
Example usage in Python:
|
| 20 |
+
```python
|
| 21 |
+
from scripts.free_apis_tool import call_free_api
|
| 22 |
+
result = call_free_api('weather', params={'latitude': 40.71, 'longitude': -74.01})
|
| 23 |
+
print(result)
|
| 24 |
+
```
|
| 25 |
+
"""
|
| 26 |
+
with open(instructions_path, "w") as f:
|
| 27 |
+
f.write(tools_desc)
|
| 28 |
+
print("Instructions updated with free APIs.")
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
update_instructions()
|