The order and connection of nodes determine the flow of data through your workflow. Ensure that the output of each node is compatible with the input requirements of the next node in the chain.
Evaluating Prompt Chains
Learn how to connect prompts, code, and APIs to build powerful, real-world AI systems using our intuitive, no-code editor.
Prompt chains are a powerful feature in Maxim that allows you to create complex, multi-step AI workflows by connecting different types of nodes in a logical sequence. This intuitive, no-code editor enables you to mock real-world systems and build sophisticated AI applications with ease.
Understanding Prompt chains
Prompt chains consist of three main types of nodes:
- Prompt nodes
- Code nodes
- API nodes
These nodes can be connected in various combinations to create complex workflows, where the output of one node serves as the input for the next.
Node types in detail
Building a Prompt chain
To create a Prompt chain:
Open the Prompt chains editor in Maxim.
- Navigate to the "Prompt" tab on the left side panel.
- Click on "Prompt" and choose "Prompt chain".
- Click the "+" icon.
- Choose to create a new Prompt chain directly or create a folder for better organization.
- Name your new Prompt chain and optionally assign it to an existing folder.
Start dragging from the Start
node to add a new node to your chain.
A new node will ask you to select the type of node you want to add and configure it accordingly.
Keep chaining nodes by dragging from output of the last node as you need.
Restructure the chain by breaking and the edges and reconnecting them, if required.
Test your workflow using the provided playground.
Versioning
Once you've created a Prompt chain, are satisfied with it currently and want to test upon it, you can create a new version of the Prompt chain. To do so,
- Click on the
Save
button on the top right corner of the Prompt chain editor. - Optionally, you can enter a description for the Prompt chain version.
- Then click on the
Create version
button.
You can view / shift to any version of the Prompt chain by clicking on the icon on the right sidebar of the prompt chain editor.
Once a version is created you can run Test Runs on it or deploy it to access the Prompt chain through the Maxim SDK. For more reference to versioning and deployment, refer to Single prompt Versioning and Single prompt Deployment.
Use cases and examples
Prompt chains can be used to create a wide variety of AI-powered workflows. Here are two examples to illustrate their potential:
Travel expense workflow
This workflow demonstrates how to chain prompts and API calls to automate a travel expense report:
- Prompt node: Extracts travel details from user input
- API node: Fetches current exchange rates
- Code node: Calculates total expenses in local currency
- Prompt node: Generates an expense report email
This chain mimics a real-world business process, showcasing the power of combining different node types.
Auto Image Captioning
This example shows how to you can leverage prompt chains to auto-caption images in an app:
- Prompt node: Generates a detailed description based on the given image (example: a user uploads an image)
- Code node: Applies text formatting and adds hashtags
- API node: Pushes the caption to a backend service to store in the database, which can then be used to display the caption in the app.
This chain demonstrates the versatility of Prompt chains in handling various data types, including images and environments.
Testing and evaluating Prompt chains
To ensure your Prompt chain functions as expected:
- Use the built-in playground to test various inputs.
- Analyze the output at each node to identify any issues.
- Utilize Maxim's testing tools to run comprehensive evaluations.
- Iterate on your chain design based on test results.
- Use Maxim's SDK to integrate the Prompt chain into your application.
For detailed guidance on testing or SDK integration, refer to our Testing a Prompt guide or SDK overview.
Conclusion
Prompt chains in Maxim offer a powerful, intuitive way to create complex AI workflows. By combining prompt, code, and API nodes, you can build sophisticated, real-world AI systems without extensive coding knowledge. Start experimenting with Prompt chains today and unlock the full potential of your AI applications.