Temperature

BytapaScript

BeginnerLLM Concepts
In a nutshell

A dial that controls how random vs. predictable a model's output is.

What it means

A generation setting that influences how predictable or varied a model's responses are.

💡 Asking someone for a standard answer versus encouraging a creative answer.

Code example

const res = await openai.chat.completions.create({
  model: "gpt-4o",
  temperature: 0.2, // low = predictable, high = creative
  messages: [{ role: "user", content: "Summarize this article" }],
});

Why it matters

It helps control response variation; lower values generally produce more predictable outputs and higher values encourage more variation.

Common misconception

Higher temperature is not 'more correct' — it just makes output more random and creative.

When to use it

  • Chatbots (low)
  • Creative writing (high)
  • Code generation (low)

Further reading

Related terms

Learn Full Stack

with tapaScript

By clicking Sign Up you re confirming that you agree with our Terms and Conditions.

newsletter

Don't forget to connect with us on