Provide method to override Augmentor settings

Created on 17 August 2023, over 1 year ago
Updated 15 May 2024, 8 months ago

Problem/Motivation

I started to work on integrating Augmentor ChatGPT with AI chat user interface .

Encountered an issue: Augmentor ChatGPT saves user messages to configuration.
Saving each new user/assistant message to configuration is not optimal, so I can use AIChat conversation content entity to save messages instead (AIChat has this feature).

But then Augmentor needs to accept array of messages, instead of just single user message.
Plus in the future, I will also want to provide custom "system" message engineered with AI prompt engineering module.

We talked on slack about this few months ago:

@Eleo Basili
can augmentor's prompt be overriden?
yes, you can but not in a nice way, for example: implement your new augmentor, in the execute function we normally replace the [input] token from the prompt with the actual input data, so yeah technically there you can do something else.
I think the best we can do is to add a hook to alter augmentor settings before the execution.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇱🇹Lithuania mindaugasd

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mindaugasd
  • Status changed to Needs review about 1 year ago
  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    I added two new hooks to alter the input configuration and results:

    hook_pre_execute(array &$request_body)

    This hook is invoked before the augmentor processing begins. It allows other modules to alter the decoded request body.

    Parameters

    :
    $request_body (array): The decoded request body. It is an associative array that contains the keys 'input' and 'augmentor' (and many others)

    Usage:

    Implement this hook to modify the request body before the augmentor processes it. For example, you can add, remove, or alter the contents of $request_body.

    Example:

    function mymodule_pre_execute(array &$request_body) {
      // Modify the request body as needed.
      if (isset($request_body['input'])) {
        $request_body['input'] = "Modified Input";
      }
    }
    

    hook_post_execute(array &$result)

    This hook is invoked after the augmentor execution is completed. It allows other modules to alter the results of the execution.

    Parameters:

    $result (array): The results of the augmentor execution. It is an associative array of the results.

    Usage:

    Implement this hook to modify the results after the augmentor execution. For example, you can process or reformat the results as needed.

    Example:

    function mymodule_post_execute(array &$result) {
      // Process or alter the results.
      if (!empty($result)) {
        $result['additional_info'] = "Processed Result";
      }
    }
    
    • eleonel committed 74c3aaa6 on 1.1.x
      Issue #3381639 by eleonel, mindaugasd: Provide method to override...
  • Status changed to Fixed 9 months ago
  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    Added support for Event Subscribers and Hooks.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024