28 items
Prompt Chaining and Multi-Step Pipelines
Slides / VideoTool Use and Function Calling
Slides / VideoGrounding Responses with External Context
Slides / VideoRetrieval-Augmented Generation (RAG)
Slides / VideoPrompt Injection and Security Risks
Slides / VideoPrompt Failure Modes and Hallucinations
Slides / VideoIterative Prompt Refinement and Testing
Slides / VideoDecoding Parameters: Temperature, Top-p, Max Tokens
Slides / VideoControlling Output Format with LLMs
Slides / VideoPrompt Templating and Variable Injection
Slides / VideoSystem, User, and Assistant Roles
Slides / VideoRole and Persona Prompting
Slides / VideoChain-of-Thought Prompting for Reasoning
Slides / VideoFew-Shot Prompting and In-Context Learning
Slides / VideoZero-Shot Prompting
Slides / VideoAnatomy of a Prompt
Slides / VideoWhat Prompt Engineering Is
Slides / VideoCost and Latency in LLM Apps
Slides / VideoEvaluating LLM Outputs and Prompt Quality
Slides / VideoSelf-Consistency and Output Verification
Slides / VideoContext Window and Token Limits
Slides / VideoAgentic Loops and ReAct Pattern
Slides / VideoReturning Tool Call Results
Code QuizReAct Reasoning-Action Loop
Code QuizContext Window Token Budgeting
Code QuizSelf-Consistency Voting
Code QuizConversation History Truncation
Code QuizPrompt Injection Detection
Code QuizContext Window Token Budgeting
Spot the mistake in computing how many tokens are left for the model's response.
const CONTEXT_WINDOW = 8192;
// Reserve room for the completion based on prompt size
function maxResponseTokens(promptTokens) {
return CONTEXT_WINDOW + promptTokens;
}
console.log(maxResponseTokens(6000));What is the bug in this token budgeting function?