Make a test loop in a scenario

Hi.
I am trying to make chatgpt produce a summary with limited number of characters, but can’t manage to do it (see Can't make chatgpt produce a text with limited characters number)

So I am thinking about creating a loop & test:

  • ask chatgpt create a summary
  • test if output is less than X characters long
  • if not, ask chatgpt to make it shorter and test again
  • if output is less than X characters, get out of the loop.

How can I do that in a scenario?

Hi @Pamela1

Could you please share your scenario screenshot?

Please try giving the prompt to create summary to ChatGPT then 2 routes. One with a filter “length” of text > 500, add one more chatGPT module to rephrase the summary in less than 500 words. Another route for “length” of text <= 500 as a result.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

Hey, @Pamela1.
I hope everything is going well for you.

I’ll advise you not to make the scenario more complicated (operational and time-consuming). Alternatively, you might attempt to precisely trigger the GPT. The following tips could assist you in enhancing the chat GPT’s prompting:

  • Establish Proper connection
  • Model (GPT 3.5 Turbo: gpt-3.5-turbo)
  • Role
  • Task
  • Content

Here’s an example how you can prompt…


Let me know if you need any assistance with this.

2 Likes

Like I mentioned in your other question, you can replace point three with “Reduce number of max tokens” (and try again).

One way to reduce the number of tokens per repeat, is by using a negative “step” in the Repeater module.

Screenshot_2024-01-08_210151

This starts of with 500, then 400, then 300

Screenshot_2024-01-08_210109

Then, you can insert this variable into the Max Tokens field.

Screenshot_2024-01-08_210114

3 Likes

@Msquare_Automation here is the screenshot

  1. I trigger with a message to telegram
  2. then I extract the url in the message
  3. I scrapt the webpage from the url to extract content
  4. I send it to a cell in sheets to detect the language (with a sheet function)
  5. I get the la language in another cell
  6. I set a variable depending on the detected language (to publish in the right telegram channel at the end)
  7. I set another variable depending on the detected language (to set the right language code for the buesky/unshape module
  8. one route goes to chatgpt making a long (less than 500) summary of the webpage extracted content. THIS DOES NOT WORK WELL. I publish chatgpt output to mastodon.
  9. the other route goes to chatgpt making a short (less that 280) comment about the webpage extracted content. THIS DOES NOT CREATE PROBLEMS FOR THE MOMENT. I publish chatgpt output TW, BS, TG and a cell in sheet.

I thought about the “two routes” option, but if after second chatgpt rephrase the output is still over 500, then it will break again :confused: