Practice: Prompt Engineering Mastery
Practice generating text using a simple statistical model and evaluating the quality of generated content.
10 min•By Priygop Team•Updated 2026
Practice: Evaluate Generated Text Quality
Practice: Evaluate Generated Text Quality
# Practice: Evaluate the quality of AI-generated text
# Identify hallucinations, inconsistencies, and factual issues
ai_generated_samples = [
{
"prompt": "What year was Python programming language created?",
"generated": "Python was created by Guido van Rossum and first released in 1991.",
"correct": True,
"note": "Accurate. Python was indeed released in 1991.",
},
{
"prompt": "Who wrote the Transformer paper?",
"generated": "The Transformer was invented by Yann LeCun at NYU in 2015.",
"correct": False,
"note": "Hallucination. The Transformer was introduced by Vaswani et al. at Google in 2017.",
},
{
"prompt": "What is the capital of Australia?",
"generated": "The capital of Australia is Canberra.",
"correct": True,
"note": "Accurate. Canberra is the capital, though Sydney is larger and more famous.",
},
{
"prompt": "How many GPT-3 parameters?",
"generated": "GPT-3 has 175 trillion parameters, making it the largest language model ever built.",
"correct": False,
"note": "Hallucination. GPT-3 has 175 billion parameters, not trillion. Off by 1000x.",
},
]
print("Evaluating AI-Generated Text for Accuracy:")
print()
correct = 0
for sample in ai_generated_samples:
status = "CORRECT" if sample["correct"] else "HALLUCINATION"
print(f"Prompt: '{sample['prompt']}'")
print(f" Generated: '{sample['generated']}'")
print(f" Status: {status}")
print(f" Note: {sample['note']}")
print()
if sample["correct"]: correct += 1
accuracy = correct / len(ai_generated_samples) * 100
print(f"Accuracy in this sample: {accuracy:.0f}% ({correct}/{len(ai_generated_samples)} correct)")
print()
print("This illustrates why verifying AI-generated facts is important.")Diagram
Loading diagram…
Educational visual guide for practice prompt engineering mastery.