ModelSamplingParams Class

  • java.lang.Object
    • com.azure.ai.projects.models.ModelSamplingParams

Implements

public final class ModelSamplingParams
implements JsonSerializable<ModelSamplingParams>

Represents a set of parameters used to control the sampling behavior of a language model during text generation.

Constructor Summary

Constructor Description
ModelSamplingParams()

Creates an instance of ModelSamplingParams class.

ModelSamplingParams(double temperature, double topP, int seed, int maxCompletionTokens)

Creates an instance of ModelSamplingParams class.

Method Summary

Modifier and Type Method and Description
static ModelSamplingParams fromJson(JsonReader jsonReader)

Reads an instance of ModelSamplingParams from the JsonReader.

Integer getMaxCompletionTokens()

Get the maxCompletionTokens property: The maximum number of tokens allowed in the completion.

Integer getSeed()

Get the seed property: The random seed for reproducibility.

Double getTemperature()

Get the temperature property: The temperature parameter for sampling.

Double getTopP()

Get the topP property: The top-p parameter for nucleus sampling.

ModelSamplingParams setMaxCompletionTokens(Integer maxCompletionTokens)

Set the maxCompletionTokens property: The maximum number of tokens allowed in the completion.

ModelSamplingParams setSeed(Integer seed)

Set the seed property: The random seed for reproducibility.

ModelSamplingParams setTemperature(Double temperature)

Set the temperature property: The temperature parameter for sampling.

ModelSamplingParams setTopP(Double topP)

Set the topP property: The top-p parameter for nucleus sampling.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

ModelSamplingParams

public ModelSamplingParams()

Creates an instance of ModelSamplingParams class.

ModelSamplingParams

public ModelSamplingParams(double temperature, double topP, int seed, int maxCompletionTokens)

Creates an instance of ModelSamplingParams class.

Parameters:

temperature - the temperature value to set.
topP - the topP value to set.
seed - the seed value to set.
maxCompletionTokens - the maxCompletionTokens value to set.

Method Details

fromJson

public static ModelSamplingParams fromJson(JsonReader jsonReader)

Reads an instance of ModelSamplingParams from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ModelSamplingParams if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the ModelSamplingParams.

getMaxCompletionTokens

public Integer getMaxCompletionTokens()

Get the maxCompletionTokens property: The maximum number of tokens allowed in the completion.

Returns:

the maxCompletionTokens value.

getSeed

public Integer getSeed()

Get the seed property: The random seed for reproducibility. Defaults to 42.

Returns:

the seed value.

getTemperature

public Double getTemperature()

Get the temperature property: The temperature parameter for sampling. Defaults to 1.0.

Returns:

the temperature value.

getTopP

public Double getTopP()

Get the topP property: The top-p parameter for nucleus sampling. Defaults to 1.0.

Returns:

the topP value.

setMaxCompletionTokens

public ModelSamplingParams setMaxCompletionTokens(Integer maxCompletionTokens)

Set the maxCompletionTokens property: The maximum number of tokens allowed in the completion.

Parameters:

maxCompletionTokens - the maxCompletionTokens value to set.

Returns:

the ModelSamplingParams object itself.

setSeed

public ModelSamplingParams setSeed(Integer seed)

Set the seed property: The random seed for reproducibility. Defaults to 42.

Parameters:

seed - the seed value to set.

Returns:

the ModelSamplingParams object itself.

setTemperature

public ModelSamplingParams setTemperature(Double temperature)

Set the temperature property: The temperature parameter for sampling. Defaults to 1.0.

Parameters:

temperature - the temperature value to set.

Returns:

the ModelSamplingParams object itself.

setTopP

public ModelSamplingParams setTopP(Double topP)

Set the topP property: The top-p parameter for nucleus sampling. Defaults to 1.0.

Parameters:

topP - the topP value to set.

Returns:

the ModelSamplingParams object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to