PromptExecutionSettings Class
- java.
lang. Object - com.
microsoft. semantickernel. orchestration. PromptExecutionSettings
- com.
public class PromptExecutionSettings
Configuration settings for prompt execution.
Field Summary
Modifier and Type | Field and Description |
---|---|
static final int |
DEFAULT_BEST_OF
The default for getBestOf() if best_of is not provided. |
static final double |
DEFAULT_FREQUENCY_PENALTY
The default for getFrequencyPenalty() if Builder#withFrequencyPenalty(double) frequency_penalty} is not provided. |
static final int |
DEFAULT_MAX_TOKENS
The default for getMaxTokens() if max_tokens is not provided. |
static final double |
DEFAULT_PRESENCE_PENALTY
The default for getPresencePenalty() if presence_penalty is not provided. |
static final int |
DEFAULT_RESULTS_PER_PROMPT
The default for getResultsPerPrompt() if results per prompt (n) is not provided. |
static final java.lang.String |
DEFAULT_SERVICE_ID
The default for getServiceId() if a service id is not provided. |
static final double |
DEFAULT_TEMPERATURE
The default for getTemperature() if temperature is not provided. |
static final double |
DEFAULT_TOP_P
The default for getTopP() if top_p is not provided. |
Constructor Summary
Method Summary
Modifier and Type | Method and Description |
---|---|
static Builder |
builder()
Create a new builder for Prompt |
boolean | equals(Object obj) |
int |
getBestOf()
The log probability threshold for a result to be considered. |
double |
getFrequencyPenalty()
Frequency penalty encourages the model to avoid repeating the same token in the output. |
int |
getMaxTokens()
The maximum number of tokens to generate in the output. |
java.lang.String |
getModelId()
Get the id of the model to use for prompt execution. |
double |
getPresencePenalty()
Presence penalty encourages the model to use a more or less diverse range of tokens in the output. |
Response |
getResponseFormat()
The response format to use for prompt execution. |
int |
getResultsPerPrompt()
The number of results to generate for each prompt. |
java.lang.String |
getServiceId()
Get the id of the AI service to use for prompt execution. |
java.util.List<java.lang.String> |
getStopSequences()
The stop sequences to use for prompt execution. |
double |
getTemperature()
The temperature setting controls the randomness of the output. |
java.util.Map<java.lang.Integer,java.lang.Integer> |
getTokenSelectionBiases()
The token selection biases to use for prompt execution. |
double |
getTopP()
The topP setting controls how many different words or phrases are considered to predict the next token. |
java.lang.String |
getUser()
The user to associate with the prompt execution. |
int | hashCode() |
Methods inherited from java.lang.Object
Field Details
DEFAULT_BEST_OF
public static final int DEFAULT_BEST_OF
The default for getBestOf() if best_of is not provided. Defaults to 1
DEFAULT_FREQUENCY_PENALTY
public static final double DEFAULT_FREQUENCY_PENALTY
The default for getFrequencyPenalty() if Builder#withFrequencyPenalty(double) frequency_penalty} is not provided. Defaults to 0.0
DEFAULT_MAX_TOKENS
public static final int DEFAULT_MAX_TOKENS
The default for getMaxTokens() if max_tokens is not provided. Defaults to 256
DEFAULT_PRESENCE_PENALTY
public static final double DEFAULT_PRESENCE_PENALTY
The default for getPresencePenalty() if presence_penalty is not provided. Defaults to 0.0
DEFAULT_RESULTS_PER_PROMPT
public static final int DEFAULT_RESULTS_PER_PROMPT
The default for getResultsPerPrompt() if results per prompt (n) is not provided. Defaults to 1
DEFAULT_SERVICE_ID
public static final String DEFAULT_SERVICE_ID
The default for getServiceId() if a service id is not provided. Defaults to "default"
DEFAULT_TEMPERATURE
public static final double DEFAULT_TEMPERATURE
The default for getTemperature() if temperature is not provided. Defaults to 1.0
DEFAULT_TOP_P
public static final double DEFAULT_TOP_P
The default for getTopP() if top_p is not provided. Defaults to 1.0
Constructor Details
PromptExecutionSettings
public PromptExecutionSettings(String serviceId, String modelId, Double temperature, Double topP, Double presencePenalty, Double frequencyPenalty, Integer maxTokens, Integer resultsPerPrompt, Integer bestOf, String user, List
Create a new instance of PromptExecutionSettings.
Parameters:
Method Details
builder
public static PromptExecutionSettings.Builder builder()
Create a new builder for PromptExecutionSettings.
Returns:
equals
public boolean equals(Object obj)
Overrides:
PromptExecutionSettings.equals(Object obj)Parameters:
getBestOf
public int getBestOf()
The log probability threshold for a result to be considered.
Returns:
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:
getMaxTokens
public int getMaxTokens()
The maximum number of tokens to generate in the output.
Returns:
getModelId
public String getModelId()
Get the id of the model to use for prompt execution.
Returns:
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:
getResponseFormat
public ResponseFormat getResponseFormat()
The response format to use for prompt execution. Currently this only applies to chat completions.
Returns:
getResultsPerPrompt
public int getResultsPerPrompt()
The number of results to generate for each prompt.
Returns:
getServiceId
public String getServiceId()
Get the id of the AI service to use for prompt execution.
Returns:
getStopSequences
public List
The stop sequences to use for prompt execution.
Returns:
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:
getTokenSelectionBiases
public Map
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:
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:
getUser
public String getUser()
The user to associate with the prompt execution.
Returns:
hashCode
public int hashCode()
Overrides:
PromptExecutionSettings.hashCode()