PromptingEasy AI Wiki · Level 2

LLM Intermediate Guide: role prompting, few-shot, chaining, RAG and temperature

For power users who want more reliable AI workflows, better prompts and practical ways to test output quality.

Rolesupport leadSEO editorContextaudienceconstraintsTaskwhat to dosuccess criteriaFormattablebullets
A strong prompt usually combines role, context, task, constraints, examples and output format.
Queryuser asksEmbeddingvector searchRetrieverelevant docsnot everythingLLManswer
RAG adds selected external context before generation. The retrieval step is often the hardest part to get right.

What you will learn

Role Prompting explained

Role prompting asks the model to answer from a specific professional perspective. The role should be relevant to the task, not theatrical. “Act as a senior support operations manager” is useful for ticket workflows; “act as a genius” usually adds little.

Example: For a helpdesk macro: “Act as a support quality lead. Rewrite this reply so it is shorter, warmer and policy-safe. Keep the refund condition unchanged.”

Few-Shot Prompting explained

Few-shot prompting means you provide a few examples of the input and the desired output. It is especially useful when format, tone or classification boundaries are hard to describe. Two to five sharp examples are often better than a long abstract explanation.

Example: A product team gives three examples of messy feature requests and their cleaned Jira-ticket format, then asks the model to convert the next request in the same structure.

Prompt Chaining explained

Prompt chaining splits a complex task into smaller steps. Instead of asking for research, outline, draft, critique and final version at once, you run a sequence: extract facts, create structure, write draft, evaluate, revise. This improves control and makes errors easier to catch.

Example: For a landing page: Step 1 summarize customer pain points. Step 2 create page outline. Step 3 draft sections. Step 4 critique against conversion criteria. Step 5 produce final copy.

Context Engineering explained

Context engineering is the discipline of deciding what information enters the model at the right time. It includes source selection, instruction hierarchy, memory, retrieval, examples, tools and output schemas. The goal is not “maximum context”; the goal is the smallest reliable context.

Example: A legal assistant should receive the relevant clause, jurisdiction, user question and output constraints — not the entire 80-page contract for every small answer.

How to test prompts

Prompt testing means running the same task across representative examples and scoring the outputs. Use a rubric: accuracy, completeness, format adherence, tone, safety and edit time. Keep a small regression set so you notice when a prompt change improves one case but breaks another.

Example: Test 20 support tickets with three prompt variants. Score each answer from 1–5 for policy correctness and time saved. The best prompt is not always the longest prompt.

How to get better AI answers

Better answers usually come from clearer goals, better context, explicit constraints, examples and a review step. Ask the model to state assumptions, use a specified format and flag uncertainty. For important facts, provide sources or require citations from retrieved material.

Example: Instead of “analyze this,” ask: “Find the three highest-risk assumptions in this launch plan, explain why each matters, and give one test we can run this week.”

RAG explained simply

RAG means retrieval-augmented generation. The system first searches a knowledge base, then gives relevant passages to the model, then the model writes an answer grounded in those passages. RAG is useful when answers depend on private, changing or large documents. It is unnecessary for simple writing tasks.

Example: A SaaS support bot retrieves the latest refund-policy paragraph before drafting an answer, so it does not rely on memory or outdated examples.

Temperature explained simply

Temperature controls how much randomness the model uses when choosing tokens. Lower temperature tends to be more predictable and consistent. Higher temperature can be more varied and creative but may increase drift from instructions. It is not a quality knob; it is a variation knob.

Example: For invoice extraction use low temperature. For ten brand-name ideas, use higher temperature and then filter the results.

Mini test you can run

Pick five real tasks from your own workflow. Run one short prompt, one structured prompt and one prompt with examples or source context. Score each output from 1 to 5 for usefulness, factual risk and edit time. Keep the winning prompt as your baseline and retest after every major change.

VariantUsefulnessFactual riskEdit time
Short promptMediumHigherHigh
Structured promptHighMediumMedium
Context + examplesHighest for repeat tasksLower if sources are goodLow