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.
With those prerequisites ready, run the following commands inside the folder where you want to install LangFlow
Windows & MacOS: Type
python -m venv langflow.
You might need to restart your terminal at this point
Back in your terminal, type:
Windows & MacOS:
pip install langflowthis will take a few minutes; when done
Windows & MacOS:
python -m langflow
In your web browser, go to http://127.0.0.1:7860
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.
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.
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.
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.