· 2 min read · ← All posts
Ardan Labs Go Prompting LLM

Field notes from working through example 03 of Ardan Labs’ Ultimate AI course by Bill Kennedy and Florin Pățan (Apache 2.0). My fork: PratikDhanave/ai-training. Thank you Bill and Florin for teaching this material — the patterns in this post are derived from the course; the production reflections at the end are mine.

What the example teaches

Context injection: include extra information in the prompt instead of letting the LLM rely on its training data. The most basic RAG without retrieval — you supply the context directly.

What it looks like

template := `You are a helpful assistant. Answer based ONLY on this context:

---
%s
---

Question: %s

Answer:`

prompt := fmt.Sprintf(template, contextText, userQuery)
resp := llm.Generate(ctx, prompt)

What I learned

Position matters. The LLM pays more attention to the start and end of the prompt than the middle (the “lost in the middle” effect). Put the most important context near the end, right before the question.

Delimiters matter. Triple-dashes, XML tags, markdown fences — the LLM uses these as structural cues. Without them, instructions and context blur together and the LLM follows the wrong half.

Production connection

Every RAG prompt template I’ve written follows this shape. Genie’s response synthesis templates, the Bodh clinical-reasoning prompts, the Bancnet customer-support copilot — all variations of context-at-the-end with explicit delimiters. The example is “prompt engineering basics” but the basics are most of what matters.


Credit & reference. This post is field notes on example 03 from Ardan Labs’ Ultimate AI by Bill Kennedy + Florin Pățan, licensed Apache 2.0. The original example: cmd/examples/example03-context-injection/. My fork with notes: PratikDhanave/ai-training. Highly recommend the course for anyone building AI applications in Go — the material is rigorous and the Kronk + yzma + llama.cpp pipeline gives you hardware-accelerated local inference end-to-end. Thank you, Bill and Florin.

← Back to all posts