Add array type in Generate variables action
any workaround for the time being? @baptisteArno
The workaround is to use the Create chat completion action and try to trick it into providing a JSON result
@baptisteArno @andreanicassio the method I've found is to get the OpenAI Assistant to give the result in the form of a list with the elements separated by a comma with no spaces by giving it a precise example of the type of result it should give and then to run a script immediately afterwards to format it as an array.
It's not comfortable, I'd like to be able to generate an array directly. If you think there's something better than my method, let me know here. I've struggled with this problem.
const sujetsGeneration = {{sujets_generation}};
if (sujetsGeneration) {
const sujetsArray = sujetsGeneration.split(',').map(sujet => sujet.trim());
setVariable('sujets_proposition', sujetsArray);
} else {
setVariable('sujets_proposition', []);
}
Yes that’s similar to the workaround I used. I just put in the description of the variable to add values separated by semicolon and then do the split with scripting.
On Wed, 4 Dec 2024 at 09:26, Bastien @.***> wrote:
@baptisteArno https://github.com/baptisteArno @andreanicassio https://github.com/andreanicassio the method I've found is to get the OpenAI Assistant to give the result in the form of a list with the elements separated by a comma with no spaces by giving it a precise example of the type of result it should give and then to run a script immediately afterwards to format it as a list.
It's not comfortable, I'd like to be able to generate an array directly. If you think there's something better than my method, let me know here. I've struggled with this problem.
const sujetsGeneration = {{sujets_generation}};
if (sujetsGeneration) { const sujetsArray = sujetsGeneration.split(',').map(sujet => sujet.trim()); setVariable('sujets_proposition', sujetsArray); } else { setVariable('sujets_proposition', []); }
— Reply to this email directly, view it on GitHub https://github.com/baptisteArno/typebot.io/issues/1870#issuecomment-2516526051, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLDZ73IC4PTJHB2YFOR2L4L2D24B3AVCNFSM6AAAAABRC5TOGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJWGUZDMMBVGE . You are receiving this because you were mentioned.Message ID: @.***>
Can you share your script @andreanicassio so that I understand ? Maybe your solution is better than mine