RAG with Langflow, Milvus, and LM Studio⚓︎
TL;DR
Learn how to use Langflow, Milvus, and LM Studio to process and chat with your documents , all on your local machine.
On the surface, Langflow is a drag-and-drop platform for building AI systems that's built on top of LangChain. It can act as a no-code builder where the user can combine different components together in a flow, then immediately test their configuration in a playground. This means really, really quick and easy prototyping with built in UI support for seamless testing . It also has a lot of default components already in place with dedicated flow templates to show how these components can be used.
But even though Langflow can easily be used without creating any code, it can also be treated as a very-much-code platform for endless customization . One of my favorite functionalities is the Code button on top of each component which allows the user to view and modify the underlying code on-the-fly. You can see exactly what's going on and customize your build to fit your specific needs . We'll see how to do this by editing some of the default components for specific use cases.
We're going to build a simple RAG system with which we can process and store many types of documents (40+ types of files can be uploaded - thanks in large part to Docling) with various PDFs and web pages discussing current and future medical AI as examples .
For more tutorials on this particular subject, you can also check out Langflow's RAG tutorial and Milvus's Langflow tutorial.
OK, enough talk - let's get building!
Getting Started⚓︎
To showcase Langflow's capabilities, we'll use a flow that I created for this very purpose. You can download it, then test that it works in Langflow's playground by following these steps:
-
Install and run Docker:
We'll use Docker to create a Milvus server (with etcd and MinIO servers for support). You can see the official Docker Compose release that we'll use.
-
Install and run LM Studio:
We'll use LM Studio to host local embedding models for an extra representation for our documents and LLMs to chat with our documents.
-
In LM Studio, download an LLM:
LM Studio should come packaged with a default embedding which we'll use in this example, so you only need to download an LLM. I used
qwen3-30b. -
In the LM Studio
Developertab, start the server:You can load the models that you want to test, but when you store your data and invoke the LLM, the models should be loaded automatically.
-
Clone my repo and setup the Python environment:
We're cloning this repo to use the included
rag-milvus-lm-studio.jsonin Langflow and themilvus.ymlfor building and running Milvus in Docker. -
Build and run Milvus:
You can check out additional instructions here.
If you're on Linux or Mac, you may be able to use
milvus-liteinstead. Checkout the installation instructions here. -
Install Langflow:
You can do this many different ways, but I chose to
uvinstall. -
Run Langflow:
This will start the Langflow server on your local machine.
-
Navigate to http://localhost:7860 in a web browser.
-
Drag and drop
rag-milvus-lm-studio.jsononto the Langflow interface.This should open the
flowwith all the necessary components. In the1stsection, you can upload PDFs, parse through PDFs and web pages, and store all the information in Milvus. In the2ndsection, you can chat with an LLM about the PDFs and web pages that you added. -
Add some PDFs and web pages to Milvus:
These are the PDFs and web pages about which we'll chat with an LLM. I added lots of medical AI examples for you to test.
-
Start the
Playgroudto chat.Now you can test out chatting with an LLM about your documents.
And that's it! Now, you can add whichever documents or web pages you'd like and chat about them with an LLM, all on your local machine.
Examples Use Cases⚓︎
Now that we understand how to add flow templates and test them in Langflow's playground, let's see how we can further customize our flows. Of course, we can add or remove whichever built in components we'd like, but we can also modify the default components or create completely new components. Here, I'll show how we can modify the default Split Text and Milvus components.
First, let's inspect the outputs for the File component and the Split Text for PDFs component. You can do this by clicking Inspect Output at the bottom right hand corner.
Most documents that are fed into the File component are likely to be processed with Docling by default (the PDFs we add will be). This component then spits out the processed content along with a file_path tag. The content of web pages fed into the URL component are processed using LangChain's RecursiveURLLoader.
When the data output from the File component passes through the Split Text component, the content from each data piece should be split up into smaller sections and new data pieces should be added with the same metadata.
However, notice that the output for the File and Split Text for PDFs components have different metadata, with the File component including the file_path while the Split Text for PDFs component includes the source instead. This is because I edited Langflow's default Split Text code.
You can checkout the edited code by clicking the Code button or by selecting the component, then pressing Space.
Let's take a closer look at what I edited for the Split Text for PDFs component:
Originally, the code didn't include lines 2-6. But, I wanted each of the documents that I added to have a source tag as the basename of the file added.
See how easy it is to edit a default component in order to get particular behaviors?
Now, let's look at one more example. The default Milvus component searches documents by using the similarity_search method of Langchain's Milvus module. We can see this by checking out the code:
Langchain's Milvus vectorstore has a lot potential customizations. For example, one thing we can do is add a filter to the search so that only certain documents are fetched. This is exactly what I did by editing the default Milvus component to create the Milvus with Expression Filter component. Let's check the code out:
Here, we're adding a filter expression to the similarity_search method so that if the user includes any files as input, the search will be filtered to only fetch those files.
Let's see if it works:
Great! Now, we can filter our searches to include whichever sources we want. We can select a few for focused research or select them all for getting a general understanding.
And now you might see why the little Code button on top of each component is my favorite Langflow attribute. We can easily drag-and-drop the default components to create a system, then customize them to better fit our needs. We can also create completely new components if the default components aren't enough to build off of.
And that's it! I hope I showed you how easy it is to create and play with your own AI systems in Langflow. Happy building!









