feat: introduce new agent - [#3517117]
This PR introduces a new AI agent, the BlockContentAgent, designed to handle tasks related to Drupal block content types. Reviewers should concentrate on the following specific changes:
-
prompts/block_content_agent/answerQuestion.yml:- Creation of a new prompt file
answerQuestion.ymltailored for answering questions about block content types. - Review the prompt's
introduction,formats, andone_shot_learning_examplesto ensure they are clear, accurate, and cover various question types.
- Creation of a new prompt file
-
prompts/block_content_agent/determineBlockContentTypeTask.yml:- Creation of a new prompt file
determineBlockContentTypeTask.ymlto analyze user input and determine the intended action (create, edit, delete, information). - Review the prompt's
introduction,possible_actions,formats, andone_shot_learning_examplesto ensure they are comprehensive and align with the agent's capabilities.
- Creation of a new prompt file
-
src/Plugin/AiAgent/BlockContentAgent.php:- Creation of the
BlockContentAgentclass, which extendsAiAgentBaseand implementsAiAgentInterface. - Review the class properties, including
$questions,$result,$data, and$taskType. - Examine the
createmethod and its dependency injection. - Verify the correctness of methods like
getId,agentsNames, andagentsCapabilities, paying close attention to the agent's name, ID, description, inputs, and outputs. - Analyze the implementation of methods such as
setData,isAvailable,isNotAvailableMessage,getRetries,getData,answerQuestion,getHelp, andhasAccess, ensuring they are appropriate for the agent's functionality. - Critically review the
determineSolvabilitymethod and the logic for determining the task type. - Carefully examine the
solvemethod and the methods it calls (createBlockContentType,editBlockContentType), ensuring correct handling of create, edit, and other actions. Note the placeholder fordelete. - Assess the
checkRequirementsmethod and its implementation. - Analyze helper methods like
getBlockContentTypes,getBlockContentTypesAsString,getVerboseBlockContentTypesAsString, anddoesBlockContentTypeExist, verifying their accuracy and efficiency.
- Creation of the
Key Review Focus:
- Prompt definitions and their effectiveness in guiding the AI.
- Agent capabilities and their accurate representation in the code.
- Correctness of the agent's logic for handling different tasks.
- Adherence to Drupal coding standards and best practices.
Edited by Andrii Podanenko