How to Build an AI Content Pipeline: Why One Prompt Isn’t Enough

Abhinav Krishna K S Avatar

Ask an LLM to “write a blog post about X” and you will get something that looks fine at a glance. Read it twice and the problems show: padded paragraphs, repeated ideas, a length nobody asked for, and the occasional confident mistake. For my internship at Valentius Kryptix, I built an AI Content Pipeline that tackles this by splitting the job into stages and checking the output at each one.

What the pipeline does

The pipeline takes a topic plus three settings (tone, audience and length) and produces a structured blog post in four stages:

  1. Outline: the model returns a JSON outline with a title, a hook, 3 to 8 sections, key points for each section and a closing takeaway. The code validates the JSON and retries if it is malformed or has the wrong number of sections. The word budget is split across sections in code, not by the model.
  2. Draft: the intro, each section and the conclusion are written separately from the outline. Each section call also receives the end of the text written so far, so the post reads as one piece instead of five disconnected ones.
  3. Refine: an editing pass removes repeated phrases and repeated sentence openers, strips filler and adds transitions. If a source file is supplied, a fact-check pass compares the draft against it and corrects contradicted claims. Any edit that changes a heading or the length by too much is rejected.
  4. Guardrails: four automatic checks decide whether the post is acceptable (more on these below).

It runs from the command line, with options for tone (beginner, technical, casual or professional), audience, length (short, medium, long, or a custom word count) and an optional source file.

Testing on three different topics

To check it wasn’t tuned to one lucky topic, I ran it on three very different subjects:

  • How vector databases power modern AI search (beginner tone, 1,084 words against a 1,000 target)
  • Why the Transformer architecture changed NLP (technical tone, 736 words against a 700 target)
  • How UPI changed digital payments in India (casual tone, 1,600 words against a 1,500 target)

All three passed every guardrail, and the tone difference is clear. The beginner post leans on analogies, the technical post uses equations and hardware detail, and the UPI post is conversational and full of chai-stall humor.

Lesson 1: Fix length problems in the prompt, not after the fact

My first drafts for a 700-word target came out at about 1,000 words, roughly 43% over. I tried trimming afterwards and it barely helped: each pass removed only 10 to 20 words. The real cause was my own draft prompt, which demanded “2 to 3 paragraphs of 3 to 5 sentences” per section. Five sections of that can never fit in 700 words. Once I made the paragraph rules depend on each section’s word budget and added a hard ceiling, the draft stage landed close to the target on its own. Constrain the model where the content is created, not where it is cleaned up.

Lesson 2: Guardrails need tests of their own

A guardrail that always passes is useless, so I tested mine with deliberately bad input. A pasted outline fails the “not just the outline” check (12 of 12 key points copied, only 0.7x expansion). A 100-word text fails the length check, and so does a 1,000-word text with a 700-word target.

Testing also exposed two flaws in my own checks. The structure check wrongly flagged the one-paragraph conclusion, and the outline-copy threshold was too strict for short posts, so I recalibrated both. Checks need to be tested against bad and good output, otherwise they only measure what you assumed.

Lesson 3: LLM fact-checkers have blind spots

To test the fact-checker, I wrote a draft with three planted errors: that vector databases use exact keyword matching, that HNSW gives perfectly exact results, and that PostgreSQL cannot store vectors. It found and corrected all three from the source file.

Then I ran it on the real Transformer post, and it reported zero issues. Yet the post said attention scores are divided by the “inverse square root” of the key dimension. The correct operation is dividing by the square root. I only caught this by reading the post myself and fixed it by hand. So the checker is reliable on blatant contradictions and can miss subtle technical wording, and it can’t verify anything outside the source I give it.

Where it still falls short

I would rather be honest about the weak spots:

  • Length enforcement can pad. Expanding the vector post from 717 to 1,084 words added generic filler in the final sections.
  • The refinement safety check rejected the UPI post’s edit, so that post shipped without a refinement pass.
  • My repetition metric counts repeated phrases, not repeated ideas. The UPI post still reuses the same jokes.
  • Output quality depends on the model. I had to switch models midway because of availability and quota limits.

Takeaway

A pipeline beats a single prompt because each stage has one job and can be checked. But checking has limits too: the automated guardrails measure structure, length and repetition well, and they cannot confirm that every claim is true. For anything published, a human read-through is still part of the process.

Try it yourself: https://github.com/KRISH18833/ai-content-pipeline

Abhinav Krishna K S Avatar

Leave a Reply

You May Love