I have a basic flow set up; Microsoft 365 Email set to look for unread emails in ‘Inbox’ > OpenAI to look at the ‘Body: Content’ and send to an assistant to write a response and send back to Microsoft 365 email which will save the response as a draft.
However, I am getting an error :“[400] Invalid ‘messages[0].content’: string too long. Expected a string with maximum length 32768, but got a string with length 46892 instead.”
Which seems to be because the body is comprised of a lot of HTML styling, so it is exceeding the character limit for OpenAI.
What I am wondering is if anyone else has come across this problem and how they overcame it. Is there a way of stripping out the HTML and just having the text from the Microsoft 365 email read?
There are a few options. You could do this ‘inline’ with the stripHTML() function. So you wrap your text from M365 in the OpenAI module with the stripHTML() function. This will strip away all the HTML tags: