HuggingFaceModelLoaderWrapper
Python template · sinapsis_langchain_readers.templates.langchain_data_readers
Overview
Dynamic Template to load documents from Langchain document_loaders module The template loads the document either as a Document object in the generic_data field of DataContainer of each string as a TextPacket if add_document_as_text_packet is set as True
HuggingFaceModelLoader — inherited documentation
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 modelInitialize the HuggingFaceModelLoader.
Args: search: Filter based on substrings for repos and their usernames. author: Filter models by an author or organization. filter: Filter based on tags. sort: Property to use when sorting. direction: Direction in which to sort. limit: Limit the number of models fetched. full: Whether to fetch most model data. config: Whether to also fetch the repo config.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis_langchain_readers==1.0.0uv pip install sinapsis_langchain_readers==1.0.0uv add sinapsis_langchain_readers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Whether to add document as text packet or not. huggingfacemodelloader_init search typing.Optional[str]: default: None author typing.Optional[str]: default: None filter typing.Optional[str]: default: None sort… Read full field description
Whether to add document as text packet or not. huggingfacemodelloader_init search typing.Optional[str]: default: None author typing.Optional[str]: default: None filter typing.Optional[str]: default: None sort typing.Optional[str]: default: None direction typing.Optional[str]: default: None limit typing.Optional[int]: default: 3 full typing.Optional[bool]: default: None config typing.Optional[bool]: default: None
Optional
Default: false
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: 3
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "HuggingFaceModelLoaderWrapper"
class_name: "HuggingFaceModelLoaderWrapper"
attributes:
add_document_as_text_packet: false
huggingfacemodelloader_init:
full: null
sort: null
limit: 3
author: null
config: null
filter: null
search: null
direction: null
View original docstring example
The source example references WikipediaLoaderWrapper, not HuggingFaceModelLoaderWrapper.
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: WikipediaLoaderWrapper
class_name: WikipediaLoaderWrapper ## note that because it is a dynamic template,
template_input: InputTemplate ## the class name depends on the actual class that is used.
attributes:
add_document_as_text_packet: false
wikipedialoader_init:
query: the query for wikipedia
lang: en
load_max_docs: 5000
load_all_available_meta: False
doc_content_chars_max: 4000Inheritance
sinapsis_langchain_readers.templates.langchain_data_readers.LangChainDataReaderBaseEnvironment variables
Environment definitions belong to their canonical Python modules.