Package com.chatmotorapi.api
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 Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description MotorAiOptions.Builder
additionalOptions(Map<String,Object> options)
Adds additional, unspecified options for AI configuration.MotorAiOptions
build()
Builds and returns a MotorAiOptions instance with the configured settings.MotorAiOptions.Builder
frequencyPenalty(Double frequencyPenalty)
Sets the 'frequency_penalty' option, which discourages the AI from repeating the same line.MotorAiOptions.Builder
logitBias(Map<String,Integer> logitBias)
Sets the 'logit_bias' map, which biases certain tokens during response generation.MotorAiOptions.Builder
logprobs(Boolean logprobs)
Sets whether to enable log probabilities in the AI response.MotorAiOptions.Builder
maxTokens(Integer maxTokens)
Sets the maximum number of tokens the AI can produce.MotorAiOptions.Builder
n(Integer n)
Sets the 'n' option, defining how many completions to generate for each prompt.MotorAiOptions.Builder
presencePenalty(Double presencePenalty)
Sets the 'presence_penalty' option, which discourages the AI from repeating topics.MotorAiOptions.Builder
stop(Object stop)
Sets the 'stop' sequences for the AI to stop generating further tokens.MotorAiOptions.Builder
temperature(Double temperature)
Sets the 'temperature' option for the AI responses.MotorAiOptions.Builder
topLogprobs(Integer topLogprobs)
Sets the 'top_logprobs' option, specifying the number of log probabilities to return.MotorAiOptions.Builder
topP(Double topP)
Sets the 'top_p' option, controlling the diversity of the response predictions.MotorAiOptions.Builder
user(String user)
Sets the 'user' identifier for the API to track usage metrics.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
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
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
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
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
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
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
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
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
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
Adds additional, unspecified options for AI configuration.- Parameters:
options
- A map containing additional AI configuration options.- Returns:
- this Builder instance for chaining
-
build
Builds and returns a MotorAiOptions instance with the configured settings.- Returns:
- a configured MotorAiOptions instance
-