Send the same prompt at three different temperatures and compare the outputs, so you can see how temperature controls the randomness of a model's response.
Temperature is the parameter people reach for first and understand least. The fastest way to build intuition for it is to hold everything else fixed and watch what changes as you turn it up. Low temperature gives focused, repeatable answers; high temperature gives varied, surprising ones.
0.0, 1.0, and 2.0.At temperature 0, the three runs are nearly identical. As temperature rises, the runs diverge.
Holding the prompt and model fixed isolates temperature as the only variable. The inner loop runs each setting three times so the variation is visible rather than something you have to infer from one sample. The contrast between the repeatable output at 0 and the scattered output at 2.0 is the whole point: temperature is the dial you set low when you need consistency and higher when you want variety.
Temperature controls randomness; max_tokens and stop control where generation ends. Use both on the same prompt and read the finish_reason to see why each response stopped: hitting the token cap versus reaching a stop sequence.
max_tokens and print the content and finish_reason.stop sequence and print the content and finish_reason.The capped run stops mid-list with finish_reason 'length'; the stop run halts right before the stop sequence with finish_reason 'stop'.
max_tokens is a hard ceiling on output: when it is reached the response is truncated and finish_reason is length, which is the signal to raise the limit or shorten the task. A stop sequence ends generation as soon as that text would appear, giving finish_reason stop. Reading finish_reason rather than guessing is how you tell a complete answer from a truncated one, which matters when you parse or store the output.