Temperature is a text-generation setting that controls how much outputs vary between calls. Lower values tend to produce more predictable, repetitive responses; higher values tend to produce more diverse ones. Choose it for the task: marketing ideas may benefit from variety, while document automation may need consistency. section 2.8.5 section 3.2.4
Set temperature on each API call, so one workflow can use different values for different tasks. Illustrative starting points are 0.8 for creative output and 0.2 for more predictable output. There is no universally correct setting. Temperature and top_p both steer randomness; try adjusting one rather than both at once. section 3.2.4 section 2.8.5
response = client.completions.create(
model="gpt-35-turbo",
prompt=prompt_startphrase,
temperature=0.8,
max_tokens=100,
n=3,
stop=None)
This illustrative completions call sets temperature to 0.8 and requests three responses with n=3, making variation visible without three separate calls. section 3.2.4
Compare outputs before choosing a value
Three pet-grooming name suggestions generated at 0.8 varied more than three generated at 0.2. At 1.8, suggestions included nonsensical text. Compare repeated outputs against the task’s need for variety and reliability rather than treating a higher value as automatically better. section 3.2.4
Temperature does not replace output review or safeguards. Identical prompts can still yield different responses, especially at higher settings; very high settings can increase hallucinations. Assess output quality for the use case, and use content filtering where inappropriate or sensitive content is a concern. section 3.2.4 section 6.7
















