Skip to content
Trouble separating ...
 
Notifications
Clear all

Trouble separating text sections with a parser

18 Posts
4 Users
0 Reactions
5 Views
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Hi everyone! I'm working on setting up an automated cold outreach process. The goal is to have Perplexity (which I'm currently subscribed to) or ChatGPT analyze prospects from my Google Sheet and then generate a personalized cold outreach email. I've encountered an issue when trying to parse the output from Perplexity to separate the email's subject line and body. This separation is needed so I can map them correctly in the email module to construct the email.

I've experimented with both the JSON and text parser (using a match pattern) modules, but both are returning empty results. The JSON parser is even more problematic, as it throws an error: "Validation failed for 1 parameter(s). Missing value of required parameter ‘json’."

I attempted to instruct Perplexity to format the output in a way that would be compatible with the parsers, first trying a text format and then a JSON format. Does anyone have advice on the correct approach? Additionally, would it be better to use a "Watch new rows" module for Google Sheets, so the process only triggers when new data is added?

I'd appreciate any assistance.

 
Posted : 23/06/2024 9:06 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

Hello! Welcome to the callin.io Community!

Could you please share an example output from the Perplexity Module, along with the configuration of your JSON parsing setup?

 
Posted : 24/06/2024 1:44 pm
Anshul_Soni
(@anshul_soni)
Posts: 2
New Member
 

Hi

  • Please share the output bundles from both the Google Sheets and Perplexity modules.
  • Ensure the cell containing the data is correctly mapped to the Perplexity module.

To help clarify your query, please provide the scenario, including both input and output bundles.

 
Posted : 24/06/2024 2:05 pm
Esma
 Esma
(@esma)
Posts: 9
Active Member
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Hi! I've included some screenshots above, and here are a couple more from Sheets and the iterator:

 
Posted : 25/06/2024 1:39 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

Hello,

Thank you for providing all these details!
It appears that the Body field generated by Perplexity contains "carriage returns / line feeds", which is causing the Parse JSON to fail. You do not need to create a Data Structure for the JSON Parser.

Here’s a potential workaround: I’ll let others chime in if they have a better suggestion, but you could ask Perplexity to replace any "new line" characters with a few special characters (e.g., replace them with ||).

This way, the body will not contain any new lines, and your ParseJSON should function correctly.

Another approach is to remove and replace any carriage return within the mapping for JSON. Please see the example below:

Then, when you map the "Body" from Parse JSON into your email Body, you would perform the reverse operation:

I hope this resolves your issue.

Benjamin

 
Posted : 25/06/2024 2:47 pm
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Hi there! Thanks a lot for your input. I gave it a shot, but unfortunately, I encountered the same error. The only way I managed to get the result shown in the screenshot was by removing all formatting and using your string for the parser. However, I still received an error stating that the source is not valid JSON.

I had to upload to Imgur because my browser suddenly stopped responding to the attach buttons everywhere. It's only working for websites where I can directly drop photos into the upload box…

 
Posted : 26/06/2024 10:48 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

Hello.

I realize I provided an incorrect workaround, as it also replaced the new lines between the subject and body, which corrupts the original JSON.

Could you please ask Perplexity to "replace any new line in the body with ||"?

Alternatively:

"Escape any new line character".

The objective is to get a JSON with a subject and body, where the body contains no new lines.

If this still doesn't work, could you download the output from Perplexity and share it here? I can then test it on my end.

Benjamin

 
Posted : 27/06/2024 2:21 am
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Hi there! I've noticed that Perplexity sometimes doesn't adhere to my request to exclude intros, outros, and recaps, only providing the pure email template. This then causes issues with the JSON output. Additionally, it seems to be duplicating the || characters, which is quite unusual. I'm currently using a smaller model optimized for online searching; I wonder if switching to a larger model might yield different results? Regardless, I've attached the complete blueprint for your review so you can see what's happening. I've only connected the initial four modules as I work towards achieving the correct output.

blueprint.json (155.0 KB)

 
Posted : 27/06/2024 2:59 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

Hello,

Thank you for providing all the details.

I conducted a test using ChatGPT, and it was successful.

This is how I configured the completion:

As you can observe, I utilized the System role to instruct it to generate a JSON containing the desired fields. The final "JSON Object" field isn't strictly necessary; the crucial part is specifying the task for the System.

I assigned the Assistant role to inform it that it excels at Cold Outreach; I'm uncertain if this makes a difference.

:grin:

And then I entered my User prompt. I omitted the final request for a subject and body, as I had already detailed this in the System role.

The notable aspect is that ChatGPT automatically escaped newline characters with n, which is ideal as it can be used directly without disrupting the Body.

Therefore, since Perplexity appears to overlook this, you can explicitly request it.

Could you please try the following:

  • Add a System role with the instruction: "generate a JSON file with a 'subject' and 'body' fields. In the body field, escape all special characters, for instance replace newlines with n"
  • Add an Assistant role: "you are expert in cold outreach"
  • Add your user role. You can also include the same information about escaping special characters. However, try without it first.

Kindly inform me of the results.

Benjamin

 
Posted : 27/06/2024 3:49 pm
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Oh no! I forgot to set the system message. Okay, now I'm seeing the same output from perplexity, but I'm still encountering an error with the JSON parser. I suspect I haven't configured the parser correctly. Here are my updated screenshots:

 
Posted : 27/06/2024 4:59 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

You don't need to define a data structure; it will parse automatically if the JSON is valid.

Based on the image, it appears correct. However, you no longer need to replace || as we don't prompt for that replacement anymore.

It seems to be removing any new lines, which is unusual.

 
Posted : 27/06/2024 5:47 pm
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

I've managed to achieve the exact same output format as yours and have removed the JSON string that was attempting to replace special characters. However, it's still not functioning correctly. I sincerely apologize for consuming so much of your time! I've captured new screenshots to illustrate the issue. Additionally, if the problem persists, I plan to implement a somewhat "hacky" workaround by using two perplexity modules sequentially. The second module will be tasked with generating a compelling title for the text produced by the first. Subsequently, I can map each of the message.content functions to the appropriate fields within the email module.

 
Posted : 28/06/2024 10:57 pm
Benjamin_from_Make
(@benjamin_from_make)
Posts: 35
Eminent Member
 

Hello!

Don’t worry! I just hope we’ll manage to get it working with callin.io. The first screenshot with the text seems good; is it from a recent call you had?

If you're seeing this output, the Parser should be functioning correctly.

The second screenshot has an issue, as it appears to have added three quotes (´´´) at the beginning and end of the content field, which is breaking the JSON parsing.

If these characters are consistently added, we could implement a replace function to change these 3 quotes to an empty string. This would resolve the issue.

However, if it continues to change and add other characters, it becomes a bit more complex.

So, you can try this:

But again, if it sometimes adds another type of character, it will stop working. This workaround is only effective if Perplexity consistently returns these 3 quotes at the beginning and end of the “content”.

Another approach is to extract only the content within { and } using a regular expression. However, this would require an additional module, which might not be ideal. In that scenario, you could also consider the workaround you mentioned, involving two Perplexity calls.

Furthermore, the content from the first screenshot you just shared is accurate. Therefore, if you can consistently generate a prompt that produces this output, you should be able to parse the JSON successfully.

Benjamin

 
Posted : 29/06/2024 5:18 am
Esma
 Esma
(@esma)
Posts: 9
Active Member
Topic starter
 

Hi! I discovered that with instruct models, they don't append extra characters, but the JSON parser still isn't functioning. It worked for you with ChatGPT, and I'm now curious if it simply doesn't work with the perplexity module? If you'd like, I can send you the updated bundle and generate a temporary perplexity API key exclusively for you to utilize the exact same module and observe the output you receive.

 
Posted : 29/06/2024 11:56 am
Page 1 / 2
Share: