Day 4 of 10
Master prompt engineering by building three wildly different assistants from the same five lines of code.
Five lines of code. Three completely different products.
That is what today proves. The model doesn’t change. The infrastructure doesn’t change. The system prompt changes, and what the model produces changes so dramatically that they barely feel like the same tool.
Most beginners treat the system prompt as a label: “You are a helpful assistant.” That line produces a generic, hedge-everything, filler-heavy response that satisfies no one. The people building products that feel sharp and specific have a different relationship with the system prompt. They treat it like code.
Start with the same question, two setups:
from groq import Groq
from google.colab import userdata
client = Groq(api_key=userdata.get('GROQ_API_KEY'))
question = "I'm procrastinating on a project. What should I do?"
# Generic
r1 = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[{"role": "user", "content": question}]
)
# Sharp
r2 = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{
"role": "system",
"content": """You are a no-nonsense productivity coach.
You do not validate procrastination. You do not offer a menu of options.
You give one direct instruction and explain exactly why it works.
Under 80 words. Start with the action, not the reason."""
},
{"role": "user", "content": question}
]
)
print("GENERIC:\n", r1.choices[0].message.content)
print("\nSHARP:\n", r2.choices[0].message.content)
Read both. The second one is useful. The first one is noise.
Sometimes describing what you want isn’t enough. Show it.
Few-shot prompting puts example input-output pairs directly in the system prompt. The model pattern-matches to your examples and reproduces the format.
SYSTEM = """You convert casual notes into structured daily plans.
Example:
Input: "need to finish report, call priya, gym at 6"
Output:
09:00 - Write and finalize report
15:00 - Call Priya (30 min)
18:00 - Gym session
Example:
Input: "research competitors, update readme, lunch with team"
Output:
10:00 - Competitor research and notes
12:30 - Team lunch
14:30 - Update README with latest changes
Only output the plan. No commentary."""
notes = "review PR from rahul, prep for 4pm meeting, check deployment logs"
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": notes}
]
)
print(response.choices[0].message.content)
Two examples in the prompt and the output format locks in. This is the fastest way to get consistent, structured output without any extra libraries.
Real applications don’t just read the model’s response. They parse it. They feed it into a database, a UI, another API. For that, you need structured output.
import json
SYSTEM = """You extract structured information from unstructured text.
Always respond with valid JSON only. No markdown, no explanation, just the JSON object.
Schema:
{
"name": string,
"skills": array of strings,
"experience_years": number or null,
"looking_for": string
}"""
bio = """Hey I'm Arjun, been doing backend dev for about 4 years mostly in Django and FastAPI.
Also dabble in DevOps with Docker and K8s. Looking for a senior role at a product company."""
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": bio}
]
)
raw = response.choices[0].message.content
parsed = json.loads(raw)
print(f"Name: {parsed['name']}")
print(f"Skills: {', '.join(parsed['skills'])}")
print(f"Experience: {parsed['experience_years']} years")
print(f"Looking for: {parsed['looking_for']}")
The model returns clean JSON. You parse it with json.loads. Now the model’s output is just another data structure your code can work with.
This is the bridge between “an LLM that says things” and “an LLM integrated into a real application.”
Build a specialized assistant that uses everything from today: a strong system prompt, at least one few-shot example, and a JSON output mode for at least one command.
Pick something real: a study companion for a subject you are actually studying, a code reviewer for a language you use, an editor for a writing style you are developing.
The test: could you show this to someone in that domain and have them find it genuinely useful? If the answer is yes, you built something. If it feels like a toy, the system prompt needs more specificity.
Three days ago you had a blank file. Today you have:
A chatbot with memory and a voice. A formatter that locks output to any pattern you show it. A parser that turns natural language into structured data your code can consume.
The model is the same cheap, fast inference endpoint you called on Day 2. The craft is in what you give it. That craft is yours now.