Class PromptExecutionSettings


  • public class PromptExecutionSettings
    extends Object
    Configuration settings for prompt execution.
    • 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 execution ResponseFormat.
    • 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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.