Few-shot learning asks a language model to pick up a task from a small set of examples supplied in a conversational prompt. The examples provide context for the next response rather than a separate training set. This can be useful when a chatbot needs to follow a particular interaction pattern, but matching the pattern is not the same as getting the answer right. section 10.1.1 section 12.5.2
A practical setup places task instructions, examples or conversation history, and the current user message in a prompt template. A LangChain conversation can carry earlier turns into that template. Keep the requested behavior explicit, then test the responses against the task’s actual requirements. section 12.5.2
>>> math_quiz_pt = """
... You are a math teacher that's teaching math to a third-grade
... student. Prompt the student to complete number sequences
... from the following list and compare their answer with the
... last number in the sequence:
... - 9,10,11,12
... - 38,39,40,41
... - 2,4,6,8
... - 1,5,9,13
... {history}
... student:{input}
... tutor:"""
The math-tutor prompt supplies several number sequences and asks the model to compare a student’s answer with the expected next number. section 12.5.2
A plausible response that fails the task
For the sequence 2, 4, 6, 8, a student answers 12. The tutor replies, “Great job! Your answer is correct,” then says the next number is 10. It follows the encouraging style of a tutor without checking whether its judgment agrees with its own answer. A few-shot chatbot therefore still needs checks for requirements that must hold, especially when teaching children. section 12.5.2
Larger models may handle more complex in-prompt tasks, but scale is not a guarantee: measured capabilities can improve gradually, stay flat, or perform no better than chance. For a deployed chatbot, try prompts more than once, assess responses against the goal, and consider rule-based checks where an erroneous answer would matter. section 10.1.1 section 12.5.2

















