Huggingface Tools that supporting text I/O can be
loaded directly using the load_huggingface_tool
function.
Copy
Ask AI
# Requires transformers>=4.29.0 and huggingface_hub>=0.14.1
%pip install -qU transformers huggingface_hub > /dev/null
Copy
Ask AI
%pip install -qU langchain-community
Copy
Ask AI
from langchain_community.agent_toolkits.load_tools import load_huggingface_tool
tool = load_huggingface_tool("lysandre/hf-model-downloads")
print(f"{tool.name}: {tool.description}")
Copy
Ask AI
model_download_counter: This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. It takes the name of the category (such as text-classification, depth-estimation, etc), and returns the name of the checkpoint
Copy
Ask AI
tool.run("text-classification")
Copy
Ask AI
'facebook/bart-large-mnli'