Run GPTfy using AI Mass Processing

Picture of Kalanithi Balasubramanian

Kalanithi Balasubramanian

Updated on December 16, 2024

This article outlines the steps to configure the product to run prompts on records in a batch process and schedule these processes.

Step 1: Create a New AI Mass Processing by clicking on the New button

  • Select the AI Mass Processing tile from Cockpit.
  • Begin by initiating the creation of a new scheduler. Locate and click the “New” button within the GPTfy interface.
  • Within the AI Mass Processing creation window, provide the following details:
    Name: Assign a suitable name to the scheduler.
    Scheduling Frequency: Choose the desired frequency for the scheduler’s execution.
    Schedule Time: Specify the time at which the scheduler should run.
  • As you input these details, a Cron expression will be generated automatically.
  • Depending on the selected frequency, the scheduled time format will adjust accordingly.
 

Step 2: Add a New prompt scheduler

  • Proceed to add a new prompt scheduler by selecting the “New” option.
  • Provide detailed information for the prompts to be included in the scheduler:
    • Where Clause (if needed): Specify any conditions the Mass processing should follow based on values within the record set.
    • Record Limit: The default value is set to 2, which restricts the number of records processed in each batch.
    • Cross Object Filter Condition: This is the field that shows the numbers of the Cross Object Filter conditions(1 AND 2,1 OR 2, etc.) that are created by the user. The more information about Cross Object Filters is given below –

Query Builder: A tool that helps you create a where clause to filter out the specific records. No need to learn complex SOQL syntax!

To open the Query builder, click on the Pencil icon in the field Where Clause.

Cross Object Filters – This is the query builder that helps to qualify the Parent record for processing according to the child record. Users can define the conditions on child records. On that basis, parent records will be qualified.

For example, suppose the account is the parent object, and then the user can add the condition to qualify the account record where the respective contact having the department is banking.

The COFi filters* will be added to the related objects, and the parameters below have to be added by opening the prompt scheduler record.

*COFi filters act like checkpoints to ensure only the intended tasks are processed. You can configure them to consider specific data points (like date, priority, or other relevant attributes) and define conditions those points must meet for a task to proceed.

  • Sequence: This number determines the order in which multiple COFi filters are applied. Lower sequence numbers are processed first.

  • Operator: This specifies the condition for records to meet for the filter to pass.

  • Qualify Count: This number indicates how many conditions within the filter’s Where Clause (explained below) need to be met for the filter to pass.

  • Where Clause: This clause defines the specific criteria for filtering the data. It’s likely written in a query language and specifies which data points should be considered based on the chosen operator and qualify count.


The following screenshot shows the above scenario in Cross Object Filter.

So, after saving the cross-object filter, the prompt scheduler looks like the one below.

Step 3: Execute the Mass Processing

  • When clicked on the “Schedule” button it will be scheduled as per the criteria set in the schedular
  • Click on “Unschedule” button to cancel the AI Mass processing schedular
  • Click the “Run Now” button to initiate an immediate execution of the Mass Processing.
    The Mass Process will trigger the execution of the associated Apex job.
    This action will create a scheduled run record based on the number of records in for each prompt scheduler.
    Navigate to the related list on the scheduled run record to access additional information.
    Verify the response records that have been generated.
  • On the scheduled run’s Details tab, you will find “Metrics,” which has the following parameters:

    • Total Records: Shows the number of records qualified for the run
    • In Progress Records: When the schedular is running, all qualified records will be in progress, and once it’s processed, it becomes zero (0)
    • Completed Records: The number of records on which the prompt ran successfully
    • Errored Records: Due to some reason, the records were not processed; for example – the character limit exceeded the max total tokens
    • Disqualified Records: Records that were not qualified for any reason. Such as Visibility conditions or COFi filters 
    • Processed Records: Number of records that were processed (Completed Records + Disqualified Records)

Retry Count – Handling Errors

  • If any errors occur during the process, the status will be marked as “Errored.”

  • Depending on the retry count, the system will reprocess the errored records, and the error message will be cleared.