ChatHuggingFace
Prerequisite
Log in or sign up to Hugging Face.
Create an API key if you haven't done so: a. From your Hugging Face profile, select Access Tokens > Create new token. b. 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 HuggingFace 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 c. Click Copy and save the API token in another location for retrieval later.
Select an LLM Model that you want to use: a. Select the Models tab on Hugging Face. b. Select the LLM Model that you want to use. On the model page, click the copy icon next to the model name to copy the model name to the clipboard.

Hugging Face Model Page
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: 1. From Chatflows, click + Add New to create a new chatflow. 2. Click + and drag Chains > LLM Chain. 3. Click + and drag Chat Models > ChatHuggingFace. * Connect Credential > click Create New. * Create a new credential and enter in the HuggingFace API Key field the Hugging Face access token you saved previously.

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

4. Click + and drag Prompts > Prompt Template: * Expand the Template and enter an instruction. Example: "User Question: {question}". 5. Connect the ChatHuggingFace output to the Language Model input of the LLM Chain. 6. Connect the PromptTemplate output to the Prompt input of the LLM Chain.

7. Save your configuration before running your chatflow. 8. Voila 🎉, you have created a chatflow with a ChatHuggingFace node in Flowise.
Resources
Last updated