this is my first automation in Make.com. I thought I had figured it out, but I’ve run into some issues. I’m hoping someone here can help me!
I’m creating an assistant to perform company research.
Here’s the workflow:
Check for new rows in Google Sheet.
Perplexity takes Company Name from Google Sheet and looks for other specified information.
Update the Google Sheet with this information in designated columns.
I realized I need to transform the text data from Perplexity into JSON format so it can be mapped correctly into the Google Sheet
What I tried to do:
I asked Perplexity to output data in JSON format so I could use the Parse JSON module. However, I received an error (* The operation failed with an error. Source is not valid JSON.)
I tried using the OpenAI module to convert text into structured data, and it seemed to be working, but then I got an error: “[400] Invalid ‘functions[0].description’: string too long. Expected a string with a maximum length of 1024, but got a string with a length of 1056.” I was testing on a smaller batch of data, so I’m guessing this approach won’t work on a larger scale.
I also attempted to use the Transform to JSON module, followed by the Parse JSON module, but got another error: “The operation failed with an error. Root value of JSON structure must be an object or array.”
I’ve spent several hours trying to resolve these issues, and I’m feeling stuck. Any suggestions or guidance would be greatly appreciated!
Below you can find screenshots of all three versions I’ve tried. Instead, “Watch new rows” module, I’ve put “Search Rows” as for now there are no new rows.
The prompt asking for JSON should work in the parse JSON module. You just have to get rid of the '“json and the '”. You can use a replace function to delete those text but issue is that the AI might format it differently the next time.
You need to make sure the structure is outputted consistently each time. OpenAI has the structured data module. Perhaps use that instead.
You might consider stating you want JSON output and adding example output within in the prompt. When I require results consistency, I’ll use the CO-STAR framework with example output.
Good structure is always good idea, however Perplexity insisted in providing this format with ```json in the begining… But still - thank you for your reply!
The replace is a hit and miss with Perplexity. I couldn’t get it to work all the time. After removing the ```json it comes out with an invalid JSON error. Instead of tearing off my hair, I used another module to get the data I want so I don’t have to use JSON to separate them.
After few days, I’ve encountered invalid JSON error, as the Perplexity added “```” without json. So I added another replace function so now it looks like this: