| Name | Type | Description |
|---|---|---|
search | Optional[str] | Default: NoneFilter based on substrings for repos and their usernames. |
author | Optional[str] | Default: NoneFilter models by an author or organization. |
filter | Optional[str] | Default: None |
sort | Optional[str] | Default: None |
direction | Optional[str] | Default: None |
limit | Optional[int] | Default: 3 |
full | Optional[bool] | Default: None |
config | Optional[bool] | Default: None |
Load model information from Hugging Face Hub, including README content.
This loader interfaces with the Hugging Face Models API to fetch and load model metadata and README files. The API allows you to search and filter models based on specific criteria such as model tags, authors, and more.
API URL: https://huggingface.co/api/models DOC URL: https://huggingface.co/docs/hub/en/api
Examples:
.. code-block:: python
from langchain_community.document_loaders import HuggingFaceModelLoader
# Initialize the loader with search criteria
loader = HuggingFaceModelLoader(search="bert", limit=10)
# Load models
documents = loader.load()
# Iterate through the fetched documents
for doc in documents:
print(doc.page_content) # README content of the model
print(doc.metadata) # Metadata of the model
Filter based on tags.
Property to use when sorting.
Direction in which to sort.
Limit the number of models fetched.
Whether to fetch most model data.
Whether to also fetch the repo config.