How To Use 🤗HuggingFace LLMs With LangChain & Flowise
Flowise is an open source IDE for LangChain where Generative Apps can be built via a drag & drop UI to create customised LLM Flows and more.
Flowise is an easy to use LLM App/Prompt Chaining/Agents development framework. If you want to make use of the LangChain framework but the pro-code environment seems daunting, Flowise will certainly be your low-code to no-code option.
In a previous article I step through the basic functionality and perform an overview of Flowise.
I also did an overview on how to install and run Flowise, meanwhile I have found that using the MacOS terminal window works quite well.
Here is a list of all the steps you need to install and run Flowise locally.
Create a virtual environment:
python3 -m venv flowise
Activate the virtual environment:
source flowise/bin/activate
After which you can deactivate:
deactivate
And delete the virtual environment:
sudo rm -rf flowise
Within the Flowise Marketplaces, select the Antonym flow.
Replace the OpenAI LLM component with the HuggingFace Inference Wrapper for HuggingFace LLMs.
Below you can see how to connect the HuggingFace LLM component to the LLM Chain. Enter your HuggingFace API, together with the model name, as seen below.
Save and the next step is to click on the purple chat icon top right and start your conversations. From here it is straightforward to edit the prompts in order to change and further develop your application.
Lastly
A few significant improvements to Flowise would include:
- Currently it does not seem like Agent components, as defined within Flowise, is compatible with HuggingFace LLMs. There is a JSON parsing error when running the app.
- It would also be convenient if the Marketplaces had a few HuggingFace examples.
- And when a prebuilt marketplaces flow contains a ChatOpenAI component, it would be convenient if the ChatOpenAI component can merely be replaced with a HuggingFace component. While the data transformation is managed under the hood, within the IDE.
⭐️ Please follow me on LinkedIn for updates on LLMs ⭐️
I’m currently the Chief Evangelist @ HumanFirst. I explore and write about all things at the intersection of AI and language; ranging from LLMs, Chatbots, Voicebots, Development Frameworks, Data-Centric latent spaces and more.