Prompting and context
How you instruct a model and control what it sees and returns.
- Chain-of-thought
- Chain-of-thought (CoT) is a prompting method in which a language model writes out intermediate reasoning steps before its final answer, which tends to improve results on maths, logic and other multi-step problems.
- Context engineering
- Context engineering is the practice of choosing and maintaining everything that goes into a language model's context window during a task: instructions, retrieved documents, tool definitions, tool results and conversation history.
- Few-shot prompting
- Few-shot prompting is giving a language model a handful of worked examples of a task inside the prompt, so it can copy the pattern for a new input without any retraining.
- Grounding
- Grounding is tying a language model's answer to specific, checkable sources, such as search results, documents or a database, so that its claims rest on supplied evidence rather than only on training data.
- Output tokens
- Output tokens are the tokens a language model generates in its reply. They are counted and billed separately from input tokens, and a max_tokens setting caps how many one response may contain.
- Prompt engineering
- Prompt engineering is the practice of writing, structuring and testing the instructions and examples given to a language model so that it produces the output an application needs, without changing the model's weights.
- Structured output
- Structured output is an API feature that makes a language model's reply follow a format you define, usually a JSON schema, so that code can parse it reliably instead of scraping free text.
- System prompt
- A system prompt is the block of instructions an application sends to a language model before the user's messages. It sets the model's role, rules, tone and output format for the whole conversation.
- Temperature (sampling)
- Temperature is a sampling setting that controls how random a language model's word choices are. Low values make it favour the most likely tokens; higher values spread choices across less likely ones.
- Top-p sampling
- Top-p sampling, or nucleus sampling, picks each next token only from the smallest set of candidates whose combined probability reaches a threshold p, cutting off the long tail of unlikely tokens.
- Zero-shot
- Zero-shot means asking a model to do a task from an instruction alone, with no worked examples in the prompt and no task-specific training. The model relies only on what it already learned.