Breaking encoding on Retool AI

I'm trying to get an AI translation. I have several entries, each of which has the original text and some of which already have a translation. The AI ​​should return all the records to me already with the translation. But it seems that I am running into an error that has already been raised in several topics on the forum: Breaking encoding on Retool AI in some case, Workflow with OpenAI - Passing through content to summarize does not work and text is not readable by Open AI - #10 by Paulo and possible "charset" Header in RETOOL AI.

I work with: 'Generate chat response' аnd I pass the text in Ukrainian for translation into English: 'And I pass the text in Ukrainian for translation into English'. And then I get different answers from the AI ​​according to the type - the text is encoded, or that it is just a set of characters, and so on.

If I myself encode this text in a string base64. I give the coded term to the AI ​​and tell it to be decoded - everything works. But the answer has to wait for a very long time.

That is, the problem is clearly how the retool itself sends the data.
The topics I referred to are quite old. Question for retool support - have they found a way to fix it? Question to everyone - maybe someone found a better workaround.

Thanks in advance to anyone who can help!

1 Like

Hello @andrii.krykun.1988!

Thank you for bringing this issue to our attention.

It looks like we created an internal ticket for our AI engineers to work on, no updates on that currently. I can add your +1 for this and let you know if anything changes!

It looks like on the other thread a user found a work around using Regex to remove extra characters.

The code snippet they used is {{myTransformerResulsts.value.replace(/[^a-zA-Z/éàïàèùçâêîôûëü\n ]/g, "")}} let me know if that works for you :man_technologist:

Your base64 encoding work around is very interesting, that is unfortunate that it takes a long time. Are you passing the base64 encoded string into the Retool AI query?

Will keep you posted on any updates we have! :sweat_smile:

Hello, thank you for your attention to my problem! I tried removing the unnecessary characters, unfortunately it doesn't help in my case. So far, the only thing that has really worked is the additional encoding of the problematic part in base64 or ASCII. Then I tell the AI to decode that problematic part - and it works. But AI takes a long time to respond.

Very interesting, are there more details about the 'problematic part' of the AI prompt that I can share with our eng team?

Is the problematic part just Ukrainian text? Does it contain any special characters(besides punctuation)? Is it a mix of languages?

It does not depend on whether special characters are present.

Example: 'Треба перекласти слово 'Приклад' з української на англійську мову і повернити переклад' leads to an error: 'I'm sorry, but the string of text you've provided appears to be encrypted or coded in some way. Without more information, such as the type of encryption or code being used, I can't help you to decode or interpret it.' (or similar for other AI versions)

Example: 'Треба перекласти слово Приклад з української на англійську мову і повернути переклад' leads to an error: 'Sorry, but I'm unable to understand or decode unsupported languages or codes. Could you please ask your question or provide your information in plain English?' (or similar for other AI versions)

Example: '"["id: IND001, original: Has a doctor ever told you that you had angina?, translation: Чи говорив вам колись лікар, що у вас був стенокардія?"]"' leads to an error: 'It seems like you have provided a long encrypted string of text. Please provide me with the data objects containing the original text that are to be translated from English to Ukrainian so that I can assist you with the translation.' (or similar for other AI versions)

By the way, the hack with base64 encoding, before sending the text, works only with AI version 4. Version 3.5 also decodes, but always differently and rarely correctly.

1 Like

@andrii.krykun.1988 thank you for the examples!

It seems that we are not properly handling Ukrainian text, I will let our engineers know that the issue is both with strings of Ukrainian characters and when those are mixed with english prompts (which I am surprised the models do not read and understand the instructions).

Which AI model are you using? ChatGPT 4?

gpt-3.5-turbo
gpt-4-turbo
gpt-4

I tried these - they all +- react the same. Just as far as I can see the Retool itself somehow encodes the code. And it is with the Ukrainian language (or rather with all multibyte characters) that there are some problems. As a result, the AI ​​sees part of the information normally, and part as just long coded text. He answers so. Pay attention to the chat_inpat.

1 Like

@andrii.krykun.1988 Thank you for sharing that screen shot!

That is exactly what I need to show the eng team to help them figure out where the bug is. Now they can back track from 'chatInput' to figure out what is happening to the multibyte character.

Will keep you updated on any news on this.

Hello @andrii.krykun.1988!

It looks like we just removed the encoder, give it a shot and let me know if it is working for you now :crossed_fingers: