Class ChatRequestParametersBuilder
-
- All Implemented Interfaces:
public class ChatRequestParametersBuilder<B extends DefaultChatRequestParameters.Builder<?>>A utility class for building and configuring chat request parameters. This builder allows fine-grained control over various fields such as model configuration, response shaping, and tool integration.
Konstantin Pavlov
-
-
Field Summary
Fields Modifier and Type Field Description private final Bbuilderprivate StringmodelNameprivate Doubletemperatureprivate DoubletopPprivate IntegertopKprivate DoublefrequencyPenaltyprivate DoublepresencePenaltyprivate IntegermaxOutputTokensprivate List<String>stopSequencesprivate List<ToolSpecification>toolSpecificationsprivate ToolChoicetoolChoiceprivate ResponseFormatresponseFormat
-
Constructor Summary
Constructors Constructor Description ChatRequestParametersBuilder(B builder, String modelName, Double temperature, Double topP, Integer topK, Double frequencyPenalty, Double presencePenalty, Integer maxOutputTokens, List<String> stopSequences, List<ToolSpecification> toolSpecifications, ToolChoice toolChoice, ResponseFormat responseFormat)
-
Method Summary
Modifier and Type Method Description final BgetBuilder()The builder used to configure the chat request parameters. final StringgetModelName()Specifies the name of the model to be used for the chat request. final UnitsetModelName(String modelName)Specifies the name of the model to be used for the chat request. final DoublegetTemperature()Controls the randomness in the response generation. final UnitsetTemperature(Double temperature)Controls the randomness in the response generation. final DoublegetTopP()Configures nucleus sampling, limiting the selection to a subset of tokens with a cumulative probability of topP.final UnitsetTopP(Double topP)Configures nucleus sampling, limiting the selection to a subset of tokens with a cumulative probability of topP.final IntegergetTopK()Limits the selection to the top Ktokens during response generation.final UnitsetTopK(Integer topK)Limits the selection to the top Ktokens during response generation.final DoublegetFrequencyPenalty()Applies a penalty to discourage repetition of tokens based on frequency. final UnitsetFrequencyPenalty(Double frequencyPenalty)Applies a penalty to discourage repetition of tokens based on frequency. final DoublegetPresencePenalty()Applies a penalty to encourage diversity by penalizing token presence in the conversation context. final UnitsetPresencePenalty(Double presencePenalty)Applies a penalty to encourage diversity by penalizing token presence in the conversation context. final IntegergetMaxOutputTokens()Specifies the maximum number of tokens for the generated response. final UnitsetMaxOutputTokens(Integer maxOutputTokens)Specifies the maximum number of tokens for the generated response. final List<String>getStopSequences()A list of sequences that will terminate the response generation if encountered. final UnitsetStopSequences(List<String> stopSequences)A list of sequences that will terminate the response generation if encountered. final List<ToolSpecification>getToolSpecifications()A list of tool specifications for integrating external tools into the chat request. final UnitsetToolSpecifications(List<ToolSpecification> toolSpecifications)A list of tool specifications for integrating external tools into the chat request. final ToolChoicegetToolChoice()Defines the specific tool to be used if multiple tools are available in the request. final UnitsetToolChoice(ToolChoice toolChoice)Defines the specific tool to be used if multiple tools are available in the request. final ResponseFormatgetResponseFormat()Specifies the format of the response, such as plain text or structured data. final UnitsetResponseFormat(ResponseFormat responseFormat)Specifies the format of the response, such as plain text or structured data. -
-
Constructor Detail
-
ChatRequestParametersBuilder
ChatRequestParametersBuilder(B builder, String modelName, Double temperature, Double topP, Integer topK, Double frequencyPenalty, Double presencePenalty, Integer maxOutputTokens, List<String> stopSequences, List<ToolSpecification> toolSpecifications, ToolChoice toolChoice, ResponseFormat responseFormat)
-
-
Method Detail
-
getBuilder
final B getBuilder()
The builder used to configure the chat request parameters.
-
getModelName
final String getModelName()
Specifies the name of the model to be used for the chat request.
-
setModelName
final Unit setModelName(String modelName)
Specifies the name of the model to be used for the chat request.
-
getTemperature
final Double getTemperature()
Controls the randomness in the response generation. Higher values produce more random outputs.
-
setTemperature
final Unit setTemperature(Double temperature)
Controls the randomness in the response generation. Higher values produce more random outputs.
-
getTopP
final Double getTopP()
Configures nucleus sampling, limiting the selection to a subset of tokens with a cumulative probability of
topP.
-
setTopP
final Unit setTopP(Double topP)
Configures nucleus sampling, limiting the selection to a subset of tokens with a cumulative probability of
topP.
-
getTopK
final Integer getTopK()
Limits the selection to the top
Ktokens during response generation.
-
setTopK
final Unit setTopK(Integer topK)
Limits the selection to the top
Ktokens during response generation.
-
getFrequencyPenalty
final Double getFrequencyPenalty()
Applies a penalty to discourage repetition of tokens based on frequency.
-
setFrequencyPenalty
final Unit setFrequencyPenalty(Double frequencyPenalty)
Applies a penalty to discourage repetition of tokens based on frequency.
-
getPresencePenalty
final Double getPresencePenalty()
Applies a penalty to encourage diversity by penalizing token presence in the conversation context.
-
setPresencePenalty
final Unit setPresencePenalty(Double presencePenalty)
Applies a penalty to encourage diversity by penalizing token presence in the conversation context.
-
getMaxOutputTokens
final Integer getMaxOutputTokens()
Specifies the maximum number of tokens for the generated response.
-
setMaxOutputTokens
final Unit setMaxOutputTokens(Integer maxOutputTokens)
Specifies the maximum number of tokens for the generated response.
-
getStopSequences
final List<String> getStopSequences()
A list of sequences that will terminate the response generation if encountered.
-
setStopSequences
final Unit setStopSequences(List<String> stopSequences)
A list of sequences that will terminate the response generation if encountered.
-
getToolSpecifications
final List<ToolSpecification> getToolSpecifications()
A list of tool specifications for integrating external tools into the chat request.
-
setToolSpecifications
final Unit setToolSpecifications(List<ToolSpecification> toolSpecifications)
A list of tool specifications for integrating external tools into the chat request.
-
getToolChoice
final ToolChoice getToolChoice()
Defines the specific tool to be used if multiple tools are available in the request.
-
setToolChoice
final Unit setToolChoice(ToolChoice toolChoice)
Defines the specific tool to be used if multiple tools are available in the request.
-
getResponseFormat
final ResponseFormat getResponseFormat()
Specifies the format of the response, such as plain text or structured data.
-
setResponseFormat
final Unit setResponseFormat(ResponseFormat responseFormat)
Specifies the format of the response, such as plain text or structured data.
-
-
-
-