ChatHuggingFace
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.
Hugging Face Inference Providers Page
Setup​
CiniterFlow​
To get started, you need to deploy CiniterFlow. Install and run CiniterFlow, either locally or on the cloud. You can follow the official CiniterFlow documentation or tutorials for deployment.
To create a chatflow in CiniterFlow 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
- Connect Credential: Click Create New to create a new credential and enter the Hugging Face access token in the HuggingFace API Key field.
- Click + and drag Prompts > Prompt Template:
- Expand the Template and enter an instruction. Example: "User Question:
{question}".
- Expand the Template and enter an instruction. Example: "User 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 CiniterFlow.
Hugging Face Chatflow