Class ChatGPTInput.Builder

java.lang.Object
com.intellijava.core.model.input.ChatGPTInput.Builder
Enclosing class:
ChatGPTInput

public static class ChatGPTInput.Builder extends Object
Builder class for ChatGPTInput.
  • Constructor Details

    • Builder

      public Builder(ChatGPTMessage systemMessage)
      Builder for ChatGPTInput with the system or chatbot instructions. Example of general system instruction: You are a helpful assistant.
      Parameters:
      systemMessage - the system instruction to define the chat mode/theme.
    • Builder

      public Builder(String systemPrompt)
      Builder for ChatGPTInput with the system or chatbot instructions. Example of general system instruction: You are a helpful assistant.
      Parameters:
      systemPrompt - string input to define the chat mode/theme.
  • Method Details

    • addMessage

      public ChatGPTInput.Builder addMessage(ChatGPTMessage message)
      Add the chat message.
      Parameters:
      message - (content and role)
      Returns:
      instance of Builder.
    • setTemperature

      public ChatGPTInput.Builder setTemperature(float temperature)
      Sets the temperature.
      Parameters:
      temperature - higher values means more risks and creativity.
      Returns:
      instance of Builder.
    • setNumberOfOutputs

      public ChatGPTInput.Builder setNumberOfOutputs(int numberOfOutputs)
      Sets the numberOfOutputs
      Parameters:
      numberOfOutputs - number of model outputs, default value is 1.
      Returns:
      instance of Builder.
    • setMaxTokens

      public ChatGPTInput.Builder setMaxTokens(int maxTokens)
      Sets the maxTokens.
      Parameters:
      maxTokens - maximum size of the model input and output.
      Returns:
      instance of Builder.
    • addUserMessage

      public ChatGPTInput.Builder addUserMessage(String prompt)
      Add input message for your prompt.
      Parameters:
      prompt - model input with user role.
      Returns:
      instance of Builder.
    • setModel

      public ChatGPTInput.Builder setModel(String model)
      Sets chatGPT model name, default is gpt-3.5-turbo.
      Parameters:
      model - the model name.
      Returns:
      instance of Builder.
    • build

      public ChatGPTInput build()
      Build the final ChatGPTInput object.
      Returns:
      final LanguageModelInput object.