Hugging Face is an AI platform with all major open source models, datasets, MCPs, and demos. It supplies model inference locally and via serverless Inference Providers. You can use Inference Providers to run open source models like DeepSeek R1 on scalable serverless infrastructure.
Installation
Most of the Hugging Face integrations are available in thelangchain-huggingface
package.
Chat models
ChatHuggingFace
We can use theHugging Face
LLM classes or directly use the ChatHuggingFace
class.
See a usage example.
LLMs
HuggingFaceEndpoint
We can use theHuggingFaceEndpoint
class to run open source models via serverless Inference Providers or via dedicated Inference Endpoints.
See a usage example.
HuggingFacePipeline
We can use theHuggingFacePipeline
class to run open source models locally.
See a usage example.
Embedding Models
HuggingFaceEmbeddings
We can use theHuggingFaceEmbeddings
class to run open source embedding models locally.
See a usage example.
HuggingFaceEndpointEmbeddings
We can use theHuggingFaceEndpointEmbeddings
class to run open source embedding models via a dedicated Inference Endpoint.
See a usage example.
HuggingFaceInferenceAPIEmbeddings
We can use theHuggingFaceInferenceAPIEmbeddings
class to run open source embedding models via Inference Providers.
See a usage example.
HuggingFaceInstructEmbeddings
We can use theHuggingFaceInstructEmbeddings
class to run open source embedding models locally.
See a usage example.
HuggingFaceBgeEmbeddings
BGE models on the HuggingFace are one of the best open-source embedding models.
BGE model is created by the Beijing Academy of Artificial Intelligence (BAAI). BAAI
is a private non-profit organization engaged in AI research and development.
See a usage example.
Document Loaders
Hugging Face dataset
Hugging Face Hub is home to over 75,000 datasets in more than 100 languages that can be used for a broad range of tasks across NLP, Computer Vision, and Audio. They used for a diverse range of tasks such as translation, automatic speech recognition, and image classification.We need to install
datasets
python package.
Hugging Face model loader
Load model information fromHugging Face Hub
, including README content. This loader interfaces with theHugging 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.
Image captions
It uses the Hugging Face models to generate image captions. We need to install several python packages.Tools
Hugging Face Hub Tools
Hugging Face Tools
support text I/O and are loaded using the load_huggingface_tool
function.
We need to install several python packages.
Hugging Face Text-to-Speech Model Inference.
It is a wrapper around OpenAI Text-to-Speech API
.