Docs /Templates/ sinapsis_langchain_readers

HuggingFaceModelLoaderWrapper

sinapsis_langchain_readersLangChaindocumentsdocument_loadingdynamicfiles

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 set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis_langchain_readers==1.0.0
uv pip install sinapsis_langchain_readers==1.0.0
uv add sinapsis_langchain_readers==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
add_document_as_text_packet
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

bool
Optional
Default: false
huggingfacemodelloader_initRequired
__init__Attributes
Required
Default: null
full
typing.Optional[bool]
Optional
Default: null
sort
typing.Optional[str]
Optional
Default: null
limit
typing.Optional[int]
Optional
Default: 3
author
typing.Optional[str]
Optional
Default: null
config
typing.Optional[bool]
Optional
Default: null
filter
typing.Optional[str]
Optional
Default: null
search
typing.Optional[str]
Optional
Default: null
direction
typing.Optional[str]
Optional
Default: null

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
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.

yaml
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: 4000

Inheritance

Immediate parent: sinapsis_langchain_readers.templates.langchain_data_readers.LangChainDataReaderBase

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere