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
Windows: shift + right click > Open in terminal
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 terminalWindows & MacOS: Type
python -m venv langflow
.
Â
Windows:Type.\langflow\Scripts\activate
.
Â
MacOS: Typesource ./langflow/bin/activate
.
Â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
In your web browser, go to http://127.0.0.1:7860
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.
- In Langflow, head over to Community examples > MidJourney Prompt Chain. You'll see a flow similar to the screenshot below. Â
- 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. Â
- 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. Â
- Connect the VertexAI node to the LLM model node in ConversationalSummaryMemory, as well as to the LLM node in MidJourneyPromtChain. Like this: Â
- 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.
The prompt generated by my app
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)