Skip to main content
This will help you get started with langchain_huggingface chat models. For detailed documentation of all ChatHuggingFace features and configurations head to the API reference. For a list of models supported by Hugging Face check out this page.

Overview

Integration details

ClassPackageSerializableJS supportDownloadsVersion
ChatHuggingFacelangchain-huggingfacebetaPyPI - DownloadsPyPI - Version

Model features

Tool callingStructured outputImage inputAudio inputVideo inputToken-level streamingNative asyncToken usageLogprobs

Setup

To access Hugging Face models you’ll need to create a Hugging Face account, get an API key, and install the langchain-huggingface integration package.

Credentials

Generate a Hugging Face Access Token and store it as an environment variable: HUGGINGFACEHUB_API_TOKEN.

Installation

ClassPackageSerializableJS supportDownloadsVersion
ChatHuggingFacelangchain-huggingfacePyPI - DownloadsPyPI - Version

Model features

Tool callingStructured outputImage inputAudio inputVideo inputToken-level streamingNative asyncToken usageLogprobs

Setup

To access langchain_huggingface models you’ll need to create a Hugging Face account, get an API key, and install the langchain-huggingface integration package.

Credentials

You’ll need to have a Hugging Face Access Token saved as an environment variable: HUGGINGFACEHUB_API_TOKEN.

Instantiation

You can instantiate a ChatHuggingFace model in two different ways, either from a HuggingFaceEndpoint or from a HuggingFacePipeline.

HuggingFaceEndpoint

Now let’s take advantage of Inference Providers to run the model on specific third-party providers

HuggingFacePipeline

Instantiating with quantization

To run a quantized version of your model, you can specify a bitsandbytes quantization config as follows:
and pass it to the HuggingFacePipeline as a part of its model_kwargs:

Invocation


API reference

For detailed documentation of all ChatHuggingFace features and configurations head to the API reference