DEV Community

Juan Felipe Lujan
Juan Felipe Lujan

Posted on

🦜🔗Langchain without code -> LangFlow

Langflow is also an excellent option for using Lngchain without code. It uses Python under the hood.

A feature I particularly love about Lanflow is support for custom actions within your flows. Let's get started.

First-time set up

On Windows. I got Langflow to work by installing Python 3.10.11 (download here ), as well as install C++ build tools, which you can download here

With those prerequisites ready, run the following commands inside the folder where you want to install LangFlow

  1. Windows: shift + right click > Open in terminal
    Image description
    Mac: In Finder, activate the path bar by clicking View > Show path bar.
    In the path bar, right-click your target folder and click Open in terminal

  2. Windows & MacOS: Type python -m venv langflow.
    Windows:Type .\langflow\Scripts\activate.
    MacOS: Type source ./langflow/bin/activate.

  3. You might need to restart your terminal at this point
    Back in your terminal, type:
    Windows & MacOS: pip install langflow this will take a few minutes; when done
    Windows & MacOS: python -m langflow

  4. In your web browser, go to

Welcome to langflow

You'll notice by the options at the center top that LangFlow has two main sections, Your Flows (Collections) and Flows shared by the community.

Create your first Langchain application without code.

You'll create an LLM app that helps users improve prompts for generating images in Midjourney. For example:
A simple "image of a house" becomes a "beautiful house from fairy tales, sunny spring morning, vibrant colors, award-winning composition" which should help the app user generate better images.

Note: At the time of writing this article, the chat-bison model and VextexAI embeddings are not supported out-of-the-box by Langflow. Limiting options substantially.

  1. In Langflow, head over to Community examples > MidJourney Prompt Chain. You'll see a flow similar to the screenshot below. Image description  
  2. Click the OpenAI LLM box and then delete. In the left-hand side panel, expand the LLM section and drag and drop the VertexAI element onto the canvas.  
  3. Introduce the Following Parameters Credentials: Browse and select your Service Account JSON file. Follow this guide to generate one. Location: **us-central1 Model Name: text-bison **Project: Your Google Cloud Project ID is available here. Image description  
  4. Connect the VertexAI node to the LLM model node in ConversationalSummaryMemory, as well as to the LLM node in MidJourneyPromtChain. Like this: Image description  
  5. Click the lightning icon and then the chat icon at the bottom right of Langflow.

Using your LLM app

Interacting with LLM apps in Langflow is very similar to using other chatbots. In my case, I sent:

macro picture of a dog
and got back
A close-up of a dog's face, with its tongue hanging out and its eyes half-closed in contentment. The dog's fur is a light brown, and its ears are perked up. The background is a blurry green, with a few blades of grass in focus.

The difference it makes.

I currently don't have Midjourney access, but the same principle should apply to Google's Imagen text-to-image technology.

Image description
The prompt generated by my app
Image description
You can definitely tell that the images generated with the improved prompt are more vibrant and visually appealing, although the results using the plain prompt are pretty good as well.

Congratulations!!! You've created your first LLM app.

Top comments (0)