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.

    Author:

    Konstantin Pavlov

    • 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 K tokens during response generation.

      • setTopK

         final Unit setTopK(Integer topK)

        Limits the selection to the top K tokens 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.

      • 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.