ChatHuggingFace
Instructions for creating chatflows with a Hugging Face chat model.
Prerequisite
Log in or sign up to Hugging Face.
Create an API key if you haven't done so:
From your Hugging Face profile, select Access Tokens > Create new token.
Create a Fine-grained token. Select all the read and write access you need. Ensure that you also select either:
Make calls to Inference Providers - to interact with the Serverless Inference API (formerly known as the "Inference API") from Hugging Face or other third-party providers (such as Together AI, Sambanova, or Replicate) through Hugging Face.
Make calls to your Inference Endpoints - to interact with a dedicated standalone Hugging Face instance that you’ve deployed on your own server.

Hugging Face Token Creation Click Copy and save the API token in another location for later retrieval.
From the Models tab, select an LLM Model that you want to use.

Hugging Face Models On the LLM model page that opens:
Click the icon next to the model name to copy the model name to the clipboard or save to another location for later retrieval.
Note the default Inference Provider for the model.

Hugging Face LLM Model Page If your provider is a third-party provider that requires a custom API key, first create the API key on the provider site, then copy and set the API key on your Hugging Face profile settings:
Click Settings under your Hugging Face profile.
Select Inference Providers on the left panel.
Select the Settings tab.
Select Set a custom API key for the provider, and paste in the API key.
Setup
Flowise
To get started, you need to deploy Flowise. Install and run Flowise, either locally or on the cloud. You can follow the official Flowise documentation or tutorials for deployment.
To create a chatflow in Flowise with a ChatHuggingFace chat model:
From Chatflows, click + Add New to create a new chatflow.
Click + and drag Chains > LLM Chain.
Click + and drag Chat Models > ChatHuggingFace:
Connect Credential: Click Create New to create a new credential and enter the Hugging Face access token in the HuggingFace API Key field.

Hugging Face Connect Credential Model: Paste the model name from the clipboard (saved from the model page on Hugging Face).

ChatHuggingFace Node Click + and drag Prompts > Prompt Template:
Expand the Template and enter an instruction. Example: "User Question: {question}".
Connect the ChatHuggingFace output to the Language Model input of the LLM Chain.
Connect the PromptTemplate output to the Prompt input of the LLM Chain.
Save your configuration before running your chatflow.
Voila 🎉, you have created a chatflow with a ChatHuggingFace node in Flowise.

Hugging Face Chatflow
Resources
Last updated