FAQ

Frequently Asked Questions

Aiomatic Plugin Custom Filters Documentation

My goal is to build the Aiomatic plugin, so it offers unparalleled customization, enabling you to accomplish any task you desire. Because of this, I added the ability to use custom filters to modify the prompts and the AI generated content, during the plugin’s execution.

Introduction to Custom Filters

Custom filters in the Aiomatic plugin are PHP functions that allow you to intercept and modify different stages of the AI writing process. These filters act as hooks, enabling you to insert your custom logic and manipulate the AI’s queries, replies, embeddings, images, voice texts, video texts, and more. By utilizing these filters, you can tailor the plugin to meet your unique requirements and achieve a highly customizable AI writing experience.

List of Custom Filters

1. aiomatic_is_ai_query_allowed

  • Description: This filter determines whether an AI query is allowed to be executed or not.
  • Parameters:
    • allowed_value (boolean): Current status of whether the AI query is allowed or not.
    • prompt (string): The AI prompt which should be filtered and checked if it is allowed to be executed.
  • Return Value: Boolean value (true to allow, false to disallow).

2. aiomatic_modify_ai_query

  • Description: Use this filter to modify the AI query before it is sent to the AI engine.
  • Parameters:
    • prompt (string): The original AI prompt.
  • Return Value: Modified AI query (string).

3. aiomatic_modify_ai_reply

  • Description: This filter allows you to modify the AI’s reply before it is processed further.
  • Parameters:
    • reply (string): The original AI reply.
    • prompt (string): The prompt based on which the content was generated.
  • Return Value: Modified AI reply (string).

4. aiomatic_modify_ai_error

  • Description: Use this filter to handle and modify AI-related errors that occur during the writing process.
  • Parameters:
    • error (string): The AI error message.
  • Return Value: Modified AI error message (string).

5. aiomatic_modify_ai_embeddings

  • Description: This filter enables you to modify the embeddings received from the AI engine.
  • Parameters:
    • embeddings (string): The original embeddings.
  • Return Value: Modified embeddings (string).

6. aiomatic_is_ai_edit_allowed

  • Description: This filter determines whether the AI’s editing feature is allowed or not.
  • Parameters:
    • allowed_result (boolean): The return value when the operation is allowed. Default is true.
    • instruction (string): The instruction which was sent to the AI editor
    • text (string): The text which should be edited
  • Return Value: Boolean value (true to allow, false to disallow).

7. aiomatic_modify_ai_edit_instruction

  • Description: Use this filter to modify the AI’s editing instructions.
  • Parameters:
    • instruction (string): The original editing instruction from AI.
    • text (string): The text which should be edited
  • Return Value: Modified editing instruction (string).

8. aiomatic_modify_ai_edit_content

  • Description: This filter allows you to modify the content that the AI has edited.
  • Parameters:
    • content (string): The original edited content by AI.
    • text (string): The text which should be edited
  • Return Value: Modified edited content (string).

9. aiomatic_is_ai_image_allowed

  • Description: This filter determines whether the AI’s image-related functionality is allowed or not.
  • Parameters:
    • allowed_result (boolean): The return value when the operation is allowed. Default is true.
    • prompt (string): The prompt which was sent to the AI image creator
  • Return Value: Boolean value (true to allow, false to disallow).

10. aiomatic_modify_ai_image_query

  • Description: Use this filter to modify the AI’s image-related queries before they are sent to the AI engine.
  • Parameters:
    • query (string): The original AI image prompt.
  • Return Value: Modified AI image prompt (string).

11. aiomatic_modify_ai_voice_text

  • Description: This filter allows you to modify the AI’s generated voice text.
  • Parameters:
    • voice_text (string): The original AI voice text.
  • Return Value: Modified AI voice text (string).

12. aiomatic_modify_ai_video_text

  • Description: Use this filter to modify the AI’s generated video text.
  • Parameters:
    • video_text (string): The original AI video text.
  • Return Value: Modified AI video text (string).

13. aiomatic_embeddings_reply_raw

  • Description: This filter provides access to the raw AI embeddings reply data for advanced manipulation.
  • Parameters:
    • reply (object): The raw AI embeddings reply data.
    • embeddings_string (string): The original embeddings text
  • Return Value: Modified raw AI embeddings reply data (object).

14. aiomatic_ai_reply_raw

  • Description: Use this filter to access the raw AI reply data for advanced manipulation.
  • Parameters:
    • reply (object): The raw AI reply data.
    • prompt (string): The original prompt text
  • Return Value: Modified raw AI reply data (object).

15. aiomatic_edit_reply_raw

  • Description: This filter provides access to the raw AI editing reply data for advanced manipulation.
  • Parameters:
    • reply (object): The raw AI editing reply data.
    • instruction (string): The original instruction text
    • editable_text (string): The original editable text
  • Return Value: Modified raw AI editing reply data (object).

16. aiomatic_dalle_reply_raw

  • Description: Use this filter to access the raw AI DALL-E reply data for advanced manipulation.
  • Parameters:
    • reply (object): The raw AI DALL-E reply data.
    • prompt (string): The original prompt text
  • Return Value: Modified raw AI DALL-E reply data (object).

17. aiomatic_stability_reply_raw

  • Description: This filter provides access to the raw AI stability.AI reply data for advanced manipulation.
  • Parameters:
    • reply (object): The raw AI stability reply data.
    • prompt (string): The original prompt text
  • Return Value: Modified raw AI stability.AI reply data (object).

How to Use Custom Filters

To utilize the custom filters provided by the Aiomatic plugin, follow these steps:

  1. Identify the filter that corresponds to the aspect you want to modify or intercept.
  2. Create a custom PHP function in your theme’s functions.php file or in a custom plugin file.
  3. Inside your custom function, implement the desired logic to modify the data as required.
  4. Hook your custom function into the corresponding filter using the add_filter function.

Here’s an example of how to use a custom filter:

// Custom function to modify AI reply before processing further
function custom_modify_ai_reply($reply) {
    // Add custom logic here to modify the AI reply
    $modified_reply = $reply . " (modified)";
    return $modified_reply;
}
// Hook the custom function into the aiomatic_modify_ai_reply filter
add_filter('aiomatic_modify_ai_reply', 'custom_modify_ai_reply');

By using custom filters, you can tailor the AI writing process to meet your specific needs and create a more personalized experience for your users.

CodeRevolution Knowledge Base

Video tutorials