Using ChatGPT in Merlin Backoffice ® Flex for PrestaShop
When you combine the incredible power of two tools like Sitolog's fast PrestaShop Merlin Backoffice ® Flex catalog administrator and OpenAI's ChatGPT generative AI, you get an explosive cocktail, an e-commerce site manager like no other. The potential is so enormous that it's hard to summarize.
As this is the first article on the subject, we're going to show and explain the interface in detail, but in a simple example where we'll be asking ChatGPT a single question (a single prompt).
Prerequisite: you must already know how to use MagicEdit in Merlin Backoffice ® Flex and have already configured it and connected it to the API with your secret key, as explained in detail in the previous tutorial.
Launching the ChatGPT dialog interface
The list of products covered by this exercise is a collection of posters for children's bedrooms, illustrating the best-known heroes.
At this stage, only the names of the products are filled in, in the generic form "Poster de <nom du héros>".
We'll ask ChatGPT to serially write the long description of each poster. Each product will of course have its own unique description, built with reference to the hero, the poster's subject, but this will be handled automatically.
As seen in the previous article on configuration, the ChatGPT tool in Merlin Backoffice ® Flex is available in MagicEdit.
As a reminder, it launches by selecting rows, positioning yourself in the column to be modified or filled in (in this case it's the long product description) and selecting the tool from the drop-down menu, as in the English screenshot below:
ChatGPT roles and instructions
The aim of this article isn't to teach you how to chat with ChatGPT - there are already thousands of tutorials for that. However, it's worth remembering that a successful request often begins with a description of the role you want the robot to assume and the instructions it must follow.
This allows the robot to "understand" the context and refine its answers. For example, summarizing a text is not the same as translating it, and requires different skills (the role).
Merlin Backoffice Flex includes a special field for writing your instructions and explaining to the robot what role it should play: translator, editor, SEO specialist, mathematician, teacher, etc...
However, this step is optional. For very simple questions, it's not necessary. By default, if nothing is specified, the robot assumes the role of "helpfull assistant".
The instructions often concern the editorial style to be adopted, the length of the expected text, the desired formatting...
For this first exercise together, the instructions given are as follows:
You're an assistant helping me write content for a children's bedroom decoration website. In particular, I'm going to ask you to write a complete description of a hero poster. The posters are available in different sizes and two qualities of paper (glossy 80g and glossy 110g). Please don't exceed 1200 characters. I want your description to be about the hero I'm going to tell you about.
Enter it in the right field of the form like this (for the settings above, see or review the previous article which explains this part in detail):
Roles and instructions" collection
To help you memorize and reuse your role texts and instructions, we've also included a bookmarking tool, in a collection we've provided with a few directly usable examples.
- Button to open the roles and instructions collection.
- The collection window.
- Simply drag and drop text from the collection window into the "Role and instructions" field in the MagicEdit window.
- The yellow star allows you to bookmark the text currently in the left-hand window, i.e. to add it to your collection of roles and instructions.
- You can give each instruction a title, to help you find them more quickly.
- And, of course, remove from the collection those you never intend to use.
Writing the question, also called prompt
A prompt is the task or question ChatGPT is asked to perform. In traditional use, the prompt is often a simple question or request for information. In e-commerce use, it is more often a more complex task, such as correcting an existing text, producing a summary, translating it, writing an article...
You'll see that the interface lets you write up to 4 prompts in a single query. We'll look at the notion of multi-prompt queries in a future tutorial. At this stage, let's just say that it allows you to generate a kind of dialogue with several round-trips, helping ChatGPT to refine its responses in several stages.
For this first test, we'll use a single prompt.
This prompt will be sent several times to the robot by Merlin, in fact as many times as there are lines selected. But it will be slightly different for each line or product, thanks to the parametric prompt concept.
A parametric prompt is one in which one or more parts of the text are variable, replaced by text read from the table, in another column for example.
We're going to use this technique here to provide it with the name of the product, which contains the name of the hero of each poster. To do this, type "This product is a " at the beginning of the question, and look for the item to be inserted, in this case "Name", in the drop-down list containing the other columns in the display.
- 1st prompt, start question entry.
- Click on the button to display the list of available columns.
- Click on the item to be inserted, the product name.
This simple operation inserts the selected "parameter" into the text, enclosed in square brackets. When the question is sent, this parameter will be replaced line by line by the name of the product read from the table, such as "Mickey Mouse Poster". The start of the question will therefore be "This product is a Mickey poster..." for the first line, then "This product is a Donald poster..." for the second line, and so on.
The "Current value" button allows you, with a single click, to insert, also in parametric form, the value contained before MagicEdit was launched, in the column you wish to modify. This makes it possible to write prompts in the style "Optimize the following text: [Current value]".
The "Modified value" button fulfills almost the same role, except that the text inserted is the actual text, potentially modified by MagicEdit's other tools, placed above the ChatGPT block, if they've been activated.
Writing the end of the prompt
We complete the prompt with our request to write a lengthy commercial description of the product, if necessary reiterating certain important instructions. It's often advisable to ask the customer not to comment on the answer, nor to enclose it in quotation marks.
The text here will be as follows:
Write a nice commercial description following the instructions I've just given you, without forgetting to mention the hero, which will make children want to buy it and help the sales page to be referenced by Google. Return the description alone in your reply, without surrounding it with quotation marks and without any comments, as it will be inserted as is on our sales site.
- The complete prompt
- Click on Phase 1... to submit the request to ChatGPT. This establishes the connection and sends the instructions and the first prompt (one per product line). Once the robot has responded, if you've written a second prompt, it's submitted immediately, and so on up to the 4th.
Collection of "prompts"
As with the roles and instructions, we've also included a bookmarking tool, in a collection of prompts. We've also provided a collection of examples that can be used directly, for SEO, translations, summaries, proofreading...
- Button to open the prompts collection.
- Prompt collection window.
- Simply drag and drop text from the collection window to any of the prompt fields 1 to 4 in the MagicEdit window.
- The yellow star allows you to bookmark the text currently in the left window, i.e. to add it to your collection of prompts.
- You can give each prompt a title, to help you find them more quickly.
- And, of course, remove unnecessary prompts from the collection.
Automatic management of robot flow and volume limits
The previous tutorial has already covered this point in detail. ChatGPT imposes various limits, both on the maximum frequency of requests and on their size.
Fortunately, Merlin Backoffice ® Flex knows how to manage these limits for you, to prevent the AI engine from returning an error for exceeding the authorized capacity.
To do this, it keeps a time-stamped count of the prompts sent, memorizes the size of questions and answers and, when necessary, pauses itself. You can then choose to accept the waiting time, or stop the whole thing (it keeps the answers received for lines already processed):
Line-by-line presentation and validation of results
At the end of the job (or in the event of a stop), MagicEdit shows you the Before/After result, line by line.
- Navigator to review the changes made to each line.
- Cell content before the operation (in our example, the descriptions were empty).
- Content at the end of the operation (in our example, this corresponds exactly to the answer provided by ChatGPT). Note in passing that it has not precisely respected our instruction not to exceed 1200 characters. This response contains 1274 characters (counter above the field). ChatGPT is very bad at math.
- Button to move to the next line.
- Or to the previous line.
- To completely undo any changes made to this line.
- You can also manually make changes to the new content.
Final validation or complete cancellation
- Here we've reached the last line check (5 lines were selected and modified). Note that you don't have to go through all the lines.
- You can then either cancel the whole operation (the MagicEdit interface remains open, allowing you to refine your query and resubmit it).
- Or, on the contrary, validate it and save the changes in the database.
Final result after validation
The modified column is updated:
Cleaning responses
ChatGPT is often too talkative and comments on its own answer. For example, if you ask him what Zorro's real name is, he'll answer something like : Zorro's real name is "Diego de la Vega". Or if you ask him to translate a text, he'll almost always start the answer with "The translation of ... is ...".
To avoid these superfluous texts, you can indicate in the instruction and/or prompt to be more direct, which we have done successfully in the example above, by including in the prompt "Return the description only, without quotation marks and without any comment, as it will be inserted as is on our sales site".
However, this technique has a cost in chips, as it lengthens the prompt and doesn't work 100%. The robot tends to do as it pleases.
On a remarqué que ChatGPT entoure souvent la partie interessante de sa réponse entre guillemets doubles. You can also formally instruct him to surround it with separators of your choice (eg: in your answer, circle the part translated into English between two square brackets []. ).
So we've included a simple option in our tool that allows you to clean up once you've received the reply, simply by removing the text before and after the separators (included), which you can specify:
Concatenate or delete existing content
Finally, note the last option in the above screenshot, "Add response...", which concatenates the final result with the current field content. By default, if this box is unchecked, the current content is erased and replaced by ChatGPT's response..
It's up to you to try...
Category's other articles ChatGPT and PrestaShop
-
Configuring ChatGPT in Merlin Backoffice Flex
Tuto
PrestaShop makes it possible to mass-edit articles with ChatGPT and Merlin Backoffice. This article explains how to set it up properly.
-
How to write a prompt
Guide
Tips and tricks for writing efficient prompts in Merlin Backoffice for PrestaShop
-
Optimisation SEO H2 des fiches produit avec Tchat GPT