Use ChatGPT for solving Drupal issues to increase rate of development

Created on 25 January 2023, almost 2 years ago
Updated 13 June 2024, 5 months ago

Problem/Motivation

  • Drupal needs to prepare for new reality.
  • And reality is accelerating change. A lot of companies are now competing to release a lot of A.I. capabilities this year.
  • Drupal has bugs or features in the works, which could be solved faster using coming artificial intelligence capabilities, and so be on paar with other projects in accelerating world.
  • Drupal has a lot of potential in general, which could be achieved if rate of development be increased.
  • This also comes out of fear, that mainstream frameworks are more likely be favored by A.I., and so in accelerating world, Drupal can be left behind if this issue is not addressed on time (or before time comes).

How to achieve it?

  1. Advertise this problem to Drupal core developers in order to come up with solutions.
  2. Explore the current state of ChatGPT and Drupal. Here is a video demonstrating current OpenAI capabilities in the context of Drupal 10: https://youtube.com/watch?v=LWrQ7f67t5I
  3. Try to predict what features are coming next in GPT-4, in the software development industry and be in time to harness it for Drupal.
  4. Drupal.org has a lot of historic data of bugs being solved (code, merges, change records, comments, documentation). OpenAI models can be fine tuned using Drupal's custom data. Documentation: https://beta.openai.com/docs/guides/fine-tuning
  5. Find a path for a lot of drupal training data be included generally in next version of OpenAI's (or other company's models.)

Future vision:

  1. Drupal developers guide work of A.I., instead of writing or reviewing most of code/comments/documentation/tests/etc. themselves.
  2. Drupal have implemented a lot of currently missing features (in the modules too).
  3. Drupal have implemented new (otherwise unattainable) innovations (for example, having a lot of beautiful designs where drupal lack significantly at the moment).
  4. Drupal saving a lot of development time, because of cool features and modules being already available.
  5. Drupal is accessible to a lot more people to use, because it is cost effective to create all kinds websites and solutions (Drupal became better than wordpress).

I asked ChatGPT to generate ideas how it can be useful for us. The answer:

1. Code generation: Codex can be trained on Drupal codebase and can be used to generate new code snippets that conform to Drupal's coding standards.
2. Code review: Codex can be used to automatically review code changes and pull requests, providing feedback on code quality and best practices.
3. Bug triage: Codex can be used to analyze issue reports and provide suggestions for potential solutions, helping to prioritize and assign issues to the appropriate developers.
4. Documentation generation: Codex can be trained on Drupal's documentation and can be used to generate new documentation or update existing documentation.
5. Community engagement: Codex can be used to assist with community engagement by answering questions and providing support in forums and issue queues.
6. Test automation: Codex can be used to assist with test automation by generating test cases and test scenarios that can be used to test Drupal code.
7. Translation: Codex can be used to assist with translation by generating translations of documentation, code comments and other text.
8. Code search: Codex can be used to assist with searching through Drupal's codebase, making it easier to find relevant code snippets and examples.

More example ideas

  1. Module rework from Drupal 7 to 8 was complicated. If A.I. existed, it could have reworked modules automatically from examples of human redesigned modules. Possibly many modules still exist that never landed. "A.I. please take this Drupal 7 module, and redesign it for Drupal 11."
  2. Drupal has a lot of duplicating modules. So A.I. can be given a task "Please merge features of these 5 modules. Make it similar architecture to how Views module is designed".
  3. "A.I. please take this beautiful Wordpress theme, and make a Drupal one out of it" (A.I. is good rewriting code between languages, so it will be good rewriting theme code between frameworks)
📌 Task
Status

Active

Component

Discussion

Created by

🇱🇹Lithuania mindaugasd

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @mindaugasd
  • 🇮🇳India guptahemant

    This one might be interesting to look at https://www.drupal.org/project/openai .

  • 🇪🇸Spain rcodina Barcelona

    It would be a game changer to use ChatGPT to boost issue fixing times. There are core issues which last years and have hundreds of comments! It seems that all source code generated by ChatGPT is under MIT license. And I think its compatible with GPL but I'm not an expert. Someone should check it out.

    https://www.drupal.org/about/licensing
    https://opensource.org/licenses/MIT

  • 🇱🇹Lithuania mindaugasd

    DrupalGPT

    Sending an example how to make Drupal modules with GPT-4 (most powerful model released a week ago). At the beginning, there is 'system' instruction which describes AI assistant's character which I named DrupalGPT. And later there is interaction with DrupalGPT to build flexible open source module similar to "views", but for working with AI. Its not flawless yet, but it conveys what we can expect will be possible soon. The main flaws are probably the same I mentioned in issue description - it lacks drupal data and up to date information - model training data is from 2021. OpenAI allows to provide our own data in the meantime (fine tuning) if we would not want to wait for model updates. "Fine tuning" specifically is not available for GPT-4 at this moment, but GPT-4 allows to provide a lot of information and documentation inside the chat itself to fill in the gaps of GPT-4 knowledge when needed.

    System:

    You are DrupalGPT - a Drupal CMS software architect and modules programming copilot for open source. You enjoy creating module architecture and writing code to implement it. Your user is an experienced Drupal developer who wants to build powerful Drupal modules quckly with your help. Your goal is to help developer to implement features quickly. When asked, you create software architecture. And when asked, you write code to implement it. You don't explain what each code line means unless asked. Developer has to provide you a lot of imformation about the context and the goal of the module. Ask developer for guidance if sometimes you are unsure how to make something.

    User:

    Pleas create a module.

    Assistant:

    To create a module, I need more information about the functionality you want in the module and any specific requirements for the module. Please provide me with these details so I can help you create the desired module.

    User:

    Here is context information for the module:

    Module machine name could be 'ai', module display name could be 'AI framework'. You can suggest or use better name if you think something else would fit this module better. Module has to be Drupal 10 compatible. Module could be as flexible as Drupal's "views" module [...]

    [...]

    (there is a lot of text, I attached the rest of requirements in a document example-requirements-v0.1.20230320.odt)

    Assistant:

    Based on the information you provided for module requirements, I suggest a modular architecture for the "AI Framework" module. Here is an overview of the proposed architecture:

    1. AI Connector submodule: Responsible for providing the abstract class and plugin system to integrate with various AI service providers (e.g., OpenAI GPT-3, Azure Cognitive Services, Google Cloud AI, AWS AI, etc.). These providers will be implemented as individual plugins managed by the Drupal Plugin API.

    // src/Plugin/AIConnectorInterface.php
    
    interface AIConnectorInterface extends PluginInspectionInterface {
      public function query($input);
    }
    

    2. AI Chatbot submodule: Provides features for creating and customizing AI-driven chatbots using the integrated AI services. It will offer a customizable user interface for end-users, prebuilt components for chatbot creation, and mechanisms for controlling chatbot behavior and responses.

    3. AI Content submodule: Provides the ability to generate and/or analyze text, summaries, translations, SEO optimization, and other text-related features using the integrated AI services. This submodule will provide UI components that work with AI connectors to support these features.

    4. AI Event - Condition - Action (ECA) submodule: This submodule leverages the existing ECA module architecture to allow the creation of AI-driven events, conditions, and actions. By combining AI functionality with ECA systems, site builders have a more flexible and powerful toolset to create custom AI solutions for their website.

    5. AI Analytics submodule: Provides tools for tracking user interaction, engagement, sentiment analysis, and recommendations. It integrates with the AI connectors to offer personalized content and interface for each user. This submodule also includes reporting and visualization tools to help site administrators analyze the data and improve their AI implementations.

    To implement the AI connector submodule, follow these steps:

    1. Create the "ai_framework" module folder with the necessary files (`ai_framework.info.yml`, `ai_framework.module`).

    2. Inside the "src" folder, create a "Plugin" folder that will host the AI connector plugins and interfaces.

    3. Implement the `AIConnectorInterface` as shown above.

    4. For each AI service provider, create a corresponding plugin class that implements the `AIConnectorInterface`. For example, create a `GPT3Connector` for OpenAI's GPT-3 integration.

    After setting up the AI connector submodule, you can continue expanding the module by implementing other submodules (AI chatbot, AI content, AI ECA, and AI analytics) using a similar approach. This modular architecture allows you to integrate multiple AI services and add more functionality to your Drupal website while maintaining a clean and organized codebase.

    User:

    List directories and files for this module

    Assistant:

    Here's the directory structure and files for the "AI Framework" module:

    ai_framework/
    │   ai_framework.info.yml
    │   ai_framework.module
    │   ai_framework.routing.yml
    │   ai_framework.services.yml
    │
    └───src/
        │
        ├───Plugin/
        │   └───AIConnector/
        │       ├───Azure/
        │       │   └───AzureConnector.php
        │       ├───GPT3/
        │       │   └───GPT3Connector.php
        │       ├───GoogleCloudAI/
        │       │   └───GoogleCloudConnector.php
        │       ├───AWSAI/
        │       │   └───AWSAIConnector.php
        │       └───AIConnectorInterface.php
        │
        └───Controller/
            └───AIChatbotController.php

    Here is the purpose of each file:

    - `ai_framework.info.yml`: Contains module metadata such as name, description, package, version, and Drupal core compatibility.

    - `ai_framework.module`: Main module file containing hooks and other custom code.

    - `ai_framework.routing.yml`: Defines routes for module components, like custom pages or form submissions.

    - `ai_framework.services.yml`: Service definitions for dependency injection.

    Inside the `src` folder:

    - `Plugin/AIConnector/`: Contains the different AI connector plugins and the connector interface.

    - `Plugin/AIConnector/AIConnectorInterface.php`: Defines the AI connector interface.

    - `Plugin/AIConnector/Azure/AzureConnector.php`: Azure AI Connector class.

    - `Plugin/AIConnector/GPT3/GPT3Connector.php`: OpenAI GPT-3 Connector class.

    - `Plugin/AIConnector/GoogleCloudAI/GoogleCloudConnector.php`: Google Cloud AI Connector class.

    - `Plugin/AIConnector/AWSAI/AWSAIConnector.php`: AWS AI Connector class.

    - `Controller/AIChatbotController.php`: Controller for handling AI chatbot-related routes and logic.

    As you expand the AI module by implementing other submodules (AI chatbot, AI content, AI ECA, and AI analytics), you will need to add more controllers, services, form classes, and other required components within the appropriate directories.

    User:

    Could we rename the module to "ai.info.yml" instead of "ai_framework.info.yml", because it would be shorter. What do you think?

    Assistant:

    Yes, renaming the module to "ai" instead of "ai_framework" would make the module name shorter and more concise. Here's the revised directory structure and files for the "AI" module:

    ai/
    │   ai.info.yml
    │   ai.module
    │   ai.routing.yml
    │   ai.services.yml
    │
    └───src/
        │
        ├───Plugin/
        │   └───AIConnector/
        │       ├───Azure/
        │       │   └───AzureConnector.php
        │       ├───GPT3/
        │       │   └───GPT3Connector.php
        │       ├───GoogleCloudAI/
        │       │   └───GoogleCloudConnector.php
        │       ├───AWSAI/
        │       │   └───AWSAIConnector.php
        │       └───AIConnectorInterface.php
        │
        └───Controller/
            └───AIChatbotController.php

    Using the new module name, make sure to update the references in code and file names accordingly:

    - Rename `ai_framework.info.yml` to `ai.info.yml`.

    - Rename `ai_framework.module` to `ai.module`.

    - Rename `ai_framework.routing.yml` to `ai.routing.yml`.

    - Rename `ai_framework.services.yml` to `ai.services.yml`.

    This revised module name should still convey the purpose of the module while keeping it short and easy to manage.

    User:

    Please write code for "ai.info.yml" file.

    Assistant:

    Here's the content for the "ai.info.yml" file:

    name: 'AI'
    type: module
    description: 'A flexible AI integration framework for Drupal, allowing integration with multiple AI services such as GPT-3, Azure Cognitive Services, and more. It provides AI-driven chatbots, content generation, ECA, and analytics support.'
    package: 'AI'
    core_version_requirement: '^10.0'
    version: '1.0.0'
    dependencies:
      - eca:eca
      - drupal:node
      - drupal:comment
      - drupal:views

    This file defines the AI module's name, type, description, package, required core version, and dependencies. It ensures compatibility with Drupal 10 and depends on the ECA, Node, Comment, and Views modules.

    User:

    Write code for files "ai.routing.yml" and "ai.services.yml"

    Assistant:

    Here's the content for the "ai.routing.yml" file. This example includes a route for a configuration page for the AI module:

    ai.admin_settings:
      path: '/admin/config/ai/settings'
      defaults:
        _form: '\Drupal\ai\Form\AISettingsForm'
        _title: 'AI Settings'
      requirements:
        _permission: 'administer ai settings'
      options:
        _admin_route: TRUE

    This route maps to a form class `AISettingsForm` located in the `src/Form` directory (which you need to create). The route has an `_admin_route` option to make sure it gets styled properly as an admin page.

    For the "ai.services.yml" file, no services are defined yet, so it will be an empty YAML file for now:

    # Empty file since no services are defined yet.

    As you expand the AI module and implement more features, you can add services to the "ai.services.yml" file for dependency injection and further customization.

    User:

    List directory structure for AI Event - Condition - Action (ECA) module.

    Assistant:

    The AI Event - Condition - Action (ECA) submodule will be placed within the main AI module. Here is the directory structure for the submodule within the main AI module:

    ai/
    │   ai.info.yml
    │   ai.module
    │   ai.routing.yml
    │   ai.services.yml
    │
    └───src/
        │
        ├───Plugin/
        │   └───AIConnector/
        │       ├───Azure/
        │       │   └───AzureConnector.php
        │       ├───GPT3/
        │       │   └───GPT3Connector.php
        │       ├───GoogleCloudAI/
        │       │   └───GoogleCloudConnector.php
        │       ├───AWSAI/
        │       │   └───AWSAIConnector.php
        │       └───AIConnectorInterface.php
        │
        ├───Controller/
        │   └───AIChatbotController.php
        │
        └───ECA/
            ├───Event/
            │   └───AIEventInterface.php
            ├───Condition/
            │   └───AIConditionInterface.php
            └───Action/
                └───AIActionInterface.php

    In the ECA directory:

    - `Event/`: Contains the custom AI event interfaces, and possibly event classes, for the AI ECA submodule.

    - `Condition/`: Contains the custom AI condition interfaces, and possibly condition classes, for the AI ECA submodule.

    - `Action/`: Contains the custom AI action interfaces, and possibly action classes, for the AI ECA submodule.

    These interfaces and related classes should extend or implement the relevant interfaces or parent classes from the ECA module to maintain compatibility with the existing ECA module's functionality.

    User:

    Is it really a submodule, if it does not have "ai_eca.info.yml" file?

    Assistant:

    You are correct; without a separate ".info.yml" file, it will not be treated as a stand-alone submodule. The structure I provided earlier is actually for organizing the code within the main AI module. If you want to make the ECA functionality a true submodule, you would need to create an additional folder inside the main AI module and include the respective ".info.yml" file. Here is the updated directory structure for a submodule:

    ai/
    │   ai.info.yml
    │   ai.module
    │   ai.routing.yml
    │   ai.services.yml
    │
    ├───ai_eca/
    │   │   ai_eca.info.yml
    │   │
    │   └───src/
    │       ├───Event/
    │       │   └───AIEventInterface.php
    │       ├───Condition/
    │       │   └───AIConditionInterface.php
    │       └───Action/
    │           └───AIActionInterface.php
    │
    └───src/
        │
        ├───Plugin/
        │   └───AIConnector/
        │       ├───Azure/
        │       │   └───AzureConnector.php
        │       ├───GPT3/
        │       │   └───GPT3Connector.php
        │       ├───GoogleCloudAI/
        │       │   └───GoogleCloudConnector.php
        │       ├───AWSAI/
        │       │   └───AWSAIConnector.php
        │       └───AIConnectorInterface.php
        │
        └───Controller/
            └───AIChatbotController.php

    Here's what you would put in the "ai_eca.info.yml" file to define the submodule:

    name: 'AI ECA'
    type: module
    description: 'An AI Event - Condition - Action submodule for the AI framework, enabling flexible AI-driven events, conditions, and actions in conjunction with the existing ECA module.'
    package: 'AI'
    core_version_requirement: '^10.0'
    version: '1.0.0'
    dependencies:
      - ai:ai
      - eca:eca

    Now the "AI ECA" functionality is indeed a separate submodule, which users can optionally enable within the main "AI" module.

    User:

    What ECA actions should AI ECA module provide for the user in order to satisfy our requirements?

    Assistant:

    The AI ECA submodule should provide the following actions to satisfy the requirements described earlier:

    1. AI Content Generation Action: The action would generate content such as articles, texts, and summaries based on the provided keywords, topics, or settings. Users could use this action to create drafts for new content or to update existing content.

    2. AI Chatbot Reply Action: This action would allow the AI to send a chatbot response using the integrated AI services when a specified event and condition occur, for example, when a user submits a comment or asks a question. The action should be capable of handling various chatbot configurations, such as appearance, functionality, and flow.

    3. AI Content Translation Action: Translates content from one language to another using the integrated AI services. This action will enable multilingual support on the website for various content types (nodes, comments, taxonomy terms, etc.).

    4. AI Content Moderation Action: Automatically moderates content, filtering spam, inappropriate, or offensive text. This action can be triggered when a new comment or a node is created or updated.

    5. AI Sentiment Analysis Action: Analyzes the sentiment of provided text, such as comments or user feedback, enabling actions to be taken based on the sentiment (positive, negative, or neutral) and offering insights for site administrators.

    6. AI Content Recommendation Action: Personalizes content recommendations for users based on their browsing history, preferences, and site behavior. This action can be combined with the Views module to customize content displays and blocks for each user.

    7. AI Search Assistance Action: Enhances the search experience on the website by utilizing AI to understand user intent and provide more accurate and relevant search results.

    8. AI Integrated Test Case Generation Action: Generates test cases and test scenarios automatically, which can be used to test the Drupal code and provide better test coverage.

    With these actions, the AI ECA submodule will offer a range of AI-driven functionalities to enhance user experience, content management, and automation within a Drupal website. Each action should be implemented and provided using the ECA module's action plugin system. Note that some actions may also require corresponding events and conditions to be created for better integration and usability.

    User:

    Please write all code necessary for AI Chatbot Reply Action.

    Assistant:

    To implement the AI Chatbot Reply Action, we'll follow these steps:

    1. Create the `AIChatbotReply` class that extends the `ActionBase` class and implements `ContainerFactoryPluginInterface`.

    2. Implement the `__construct()` and `create()` methods for dependency injection and configuration.

    3. Implement the `execute()` method to process the chatbot reply action.

    First, create a new folder `src/Plugin/Action` within the `ai_eca` module folder. Then, inside the `Action` folder, create a new file named `AIChatbotReply.php` with the following code:

    // ai_eca/src/Plugin/Action/AIChatbotReply.php
    
    namespace Drupal\ai_eca\Plugin\Action;
    
    use Drupal\Core\Action\ActionBase;
    use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
    use Drupal\Core\Session\AccountInterface;
    use Drupal\comment\CommentInterface;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    use Drupal\ai\Plugin\AIConnector\AIConnectorManagerInterface;
    
    /**
     * AI Chatbot Reply Action.
     *
     * @Action(
     *   id = "ai_chatbot_reply",
     *   label = @Translation("AI Chatbot Reply"),
     *   type = "comment"
     * )
     */
    class AIChatbotReply extends ActionBase implements ContainerFactoryPluginInterface {
    
      /**
       * The AI Connector plugin manager.
       *
       * @var \Drupal\ai\Plugin\AIConnector\AIConnectorManagerInterface
       */
      protected $aiConnectorManager;
    
      /**
       * AIChatbotReply constructor.
       *
       * @param array $configuration
       *   A configuration array containing information about the plugin instance.
       * @param string $plugin_id
       *   The plugin_id for the plugin instance.
       * @param mixed $plugin_definition
       *   The plugin implementation definition.
       * @param \Drupal\ai\Plugin\AIConnector\AIConnectorManagerInterface $ai_connector_manager
       *   The AI Connector plugin manager.
       */
      public function __construct(array $configuration, $plugin_id, $plugin_definition, AIConnectorManagerInterface $ai_connector_manager) {
        parent::__construct($configuration, $plugin_id, $plugin_definition);
        $this->aiConnectorManager = $ai_connector_manager;
      }
    
      /**
       * {@inheritdoc}
       */
      public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
        return new static(
          $configuration,
          $plugin_id,
          $plugin_definition,
          $container->get('plugin.manager.ai_connector')
        );
      }
    
      /**
       * {@inheritdoc}
       */
      public function execute($comment = NULL) {
        if ($comment instanceof CommentInterface) {
          // Select a specific AI Connector.
          // e.g., replace 'gpt3' with the desired AI connector plugin id.
          $ai_connector = $this->aiConnectorManager->createInstance('gpt3');
          $input_message = $comment->get('comment_body')->value;
    
          // Process the reply using the AI Connector.
          $reply = $ai_connector->query($input_message);
    
          // Perform the chatbot reply action. In this example, we reply as new comment.
          $reply_comment = $this->createReplyComment($comment, $reply);
          $reply_comment->save();
        }
      }
    
      /**
       * {@inheritdoc}
       */
      public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
        // Check access for the action. You can customize this logic as needed.
        return $this->allowedIf($object instanceof CommentInterface, $return_as_object);
      }
    
      /**
       * Create the reply comment based on the AI chatbot response.
       *
       * @param \Drupal\comment\CommentInterface $comment
       *   The parent comment that the chatbot is replying to.
       * @param string $reply
       *   The AI chatbot response.
       *
       * @return \Drupal\comment\CommentInterface
       *   The new comment created with the chatbot response.
       */
      protected function createReplyComment(CommentInterface $comment, $reply) {
        $reply_comment = $comment->createDuplicate();
        $reply_comment->set('uid', 0); // Set user ID of chatbot reply (0 indicates anonymous).
        $reply_comment->set('pid', $comment->id()); // Set parent ID to the original comment.
        $reply_comment->set('comment_body', $reply); // Set the chatbot response as comment body.
    
        return $reply_comment;
      }
    
    }

    This action is able to use a specified AI connector (in this example, 'gpt3') to process the chatbot reply and create a new comment based on the AI chatbot's response.

    Please note that this example uses the GPT-3 AI connector. You can replace it with the desired AI connector plugin ID in the `execute()` method. Also, you may want to adjust the `access()` method for your specific needs or extend the action if necessary.

    To make this action available for comment entities, go to your Drupal site's Actions configuration page (admin/config/system/actions) and add the "AI Chatbot Reply" action in the "Comment" section. You can then configure it to be triggered by certain events and conditions of your choice.

  • 🇱🇹Lithuania mindaugasd

    Created a child issue to figure out how to teach DrupalGPT to even higher level of (flawless) expertise 📌 Training a Large Language Model for Code (Code LLM) - an expert Drupal A.I. Active

  • 🇱🇹Lithuania mindaugasd

    Overview of GitHub Copilot, newer Github Copilot X and related extensions.

    Github Copilot X Explained | A big step forward... https://youtube.com/watch?v=8_0DJ9FOlOM

    It does many things described in this issue, for example, writing issue comments. And more, like allowing to code using your voice.

  • 🇬🇷Greece pinkonomy

    I think there should be an official initiative to include ChatGPT into Drupal.

  • Interpreting errors to non-experts would be a good use-case: Improve error messages, by including the source Active

  • 🇱🇹Lithuania mindaugasd

    Since writing this issue in January, there were tons of AI developments.
    We see GPT-4 is quite good at Drupal, so we can foresee next steps.
    Now created a child issue with more detailed plain of how to develop Drupal with AI: 🌱 Fully fledged website and module development with Artificial Intelligence Active

  • 🇪🇸Spain tunic Madrid

    Depending on ChatGPT, a private paid service with some concerns about the training data (mostly Open Source, so there may be some licensing issues), is risky. I would be ok to add AI capabilities, but I would look into open models. See also https://www.semianalysis.com/p/google-we-have-no-moat-and-neither, where they say open models are improving in a fast pace. I lack knowledge on AI so I can't be sure on what they claim, though.

  • 🇱🇹Lithuania mindaugasd

    @tunic there is an issue for licensing question: 🌱 [policy, no patch] Make a policy for Machine Learning ("AI") code contributions Active
    About "no moat" rumors/discussion wrote a bit here #3358892-3: Fully fledged website and module development with Artificial Intelligence and can continue here 📌 Training a Large Language Model for Code (Code LLM) - an expert Drupal A.I. Active
    In short: yes, open source models and techniques are evolving very quickly, but they have physical compute limitations at some point, so they are not large, but can be efficient.

  • I don't think it's a good idea to move quickly on this just because others are.

    See this recent article: How I pwned half of America’s fast food chains, simultaneously.

    Many companies all incorporated AI into their hiring pipeline because AI is the hot, new thing. But a huge number of them ended up writing insecure code and all were vulnerable as a result. AI is not known for high-quality results; it's known for just being a "blurry JPEG" of all the data it was trained on.

  • 🇱🇹Lithuania mindaugasd

    I don't think it's a good idea to move quickly on this just because others are.

    @solideogloria since there was little interest and very few people work on this in Drupal (very suprisingly), so it is not quick to be slower. But these features are super useful and would have great impact for the drupal user. Please take a look to this issue where I described benefits in more detail: 🌱 Fully fledged website and module development with Artificial Intelligence Active
    Also take a look at AI initiative homepage to get highest level overview: https://www.drupal.org/project/artificial_intelligence_initiative

    "blurry JPEG" of all the data it was trained on.

    AI is highly intelligent and is getting ever more intelligent - it is not an LLM anymore, but multi-modal similar to the brains of biological beings - it can see, imagine, talk, do tasks and increasingly interact with the physical world. And do this many times better than people.
    I know this all seems scary, but personally I follow AI for more than a decade, so I got used to these ideas during this time and think there is no other choice but forwards. I also don't think it is good idea to ignore this highly impactful area as people choose to do. I am also quite demotivated by the slowness and attitude of developers, because timing is important in the area of innovation for Drupal users. For example: https://www.drupal.org/forum/support/post-installation/2023-11-15/offeri...

  • AI is not intelligent. It is an autocomplete tool; even when it uses images and videos, it's obvious that the AIs have no idea what the purpose of a hand is, because image results always have missing hands, blurry fingers, weird limbs, etc. An AI does not "comprehend".

    Also, human beings are way smarter than you give them credit for. Nobody has ever made a computer that can do what the human brain does with the resources it does it. The human brain is liquid cooled, self-repairing, super-parallelized, automated, adaptable, and learning. Computers are good at doing math faster, and at reading through a bunch of training data fast. But they cannot learn as quickly. People have been working to develop AI for decades, and it still can't properly understand the purpose of a human hand.

    https://fountainmagazine.com/2016/issue-111-may-june-2016/how-many-super...

    I understand people like to be optimistic and place AI very high up in terms of intelligence. But ask any neuroscientist, and I'm sure you'll get a different perspective. The people that place AI high up don't know much about the complexity and functions of the human brain. If you use as your rubric/grading scale a standard that AI is better at, like reading training data, then of course it seems smart. A standard to judge between humans and AI should also take into account other things as well. However, even if you ask an AI to do math, many get even simple addition wrong.

  • 🇱🇹Lithuania mindaugasd

    People are belittling AI for a long time. They were arguing so many things that AI can't do and will never do, and now it can do those things, and faster than anyone predicted.

    image results always have missing hands, blurry fingers, weird limbs, etc.

    AI was picturing hands wrong some time ago, but now it works already.
    I just asked AI to picture human hands and it did it perfectly. I attached the picture.

  • AI was picturing hands wrong some time ago, but now it works already.
    I just asked AI to picture human hands and it did it perfectly. I attached the picture.

    That's not what I asked for. I said that AI can't output a human properly. If you look on the right of your image, you'll see two hands weirdly connected. But if you just ask for hands, duh you get something more like a modern art painting only including hands. If you instead ask for a person using a paint brush to draw a painting, the paint brush can be backwards, the hand missing fingers, or there can be a weird arm. Ask for something more realistic, and you'll see completely wrong results.

  • 🇱🇹Lithuania mindaugasd

    @solideogloria you may like this recent Mark Tegmark TED talk about AI capabilities and what to do next https://www.youtube.com/watch?v=xUNx_PxNHrY

  • TED talks about AI aren't from a science and realistic perspective. Their goal is to hype it and generate money and investments. Again, if you ask a neuroscientist, you'll get a different result. General artificial intelligence is way further away than 3 years; I'd argue it'll never happen. Brain science still doesn't even complete understand how a single neuron works, and we don't as an entire race have the resources necessary to represent a human brain in computer form. We can't even represent a mouse's brain. The brain that's been represented is a worm. Its neural system consists of just 300 neurons, a tiny number compared with the 100 billion found in a typical human brain. The human brain has quadrillions of connections between those, however, it's not enough to replicate those with a computer, as individual neurons also have some memory and learning capabilities. So it's probably more complicated than that, even, to replicate a human brain with a machine.

    https://ai.stackexchange.com/a/1316

  • 🇱🇹Lithuania mindaugasd

    The human brain has quadrillions of connections between those, however, it's not enough to replicate those with a computer

    Human brain is not the most efficient one. Brains of birds are different and are more efficient than brains of mammals. For example, a crow is highly intelligent and has small brain-to-body ratio. Similar to AI - GPT-4 only has 1 trillion parameters and hold so much information, while human brain has up to 1000x more connections (quadrillion). So you don't need at all to replicate number of connections to replicate intelligence and cognitive capabilities.

    my perspective has been made clear. We don't need a debate here.

    Yes, this issue is not the right place, but we can have a separate issue for the debate which could be created under https://www.drupal.org/project/artificial_intelligence_initiative if need be.

  • 🇱🇹Lithuania mindaugasd

    Key good news for completion of this issue (for points described in issue description):

    1. GPT-4 is great at Drupal (On the other hand, not all prominent AIs are).
    2. Drupal's partner Gitlab implemented large set of AI features https://about.gitlab.com/gitlab-duo/ . Drupal's strategy is to migrate to Gitlab more and more. So next task for this issue would be figuring out is it possible to adopt Gitlab's AI features within Drupal ecosystem and update issue description accordingly.
  • Hi 🤚,

    This is a reminder that this issue is in the Drupal Core Ideas queue, which means it is:

    A place to propose ideas for Drupal core and get them through validation and planning phases. All issues marked as “Approved plan” and “Active initiative” together provide a good high level overview of what's being worked on to improve the Drupal core product.

    So issues here must be specific plans for implementing specific things that are larger than ordinary features and are for Drupal Core.

    As it stands, this issue is an overview of what AI technology could do for Drupal, followed by arguments about those. It’s a discussion forum, not a plan. The product managers have nothing here to approve.

  • 🇱🇹Lithuania mindaugasd

    @cilefen thanks for info.

    Initial plan was

    1. Advertise this problem to Drupal core developers in order to come up with solutions.

    Also I liked the machine name "ideas" :-)

    Ok, I think it is fitting to move this issue out. I will be looking into moving it to "drupal.org infrastructure" queue in some time with that queue specific upgrades or replacing it with a new issue there, while gitlab AI features and implementation needs to be explored in more detail before that.

  • 🇫🇷France andypost

    @mindaugasd Gitlab's Duo is totally actionable as issue iin infrastructure project and #gitlab slack channel

  • 🇩🇰Denmark ressa Copenhagen

    @andypost: Thanks, but I and maybe others as well don't use Slack, so maybe you can paste it here?

  • 🇱🇹Lithuania mindaugasd

    @ressa the good news is:

    1:
    Is it fits into current plan to enable Duo if possible? Probably it needs issue to discuss
    https://about.gitlab.com/gitlab-duo/

    2:
    I believe it would be $19/user/month https://about.gitlab.com/press/releases/2024-01-17-gitlab-announces-pric..., with 21k billable users, we’d be just under $400,000/month

    3:
    Just get a sponsor

    This is all, plus emoticons :)

  • 🇩🇰Denmark ressa Copenhagen

    Thanks @mindaugasd, though $400,000/month sounds ... pricey?

  • 🇱🇹Lithuania mindaugasd

    @ressa yes, its probably multiple times more than full budget of association.

  • 🇺🇸United States DamienMcKenna NH, USA

    Can we just say "no"?

  • I agree with @DamienMcKenna. Language models are extremely error-prone, frequently "hallucinate" information, and are extremely expensive to run or host.

    People hate talking to robots when they call a company on the phone ("If you are calling for ... push 1"), and I don't think we want AI models (i.e. software-defined "robots") as a middleman when it comes to issue queues on the site.

  • 🇱🇹Lithuania mindaugasd

    Can we just say "no"?

    "no" you can probably imagine is too little information.

    Language models are ...

    Sounds like you don't like working with them. And I like working with them, its faster and better quality. And it will only get better.

    I'm all for closing the issue.

    As a Drupal user I want this issue to be addressed, because AI will develop applications very quick. I know developers like coding. But I use Drupal not for coding, but because I want to build applications quick and I would like to continue doing that with Drupal. Quick application building and ease of use is why I chose Drupal originally 16 years ago, probably for many other end users these are very important things as well. Like cost, ease and speed are one of the primary factors how people choose solutions.

  • 🇺🇸United States irinaz

    @DamienMcKenna, I am not sure if your comment relates to using GitlabDuo that is indeed too $$$$ or to idea of using AI to support various aspects of Drupal, like triage, to begin with?

  • 🇺🇸United States DamienMcKenna NH, USA

    My "no" is about using any AI software to automate functionality & communication on d.o.

    I'm not saying "no", don't write modules that interact with AI services - that's for folks to decide for themselves.

    I'm also not saying "no" to automating functionality & communication, there's lots of existing "simple" automation in place and I'm sure more to come once we get onto gitlab.

    My line in the sand is combining automation & AI software/algorithms as part of d.o functionality.

    I don't believe that in the year of the cat 2024 shoehorning AI functionality onto d.o because it's the buzzword topic du jour serves us any benefit when there are significantly more important projects to work on.

  • What is the concrete proposal under consideration in this issue?

  • 🇺🇸United States irinaz

    My understanding of this proposal/idea is to research where AI is applicable and possibly building proof of concept rather than instantly launching ChatGPT on d.o. In 2024 all issue will be moved to Gitlab anyway, and developing a prototype/proof of concept to figure out where AI is helpful (for example, providing maintainer with an updated summary of all comments on an issue) and where it is not applicable (for example, deciding on what feature is higher priority for a module). The same AI model should work the same on Gitlab after issues are migrated.

  • 🇺🇸United States irinaz

    Based on https://www.drupal.org/project/ideas/issues/3336313#comment-15425691 📌 Use ChatGPT for solving Drupal issues to increase rate of development Active maybe this issue belongs in a different project. This is not a Drupal core topic, but it definitely belongs in innovation in contributions discussion.

  • Those are published features of Gitlab Duo.

    Is this question now a request to turn Duo on?

  • GitLab Duo Pro is $19 USD per user/month. Wouldn't that be extremely expensive with the number of Drupal users there are?

  • "no" you can probably imagine is too little information.

    Language models are ...

    Sounds like you don't like working with them. And I like working with them, its faster and better quality. And it will only get better.

    I'm all for closing the issue.

    As a Drupal user I want this issue to be addressed, because AI will develop applications very quick. I know developers like coding. But I use Drupal not for coding, but because I want to build applications quick and I would like to continue doing that with Drupal. Quick application building and ease of use is why I chose Drupal originally 16 years ago, probably for many other end users these are very important things as well. Like cost, ease and speed are one of the primary factors how people choose solutions.

    The issue title says "Use ChatGPT for solving Drupal issues", and in your future goals it says:

    Drupal developers guide work of A.I., instead of writing or reviewing most of code/comments/documentation/tests/etc. themselves.

    The value of the Drupal community is that the work is done by humans. If you look at what's happening at Stack Overflow (and the Stack Exchange network), the leadership wants to integrate AI and charge forward to make money, and the userbase wants to ensure all content is human-created, and prevent AI from being used for questions/answers. The value of the site's content is that it's created and reviewed by a human. AI are trained on human data rather than AI data, because AI data is lower quality than human data. If you repeatedly trained an AI on AI-generated images, en[crap]ification would ensue. I don't want Drupal to go in that direction by replacing people with AI in its coding/review processes.

    It's fine to augment the review process, but my point in my prior comment is that nobody in practice would want it completely replaced by AI. You can hypothesize about how AI will get better in the future, but the fact remains that it doesn't currently perform at the level of an intelligent human. AI cannot currently replace me as a web developer, nor will it be able to in the next decade.

  • GitLab Duo Pro is $19 USD per user/month. Wouldn't that be extremely expensive with the number of Drupal users there are?

    It would be, if the Drupal Association has a retail pricing structure with Gitlab, which assuredly, it does not.

  • 🇸🇰Slovakia poker10

    @Freddy Rodriguez The repository of that project is currently empty. Did you mean just the project description?

  • 🇱🇹Lithuania mindaugasd

    Is this question now a request to turn Duo on?

    Ways AI can assist is quite infinite, but motivation and imagination is not in ample supply.

    I just tested gitlabCI https://git.drupalcode.org/project/aichat/-/jobs
    It would have been not too difficult to experiment with fixing cspell, eslist, stylelint, phpstan, phpcs
    or failed tests automatically
    with AI developer assistant help if it would be developed by now.

    Obviously expensive gitlab dou situation, is changing the topic, because AI developer assistant pitchburgh offer was only 12.5K euros to develop first version of the whole Drupal AI ecosystem 🌱 Fully fledged website and module development with Artificial Intelligence Active (Obviously it takes a lot more resources than 12.5K to developed it, but money + pitchuburg votes + support can be a good incentive)

  • 🇩🇪Germany k4v

    The most capable Open Source dev assistant I have seen yet is: https://aider.chat/

    It could be an interesting research project for universities to fine tune an open source LLM on Drupal code base for code generation and see if that could be more capable than OpenAI GPT.

  • 🇱🇹Lithuania mindaugasd

    The most capable Open Source dev assistant I have seen yet is: https://aider.chat/

    Reading aider description it does look like complete solution, similar to one I described in detail more than a year ago in this issue 🌱 Fully fledged website and module development with Artificial Intelligence Active , but not complete since no funding, interest and support. As a 1 person business, I am on my own on this project.

    It is similar except AI developer assistant is meant to be used in the browser with UI as demonstrated in pitchburgh video. Plus it has superior way to edit project specification https://www.drupal.org/project/aiprompt with UI as well. I guess that is great for site builders.

    aider is superior in other ways, because it is simpler to make it outside constraints of the browser. For example, I have not flushed out the details how would I version control the code from inside the browser properly. While with command line AI has all the tools already (git, composer, drush).

    Drupal starshot I think is tasked to enable site builders build websites without the command line. If something is solved to this regard to do Drupal without using the terminal, then AI developer assistant would also benefit.

    universities to fine tune an open source LLM on Drupal code

    That would be indeed project for learning and research, because GPT-4o already do great job given good prompting and patience, so real impact of fine tuning 📌 Training a Large Language Model for Code (Code LLM) - an expert Drupal A.I. Active is questionable (a research question).

  • 🇦🇺Australia pameeela

    In #24 it was pointed out that this issue queue is for Drupal core ideas. Since this isn't proposing anything specific for Drupal core, can it be closed or moved elsewhere? Perhaps into https://www.drupal.org/project/artificial_intelligence_initiative ?

  • 🇱🇹Lithuania mindaugasd

    Yes, it served its purpose and no longer fits Drupal core /ideas issue queue, and also does not fit defined process, I am moving it to AI initiative project.

Production build 0.71.5 2024