Class PromptExecutionSettings
- java.lang.Object
-
- com.microsoft.semantickernel.orchestration.PromptExecutionSettings
-
public class PromptExecutionSettings extends Object
Configuration settings for prompt execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPromptExecutionSettings.BuilderBuilder for PromptExecutionSettings.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BEST_OFThe default forgetBestOf()ifbest_ofis not provided.static doubleDEFAULT_FREQUENCY_PENALTYThe default forgetFrequencyPenalty()ifPromptExecutionSettings.Builder.withFrequencyPenalty(double)frequency_penalty} is not provided.static intDEFAULT_MAX_TOKENSThe default forgetMaxTokens()ifmax_tokensis not provided.static doubleDEFAULT_PRESENCE_PENALTYThe default forgetPresencePenalty()ifpresence_penaltyis not provided.static intDEFAULT_RESULTS_PER_PROMPTThe default forgetResultsPerPrompt()ifresults per prompt (n)is not provided.static StringDEFAULT_SERVICE_IDThe default forgetServiceId()if aservice idis not provided.static doubleDEFAULT_TEMPERATUREThe default forgetTemperature()iftemperatureis not provided.static doubleDEFAULT_TOP_P
-
Constructor Summary
Constructors Constructor Description PromptExecutionSettings(String serviceId, String modelId, Double temperature, Double topP, Double presencePenalty, Double frequencyPenalty, Integer maxTokens, Integer resultsPerPrompt, Integer bestOf, String user, List<String> stopSequences, Map<Integer,Integer> tokenSelectionBiases, String responseFormat)Create a new instance of PromptExecutionSettings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PromptExecutionSettings.Builderbuilder()Create a new builder for PromptExecutionSettings.booleanequals(Object obj)intgetBestOf()The log probability threshold for a result to be considered.doublegetFrequencyPenalty()Frequency penalty encourages the model to avoid repeating the same token in the output.intgetMaxTokens()The maximum number of tokens to generate in the output.StringgetModelId()Get the id of the model to use for prompt execution.doublegetPresencePenalty()Presence penalty encourages the model to use a more or less diverse range of tokens in the output.ResponseFormatgetResponseFormat()The response format to use for prompt execution.intgetResultsPerPrompt()The number of results to generate for each prompt.StringgetServiceId()Get the id of the AI service to use for prompt execution.List<String>getStopSequences()The stop sequences to use for prompt execution.doublegetTemperature()The temperature setting controls the randomness of the output.Map<Integer,Integer>getTokenSelectionBiases()The token selection biases to use for prompt execution.doublegetTopP()The topP setting controls how many different words or phrases are considered to predict the next token.StringgetUser()The user to associate with the prompt execution.inthashCode()
-
-
-
Field Detail
-
DEFAULT_SERVICE_ID
public static final String DEFAULT_SERVICE_ID
- See Also:
- Constant Field Values
-
DEFAULT_MAX_TOKENS
public static final int DEFAULT_MAX_TOKENS
- See Also:
- Constant Field Values
-
DEFAULT_TEMPERATURE
public static final double DEFAULT_TEMPERATURE
- See Also:
- Constant Field Values
-
DEFAULT_TOP_P
public static final double DEFAULT_TOP_P
- See Also:
- Constant Field Values
-
DEFAULT_PRESENCE_PENALTY
public static final double DEFAULT_PRESENCE_PENALTY
- See Also:
- Constant Field Values
-
DEFAULT_FREQUENCY_PENALTY
public static final double DEFAULT_FREQUENCY_PENALTY
The default forgetFrequencyPenalty()ifPromptExecutionSettings.Builder.withFrequencyPenalty(double)frequency_penalty} is not provided. Defaults to0.0- See Also:
- Constant Field Values
-
DEFAULT_BEST_OF
public static final int DEFAULT_BEST_OF
- See Also:
- Constant Field Values
-
DEFAULT_RESULTS_PER_PROMPT
public static final int DEFAULT_RESULTS_PER_PROMPT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PromptExecutionSettings
public PromptExecutionSettings(String serviceId, String modelId, Double temperature, Double topP, Double presencePenalty, Double frequencyPenalty, Integer maxTokens, Integer resultsPerPrompt, Integer bestOf, String user, @Nullable List<String> stopSequences, @Nullable Map<Integer,Integer> tokenSelectionBiases, @Nullable String responseFormat)
Create a new instance of PromptExecutionSettings.- Parameters:
serviceId- The id of the AI service to use for prompt execution.modelId- The id of the model to use for prompt execution.temperature- The temperature setting for prompt execution.topP- The topP setting for prompt execution.presencePenalty- The presence penalty setting for prompt execution.frequencyPenalty- The frequency penalty setting for prompt execution.maxTokens- The maximum number of tokens to generate in the output.resultsPerPrompt- The number of results to generate for each prompt.bestOf- The best of setting for prompt execution.user- The user to associate with the prompt execution.stopSequences- The stop sequences to use for prompt execution.tokenSelectionBiases- The token selection biases to use for prompt execution.responseFormat- The response format to use for prompt executionResponseFormat.
-
-
Method Detail
-
builder
public static PromptExecutionSettings.Builder builder()
Create a new builder for PromptExecutionSettings.- Returns:
- A new builder for PromptExecutionSettings.
-
getServiceId
public String getServiceId()
Get the id of the AI service to use for prompt execution.- Returns:
- The id of the AI service to use for prompt execution.
-
getModelId
public String getModelId()
Get the id of the model to use for prompt execution.- Returns:
- The id of the model to use for prompt execution.
-
getTemperature
public double getTemperature()
The temperature setting controls the randomness of the output. Lower values produce more deterministic outputs, while higher values produce more random outputs.- Returns:
- The temperature setting.
-
getTopP
public double getTopP()
The topP setting controls how many different words or phrases are considered to predict the next token. The value is a probability threshold, and the model considers the most likely tokens whose cumulative probability mass is greater than the threshold. For example, if the value is 0.1, the model considers only the tokens that make up the top 10% of the cumulative probability mass.- Returns:
- The topP setting.
-
getPresencePenalty
public double getPresencePenalty()
Presence penalty encourages the model to use a more or less diverse range of tokens in the output. A higher value means that the model will try to use a greater variety of tokens in the output.- Returns:
- The presence penalty setting.
-
getFrequencyPenalty
public double getFrequencyPenalty()
Frequency penalty encourages the model to avoid repeating the same token in the output. A higher value means that the model will be less likely to repeat a token.- Returns:
- The frequency penalty setting.
-
getMaxTokens
public int getMaxTokens()
The maximum number of tokens to generate in the output.- Returns:
- The maximum number of tokens to generate in the output.
-
getResultsPerPrompt
public int getResultsPerPrompt()
The number of results to generate for each prompt.- Returns:
- The number of results to generate for each prompt.
-
getBestOf
public int getBestOf()
The log probability threshold for a result to be considered.- Returns:
- The log probability threshold for a result to be considered.
-
getUser
public String getUser()
The user to associate with the prompt execution.- Returns:
- The user to associate with the prompt execution.
-
getStopSequences
public List<String> getStopSequences()
The stop sequences to use for prompt execution.- Returns:
- The stop sequences to use for prompt execution.
-
getTokenSelectionBiases
public Map<Integer,Integer> getTokenSelectionBiases()
The token selection biases to use for prompt execution. The key is the token id from the tokenizer, and the value is the bias. A negative bias will make the model less likely to use the token, and a positive bias will make the model more likely to use the token.- Returns:
- The token selection biases to use for prompt execution.
-
getResponseFormat
@Nullable public ResponseFormat getResponseFormat()
The response format to use for prompt execution. Currently this only applies to chat completions.- Returns:
- The response format to use for prompt execution.
-
-