Font Size:

BeanShell Enhancer

Introduction

The BeanShell Enhancer allows you to run custom Java code to modify or enhance the final AI response before it is returned to the user. Unlike prompt plugins that influence the input to the AI, Enhancers operate after the AI has generated a response, giving you full control to transform, format, filter, or even enrich the output.

It leverages the power of BeanShell scripting (Java syntax) to handle complex operations beyond what’s possible with standard configuration.

Get started

How to use it

To use the BeanShell Element, add the Beanshell enhancer:

  1. Locate the BeanShell element under the Enhancers section in the palette.
  2. Drag and drop the element into the Drop an enhancer here section.

Configure Form Properties

To properly integrate and configure the Beanshell, set the following fields:

  • Script: Write your Beanshell (Java-like) code here to process the AI response. The response from the AI is usually available in a variable like response or message, depending on your implementation. You can manipulate this and output a new version of the response.
  • Purpose: This is a short, human-readable description of what the OpenAI element is being used for. It helps the AI agent understand the context of the request and tailor its response more effectively.
Created by Gabriel Last modified by Gabriel on Jun 24, 2025