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.
To use the BeanShell Element, add the Beanshell enhancer:
To properly integrate and configure the BeanShell, set the following fields:
Name | Description |
---|---|
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. |