Blog Content Editor Powered by LLM
I decided to use the OpenAI API to proofread and improve all the content on this blog.
First, I created a script to reformat all the posts to remove redundant new lines, such as single new lines in a paragraph that don’t affect text layout. This was done to make it easier to review changes generated by the AI-powered content editor.
Then, I developed another script to call the OpenAI API with a simple prompt asking ChatGPT to proofread and enhance the input content. I ran this on each blog post. The prompt explicitly asks to minimize the number of changes because I wanted to correct grammar mistakes and make the posts easier to read while reducing the amount of non-original content.
format_post.py
- Removes redundant new lines from a post.post_diff.py
- Compares post content to check for differences other than new lines. I used this script to verify that the result offormat_post.py
didn’t change the post’s content.proof_read.py
- Generates an improved version of the input content.
The result is satisfactory. I spent some time manually reviewing the output from the LLM. It didn’t hallucinate much. In some cases, it unnecessarily wrapped the entire post content in a markdown code block, but overall, the level of utility provided by tools such as the ChatGPT API is quite impressive.