Trouble formalizing a blog post using the API

Hello dear AI lovers, I wrote a blog 3 years ago and I want to formalize posts. I’ve got 300 articles so I was considering automating the process using the API (I’m a dev and musician). I’ve tried manually doing this with some success but the automatic route seems reasonable.

My posts have 5 sections 150 words long each separated by a headline 7 or 8 words long. At first, I was formalizing the markdown with this prompt ‘make it formal’ and sometimes it worked. But after I wanted to give more detailed instructions like find ‘focus keywords for this section’, or 'Find a formal title for this section:

  • result should use title capitalization,
  • result should be a question, 10 to 12 words long,
  • result should include a mix of common, uncommon, power and emotional words (20-30% of common words, 10-20% of uncommon words, 10-15% of emotional words, at least 1 power word)'.

At some point chat gpt told me it was quite complex so I gave up and made simple instructions. But now the API never formalizes the content of the post (the text below the front matter).

I tried sending each paragraph to the api one by one but after sometime it gets stuck. I checked the rate limit problem and I don’t think I’m above limits. Plus, the first paragraphs take like 3s to formalize and then the 7th takes 40s and then it freezes after the 12th or so.

I’m confused. My request is simple and works in the chatgpt ui. What’s the problem?

PS: my latest effort makes two requests instead of several, one to formalize the document, one for the metadata like focus keywords and music associated to the doc

Welcome to the forum.

You might be running into rate limits which you can read about in the docs…

How long are the articles? You might have better luck just feeding the whole article and asking it to “formalize” it… which might need explanation for the model too. Are you using GPT-4?

1 Like

The articles are around 750 words long. Each paragraph is like 40-50 words long. I tried feeding the whole article but the api returns the text unchanged. Going to read the article you sent now.

1 Like

I would write a system prompt like … “You are an experienced copywriter who takes text input and rewrites for a more formal tone.”

Then put the article in a user message and see what it does… If you have an example, I can run it through the Playground…

+1 to this idea. You can completely validate whatever prompt flow and API message payload using the playground.

If things are working via ChatGPT, you might have an issue with your API connector code. Any errors logged or any debug info to share?