Extracting data from OpenAI Output

Hi, I’m building a Whatsapp Chatbot with an OpenAI assitant, and for the last few days I’ve been struggling extracting information from the OpenAI Output to create variables in order to search from specific information in an Airtable or Google sheets database
This step is actually the most important step in all of the scenario because if completed this assistant could have the ability to act as a trained Sales or attention professional with the help of OpenAI.
from the text extracted from OpenAI response {{content.text.value}} if asked to the OpenAI assistant an specific shoe size (for this example my company is a shoe store) the assistant will tell the user that it must conduct a search to give him what shoes are available on that same size, or if given certain details of the product, the assistant would look up for the most adequate option available according to the information given, if the client also asks for a price the OpenAI assistant should go a check on Airtable what is the price for that specific Item.
I;m new to make.com sorry if this same topic was covered on past threads but help with my scenario would be gladly appreciated!
thanks!

Hey @Alberto_Asensio

You might like to investigate prompting your OpenAI to return a JSON object via your system prompt. In your system prompt, give it a few examples of input and then what matching output JSON might look like.

Then in your make scenario, use the Parse JSON module to convert the JSON into make-friendly bundles.

@drnic

1 Like

Welcome to the Make community!

The most reliable way is to probably use the OpenAI “Transform Text to Structured Data” module, or the free GroqCreate a JSON Chat Completion” module.

Example

Here is a Groq example on how to specify the variables that you want to match from the text content. This setup is also similar to what you’d do with the OpenAI Structured Data module.

Output


(Google’s about page didn’t contain any Google email or phone numbers, so it was left empty)

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Hi Alberto,

We have a tutorial detailing how to connect OpenAI’s Assistant API to WhatsApp via Make. It can serve as a starting point for helping you communicate between OpenAI and WhatsApp.