Remember the OpenAI Assistant from this recent post? Yep, still up and running, since recently doing so on steroids.
The extra fuel? Custom data. So that your assistant is not only able to rely on ChatGPT’s wisdom on its own, but also to allow it to perform searches, predictions, analyses, based on data you feed to the assistant.
That all might sound pretty straightforward, but unfortunately the implementation itself isn’t. After several attempts, the only scenario that proved working makes use of a random boundary, in combination with a plain text (so not Base64 encoded) body.
The following code, to be implemented inside an Apex method, has proved working with XML, CSV and JSON formats (take a look at the previous post for instructions to set up Subscription Key, Named Credential and other Salesforce to OpenAI integration basics):