How do I remove the 2 line breaks that OpenAI returns in the beginning of each response within TB?

Hello everyone!

I’ve implemented OpenAI into TB, but, by default, their API responses include 2 line breaks “\n\n” before the answer.

I’ve found this post in their community where someone offers the following Java Script solution:


“choices”: [
“text”: “\n\nThis is indeed a test”,
“index”: 0,
“logprobs”: null,
“finish_reason”: “length”

JS call would be choices[0].text.trim()

I’ve played around with my pipe responses but I got no luck making it work.

Does anyone know if this/something similar would be possible to implement?

@tim.young did you possibly overcome this while using Open AI by chance?

Thanks in advance!

This should work, in my test it worked

Create a new variable in your data table by using an equation with the following line

RIGHT({text}, LENGTH({text}) - 4)
1 Like

Thanks a lot @Peter !