The Retry Policy in the NextGenAiAssistant module ensures the smooth handling of content generation tasks in scenarios where the AI model returns an invalid response or an error occurs during processing. This mechanism is particularly helpful for maintaining workflow reliability without requiring manual intervention.
What is the Retry Policy?
The Retry Policy allows the system to automatically retry content generation requests when certain issues occur, such as:
- Invalid Response Format: The AI model returns a response that cannot be decoded or parsed correctly.
- Processing Errors: Errors encountered while saving or handling the response.
When a retry is triggered, the system:
- Creates a new thread with the same parameters as the original request.
- Resubmits the prompt to the AI model for processing.
Configuration of Retry Attempts
The number of retries can be configured in the module settings.
- Default Value:
0
retries (disabled by default). - Range: You can set the retry count between 0 and 5.
If the retry count is greater than 0
, the system will attempt to resend the request up to the specified number of times.
Example:
If you set the retry count to 2
:
- The first attempt fails due to an invalid response.
- The system retries up to 2 additional times, creating a new thread for each retry.
- If all retries fail, the thread remains in an error state, and manual intervention may be required.
Important Considerations
⚠️ Costs Associated with Retries:
Each retry creates a new thread and resends the content generation request to the AI model. This means that retries incur additional costs because they consume credits.
⚠️ Use Retry Policy Wisely:
While retries can improve reliability, setting a high retry count can lead to increased credit usage if errors persist. We recommend starting with a low retry count (e.g., 1
) and only increasing it if absolutely necessary.
How to Configure the Retry Policy
To adjust the retry settings:
- Go to the NextGenAiAssistant > Configuration section in your PrestaShop admin panel.
- Locate the Retry Attempts setting.
- Enter a value between
0
and5
. - Save the configuration.
The changes will take effect immediately, and any failed tasks will now follow the new retry rules.
Monitoring Failed Jobs
If a job fails after all retry attempts:
- It will be logged in the Job Logs section with the status “Failed”.
- You can manually retry the job using the Retry Job button in the Job Logs interface.
Refer to the Job Logs and Retries Guide for more information on monitoring and managing failed tasks.
By carefully configuring the Retry Policy, you can improve the reliability of AI-driven content generation while maintaining control over credit usage and system behavior.