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:

  1. Prompt nodes
  2. Code nodes
  3. 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.

A screenshot of the Prompt chains editor interface, showing connected nodes of different types

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".

Prompt chain tab in navigation

  • Click the "+" icon.
  • Choose to create a new Prompt chain directly or create a folder for better organization.

Dropdown menu for creating a new Prompt chain

  • Name your new Prompt chain and optionally assign it to an existing folder.

Creating a new Prompt chain

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.

New node in Prompt chain

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.

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.

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.

Create version dialog

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:

  1. Prompt node: Extracts travel details from user input
  2. API node: Fetches current exchange rates
  3. Code node: Calculates total expenses in local currency
  4. 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:

  1. Prompt node: Generates a detailed description based on the given image (example: a user uploads an image)
  2. Code node: Applies text formatting and adds hashtags
  3. 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:

  1. Use the built-in playground to test various inputs.
  2. Analyze the output at each node to identify any issues.
  3. Utilize Maxim's testing tools to run comprehensive evaluations.
  4. Iterate on your chain design based on test results.
  5. 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.

On this page