Now that you’ve connected Flowise to your preferred LLM and created a handful of straightforward chatflows, what’s next? If you want to create more sophisticated and advanced AI applications, Multi-Prompt chains are the way to go.
Multi Prompt Chains allow you to create complex interactions that combine several chains and AI models to produce a desired output for an application. Think of it like creating a recipe with individual steps to create the final product. With each prompt in the chain you can create a template that tells the AI what to do next.
For instance, let’s imagine we’re tasked with designing a character for a video game using multi-chain prompts. To begin, we’d establish a general character type, such as a wizard, a dragon, a warrior, or any other imaginable archetype. Following that, we’d create a prompt defining the character’s environment, whether it’s a majestic castle, an ancient desert temple, or a lush jungle. Once we’ve nailed down the character and their surroundings, we’ll call a final prompt, instructing our AI to create a final description of our character that we can use in Midjourney to describe our character.
To get started with Multi-Chain prompting, let’s first open the Prompt chaining template from the Flowise marketplace
Next let’s add another set of a Prompt template, an LLM Chain and a Chat Model since we only have two sets right now in our chain. In this case we’ll be using Mistral Medium instead of OpenAI GPT for our Chat model.
The first prompt template is going to be our character profile creator, where we will enter an occupation for our main character and the the AI will generate details such as our characters name, origin, special skills and their main quest.
Here are all three prompt templates that you can copy and paste into your own chatflow:
Main Character Prompt Template #1: You are a fiction writer. Please create a name and detailed background profile given the character's their occupation provided in the context.
Please also include where this character comes from, what their special abilities are, and what is their quest or mission.
Character's Occupation:{occupation}
In the second template we take the output of the first prompt, in this case our character profile, and we send it to the second prompt where the AI will create a scene based on our character. Here’s the second prompt template:
Scene Environment Prompt Template #2: You are a talented artist and illustrator. Based on the following character information, describe an illustrated scene or a setting in whish we find our character. Be descriptive about the lighting, the time of day, where our character is at and what they are doing.
Character: {scene}
Finally we take the scene description from template 2, and we use it as the context which will create our final prompt for Midjourney.
Midjourney Prompt Template #3: You are a midjourney artist prompting expert. Based on the follow character information and enviroment setting create a detailed midjourney prompt that best describes:(1) The Art Style, 2 The Character (3) The environment (4) Lighting (5) The Camera Angle
Please make your prompt no more than 500 characters
Character details and scene: {imagine}
Once you have setup all three prompt templates in your chatflow, you’ll need to connect the output of the first LLM chain to the second prompt and the output of the second LLM chain to the 3rd prompt.
This will allow you to (1) Create a Character Profile (2) Pass that Profile in the Scene Generator and (3) finally Create a Midjourney Prompt that you can use to generate an image.
While this is a simple layout, it does require some testing to make sure that your outputs are properly showing up as inputs for your follow-on prompts. If you don’t have Chatflow monitoring like LLM Monitor or Langfuse, then you’ll have run each prompt template separately before connecting them as chain.
You’ll also need to make sure that you’re prompt values are properly defined. We’ll cover prompt values in an future upcoming video.
Testing Your Chatflow
So initially, once I set everything up and ran the chatflow, I noticed that my character’s occupation was missing from my generated Character profile. This affected my entire flow, including my midjourney prompt at the end, so I had to to rewrite my character prompt template to make sure that the AI first created a profile around the character’s occupation such as pilot, wizard or warrior etc.
Once I did that, my chatflow started working the way I intended. Here’s an example using a Samurai Warrior as my initial prompt
Occupation: Samurai Warrior
Character Profile:
Name: Tatsuo Matsuda
Background: Born in the secluded village of Togakure in the mountains of Japan, Tatsuo Matsuda was raised in a family of samurai warriors, deeply rooted in the traditions of the ancient art of war. His father, a renowned samurai, trained him rigorously in the ways of the sword, the bow, and the mind. Tatsuo’s exceptional skills and unwavering dedication to the samurai code earned him the respect of his peers and the attention of the ruling shogunate.
Special Abilities: Tatsuo’s mastery of the samurai arts is unparalleled, with a particular aptitude for the katana, the traditional Japanese sword. He is also skilled in the art of stealth and camouflage, known as ninjutsu, which he learned from his mother, a descendant of the legendary ninja clan, the Koga. Tatsuo’s keen intellect and strategic mindset, coupled with his physical prowess, make him a formidable warrior.
Quest or Mission: When the shogunate faces a growing threat from a rogue daimyo, Tatsuo is entrusted with a critical mission. He must infiltrate the enemy’s stronghold, gather intelligence on their military capabilities, and neutralize their key commanders. As he navigates through treacherous territories and confronts deadly adversaries, Tatsuo remains steadfast in his quest to protect his people and uphold the honor of the samurai.
Next we create a scene for our Samurai Warrior:
The scene unfolds in the quiet stillness of twilight, as the sun dips below the horizon, casting a warm, golden glow over the landscape. Tatsuo Matsuda stands atop a rocky outcropping, overlooking a dense forest that stretches out before him. The forest, a sea of green, is illuminated by the fading light, with shadows dancing between the trees.
Tatsuo, dressed in his traditional samurai armor, riding his horse, with his katana sheathed at his side. His eyes, sharp and focused, scan the treeline, searching for any signs of movement. The air is thick with tension, as the forest holds its breath, waiting for the inevitable clash of steel and the dance of battle.
A gentle breeze rustles the leaves, whispering secrets to those who listen closely. Tatsuo’s ears, trained through years of rigorous discipline, pick up the faintest of sounds – the soft crunch of footsteps on the forest floor, the rustle of fabric against underbrush. He remains still, his body taut as a bowstring, ready to spring into action at a moment’s notice.
In the distance, the first stars begin to appear in the sky, their twinkling lights reflected in the still waters of a nearby lake. The forest, once a formidable barrier, seems to soften under the cover of night, offering Tatsuo a chance to slip through its grasp and complete his mission.
As the last vestiges of daylight fade, Tatsuo takes a deep breath, his chest rising and falling in the cool evening air. He knows that the path ahead is fraught with danger, but he is ready. With a swift, fluid motion, he draws his katana, the blade gleaming in the moonlight.
And so, under the watchful gaze of the stars, Tatsuo Matsuda embarks on his quest, a lone samurai warrior against the darkness of the night.
Finally we create our prompt for Midjourney:
Art Style: Stylized realism with bold lines and vibrant colors, reminiscent of comic book art.
Character: Tatsuo Matsuda, a samurai warrior in full armor, riding his horse, katana at his side
Environment: A dense forest at twilight, with a rocky outcropping overlooking the treeline
Lighting: Warm, golden light from the setting sun, contrasted with the cool, blue light of the moon Camera Angle: Low angle, looking up at Tatsuo to emphasize his strength and determination as he embarks on his quest.
And here is the final result in Midjourney:
And here are a few more images from our character creator. As you can see, the possibilities are endless.
Captain Raleigh Hawthorne – Pilot
Art Style: Detailed, atmospheric, and realistic with a touch of cyberpunk. Character: Captain Raleigh “Razor” Hawthorne – a battle-hardened pilot clad in a sleek, futuristic flight suit. His eyes are intense, his jaw is clenched, and his stance is confident. He holds a holographic map in front of him, absorbed in the data. Environment: An abandoned space station hangar. Neon lights flicker and cast eerie shadows on the worn and weathered walls. Dust particles float in the air, and the distant hum of machinery fills the background. The hangar doors are open, revealing a breathtaking view of the cosmos. Lighting: Dim and moody with flickering neon lights casting blue and purple hues across the hangar. The cosmos outside the hangar provides a striking contrast, with twinkling stars and a vibrant nebula casting their glow. Camera Angle: A dynamic, low-angle shot that captures the size of the hangar and the scope of the mission. The camera focuses on Razor and his team, with the Nightingale stealth fighter looming in the shadows in the background. As Razor issues orders, the camera moves in closer, capturing the intensity in his eyes and the determination on his face. –v 5.0
Aerin Aeriallis – Acrobat
Art Style: Illustrative, with a touch of realism and a focus on dynamic movement and expressive characters. Character: Aerin Aeriallis, a powerful aeromancer and acrobat, stands at the edge of a precipice, summoning a swirling vortex of wind around her. Clad in a form-fitting, deep blue bodysuit with golden filigree, she exudes confidence and determination. Her long, auburn hair is adorned with Zephyros Blossoms and golden threads, which flutter in the wind. Environment: Windwhisper Grove, a lush and sacred sanctuary hidden among the trees, teeming with vibrant foliage and delicate silver-blue flowers. The city of Serendell can be seen in the distance, bathed in the warm, golden light of the late afternoon sun. The towering tents and colorful banners of the Cirque du Elytheria flutter in the breeze. Lighting: Soft, radiant light bathes the scene, casting a warm golden hue over the landscape. The sun is low in the sky, creating long, dramatic shadows and highlighting the texture and detail of the environment. Camera Angle: The camera is positioned at a low angle, slightly below Aerin and looking up at her as she stands atop the precipice. This angle emphasizes her power and confidence, while also showcasing the swirling vortex of wind that surrounds her. The background of the city and the Cirque du Elytheria are visible in the distance, providing context and depth to the scene.