Creating chatGPT ECA action

Created on 24 March 2023, over 1 year ago
Updated 22 November 2023, 7 months ago

Problem/Motivation

1. Making functional and flexible chat functionality.
2. Making another step within bigger picture and enabling other use-cases: 📌 [META] Drupal could be great for building AI tools (like ChatGPT) Active

Steps to reproduce

Proposed resolution

To implement flexible chatbot functionality, default node, comment, media and contrib eca modules can be used.

"ECA: Event - Condition - Action" ( https://www.drupal.org/project/eca → ) is new very high quality module.

By using default Drupal modules, these tasks are solved by default:

  • Data storage:
    • Saving conversations as node.
    • Saving messages as comment.
  • Data input:
    • Using default flexible comment form for user input.
    • Using comment fields to upload and display images, audio and documents (ChatGPT is going to accept multimedia input).
  • Data output:
    • Using default comments listing for conversation messages.
    • Using comment's body field and text format for multimedia data output.
  • Permissions:
    • Using one of drupal's contrib modules, to configure conversation access based on site usecase. For example:
      • users have their own conversations
      • users having multi-user conversations
      • chatbot writing comments sometimes (example - Drupal.org bot)
  • Listing:
    • Conversations can be listed anywhere as nodes.

Notes:

Remaining tasks

  • Make ECA prototype
  • ...

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

Merge Requests

Comments & Activities

  • Issue created by @mindaugasd
  • 🇺🇸United States SocialNicheGuru

    This is just an example of a different module interacting with ECA: https://www.drupal.org/project/prompt →

    There might be lessons learned.

  • 🇹🇭Thailand AlfTheCat

    I checked out the prompt module and it seems very interesting, but it doesn't exactly cover the potential scope of this feature request. I love the idea of prompt being an API to several AI's, but we need a true ECA implementation so that we can send prompts from within an ECA process so that we can pass on tokens and also process the returned data from OpenAi (and/or other services).

    If we can have an ECA action where we can provide a string that supports tokens, and allows the reply from AI to be stored in entity tokens and fields, all in the familiar eca way, then this would be mind-blowingly powerful, not just for common content workflow automation but also enhancing business process automation with AI capability (like ERP-type setups).

    Just a few examples:

    On comment-presave: "Is [comment_body] likely to be a spam message? Answer just true or false."
    (Then can evaluate the answer and if needed, unpublish the content and flag it for admin review, etc).

    Autotagging

    Auto-translation

    Auto-SEO

    Create a help/ chatbot using drupal comments and some auto-refresh method

    Commerce fraud detection

    Commerce product recommenders

    Automated test for common content workflows, etc

    Analyze the output of a Drupal view with AI and trigger subsequent evaluations and actions

    and so on, and so on...

    Maybe an ECA maintainer would like to have a look at this? I don't think between the geniuses over here and over there it will be too difficult to integrate the OpenAI API.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is mind blowing, just the short list of potential use cases gives us great impression of what can be achieved when we implement ECA with OpenAI and/or Prompt and/or others.

    You may want to also have a look into HTTP Client Manager → which is able to send http requests and store their results in to tokens as well. It has been integrated with ECA, so that may give you an idea on how actions could be implemented here.

    If there is any help needed, let me know, I'm happy to give feedback and review prototypes and code.

  • 🇮🇳India Manoj Raj.R Chennai

    This looks good for the community to learn something.

    I am happy to learn and review the code accordingly.

  • 🇹🇭Thailand AlfTheCat

    That's awesome, I'll be of more real use in a few months, but in the meantime I'll certainly check out the HTTP client manager module and run further tests with the prompt module. I can contribute documentation and test patches as well.

    Just a matter of time now for the first Terminator to show up trying to stop this thread from going any further...

  • 🇱🇹Lithuania mindaugasd

    There are also awesome news on Augmentor module front:

    [...] Our work has been going well and there should be a release of Augmentor soon with the Actions included. ECA does allow for many actions to be defined and chained together. For example our testing has involved building Models which:[...]

    #3351657-4: Discussion - ECA actions, Chaining Augmentors →

  • 🇹🇭Thailand AlfTheCat

    Subscribed to the Augmentor discussion, thanks!

  • Pipeline finished with Skipped
    9 months ago
    #24072
  • Pipeline finished with Skipped
    9 months ago
    #30355
  • First commit to issue fork.
  • Pipeline finished with Skipped
    7 months ago
    #52375
  • 🇺🇸United States kevinquillen
  • 🇺🇸United States kevinquillen

    I've added a few ECA actions for OpenAI:

    - Chat
    - Completion
    - Speech to Text
    - Text to Speech

    This should be enough to grant the flexibility in people developing their own workflows, with more actions to be added in a bit.

    Here is an example one I made - when saving an article, if the summary field is empty, ask ChatGPT to generate a summary from the text and put it in the field:

    Each action takes the response from OpenAI and sets the response back into the token (see screenshot) to use in later steps.

  • Status changed to Fixed 7 months ago
  • 🇺🇸United States kevinquillen
  • 🇹🇭Thailand AlfTheCat

    @kevinquillen this looks amazing!

  • Pipeline finished with Success
    7 months ago
    #56799
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Success
    5 months ago
    #80526
  • Pipeline finished with Success
    5 months ago
    Total: 476s
    #82174
  • Pipeline finished with Success
    5 months ago
    Total: 379s
    #82202
  • Pipeline finished with Success
    5 months ago
    Total: 326s
    #82967
  • Pipeline finished with Success
    5 months ago
    Total: 357s
    #82968
  • Pipeline finished with Skipped
    5 months ago
    #85577
  • Pipeline finished with Success
    5 months ago
    Total: 155s
    #90748
  • Pipeline finished with Success
    5 months ago
    Total: 147s
    #90754
  • Pipeline finished with Success
    5 months ago
    Total: 178s
    #90759
  • Pipeline finished with Failed
    5 months ago
    Total: 151s
    #92136
  • Pipeline finished with Success
    4 months ago
    Total: 149s
    #105452
  • Pipeline finished with Success
    4 months ago
    #113109
  • Pipeline finished with Skipped
    3 months ago
    #125700
  • Pipeline finished with Success
    3 months ago
    Total: 150s
    #132113
  • Pipeline finished with Skipped
    3 months ago
    #132170
  • Pipeline finished with Success
    3 months ago
    #140454
  • Pipeline finished with Skipped
    3 months ago
    #140467
  • Pipeline finished with Success
    3 months ago
    #143954
  • Pipeline finished with Skipped
    2 months ago
    #149003
  • Pipeline finished with Success
    2 months ago
    Total: 177s
    #150542
  • Pipeline finished with Success
    2 months ago
    Total: 180s
    #150942
  • Pipeline finished with Failed
    2 months ago
    Total: 143s
    #156859
  • Pipeline finished with Success
    2 months ago
    Total: 166s
    #157616
  • Pipeline finished with Success
    2 months ago
    Total: 142s
    #157634
  • Pipeline finished with Canceled
    2 months ago
    Total: 73s
    #157637
  • Pipeline finished with Failed
    about 2 months ago
    Total: 188s
    #159804
  • Pipeline finished with Success
    about 2 months ago
    Total: 150s
    #159811
Production build 0.69.0 2024