Temperature Property  
 

Sets or returns the sampling temperature used to control response variability.

Syntax

object.Temperature [= value ]

Remarks

The Temperature property returns or changes the sampling temperature used when generating responses from the current model. Temperature controls the amount of randomness used when selecting tokens during text generation. Lower values generally produce more predictable and consistent responses, while higher values can produce more varied and creative output.

A temperature value of 0.0 requests the most deterministic response possible from the model. This is typically recommended for tasks that require stable or structured output, such as code generation, classification, data extraction, or responses that must follow a specific format. Higher values, such as 1.0 or above, may produce more diverse wording, alternative phrasing, or creative responses, but can also increase the likelihood of inconsistent or inaccurate output.

Most providers support temperature values in the range of 0.0 to 2.0, although the exact supported range and behavior may vary between providers and models. Some models may ignore this property entirely or internally restrict the range of accepted values. If an unsupported value is specified, the provider may clamp the value to a supported range or reject the request.

Changing the temperature only affects subsequent requests and does not modify existing messages or responses stored in the conversation history.

In most cases, applications should adjust only the temperature setting and leave advanced sampling parameters such as TopP and TopK at their default values unless the application has specific requirements and understands how those settings affect model behavior.

The default temperature value depends on the selected provider and model. Some providers may use different default values for reasoning models, coding models, or creative writing models.

Data Type

Double

See Also

ReasoningLevel Property, TopK Property, TopP Property