A Quick Way to Prototype RAG Applications Based on LangChain

Yanli Liu

Towards Data Science

⁤Remember the days when building a smart chatbot took months of coding?

Frameworks like LangChain have definitely streamlined development, but hundreds of lines of code can still be a hurdle for those who aren’t programmers. ⁤

Is there a simpler way ?

Building Local RAG Chatbots Without Coding Using LangFlow and Ollama | by Yanli Liu | Apr, 2024 - image  on https://aiquantumintelligence.com
Photo by Ravi Palwe on Unsplash

That’s when I discovered “Lang Flow,” an open-source package that builds upon the Python version of LangChain. It lets you create an AI application without needing to write a single line of code. It provides you a canvas where you can just drag components around and link them up to build your chatbot.

In this post, we’ll use LangFlow to build a smart AI chatbot prototype in minutes. For the backend, we’ll use Ollama for embedding models and Large Language Model, meaning that the application runs locally and free of charge! Finally, we’ll convert this flow into a Streamlit application with minimal coding.

In this project, we’re going to build an AI chatbot, and let’s name it “Dinnerly — Your Healthy Dish Planner.” It aims to recommend healthy dish recipes, pulled from a recipe PDF file with the help of Retrieval Augmented Generation (RAG).

Before diving into how we’re going to make it happen, let’s quickly go over the main ingredients we’ll be using in our project.

Retrieval-Augmented Generation (RAG)

RAG (Retrieval-Augmented Generation) helps Large Language Models (LLMs) by feeding them relevant information from external sources. This allows LLMs to consider this context when generating responses, making them more accurate and up-to-date.

The RAG pipeline includes typically following steps, as described in A Guide to Retrieval Augmented Generation :

  1. Load Document: Begin by loading the document or data source.
  2. Split into Chunks: Break the document into manageable

Source link