Class MotorAiOptions.Builder

java.lang.Object
com.chatmotorapi.api.MotorAiOptions.Builder
Enclosing class:
MotorAiOptions

public static class MotorAiOptions.Builder
extends Object
Builder class for creating a MotorAiOptions instance. This class follows the builder pattern to allow for flexible configuration of MotorAiOptions.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • temperature

      public MotorAiOptions.Builder temperature​(Double temperature)
      Sets the 'temperature' option for the AI responses.
      Parameters:
      temperature - Controls the randomness of the AI responses. Must be between 0.0 and 2.0.
      Returns:
      this Builder instance for chaining
    • maxTokens

      public MotorAiOptions.Builder maxTokens​(Integer maxTokens)
      Sets the maximum number of tokens the AI can produce.
      Parameters:
      maxTokens - The maximum number of tokens in the response.
      Returns:
      this Builder instance for chaining
    • topP

      public MotorAiOptions.Builder topP​(Double topP)
      Sets the 'top_p' option, controlling the diversity of the response predictions.
      Parameters:
      topP - Controls the diversity of response predictions, must be between 0.0 and 1.0.
      Returns:
      this Builder instance for chaining
    • n

      Sets the 'n' option, defining how many completions to generate for each prompt.
      Parameters:
      n - The number of completions to generate. Must be between 1 and 128.
      Returns:
      this Builder instance for chaining
    • stop

      public MotorAiOptions.Builder stop​(Object stop)
      Sets the 'stop' sequences for the AI to stop generating further tokens.
      Parameters:
      stop - An array of stop sequences.
      Returns:
      this Builder instance for chaining
    • presencePenalty

      public MotorAiOptions.Builder presencePenalty​(Double presencePenalty)
      Sets the 'presence_penalty' option, which discourages the AI from repeating topics.
      Parameters:
      presencePenalty - The penalty for repeating topics, must be between -2.0 and 2.0.
      Returns:
      this Builder instance for chaining
    • frequencyPenalty

      public MotorAiOptions.Builder frequencyPenalty​(Double frequencyPenalty)
      Sets the 'frequency_penalty' option, which discourages the AI from repeating the same line.
      Parameters:
      frequencyPenalty - The penalty for repeating lines, must be between -2.0 and 2.0.
      Returns:
      this Builder instance for chaining
    • logitBias

      public MotorAiOptions.Builder logitBias​(Map<String,​Integer> logitBias)
      Sets the 'logit_bias' map, which biases certain tokens during response generation.
      Parameters:
      logitBias - A map of token IDs to their bias values.
      Returns:
      this Builder instance for chaining
    • user

      public MotorAiOptions.Builder user​(String user)
      Sets the 'user' identifier for the API to track usage metrics.
      Parameters:
      user - A string representing the user or usage context.
      Returns:
      this Builder instance for chaining
    • logprobs

      public MotorAiOptions.Builder logprobs​(Boolean logprobs)
      Sets whether to enable log probabilities in the AI response.
      Parameters:
      logprobs - Boolean value to turn on log probability tracking.
      Returns:
      this Builder instance for chaining
    • topLogprobs

      public MotorAiOptions.Builder topLogprobs​(Integer topLogprobs)
      Sets the 'top_logprobs' option, specifying the number of log probabilities to return.
      Parameters:
      topLogprobs - The number of top log probabilities to include. Must be between 0 and 20.
      Returns:
      this Builder instance for chaining
    • additionalOptions

      public MotorAiOptions.Builder additionalOptions​(Map<String,​Object> options)
      Adds additional, unspecified options for AI configuration.
      Parameters:
      options - A map containing additional AI configuration options.
      Returns:
      this Builder instance for chaining
    • build

      public MotorAiOptions build()
      Builds and returns a MotorAiOptions instance with the configured settings.
      Returns:
      a configured MotorAiOptions instance