Interface AIChatBuilder

All Known Implementing Classes:
OpenAIChatBuilderImpl

public interface AIChatBuilder
Defines the interface for building AI chat interactions, allowing customization of the model, token limits, and messages.
  • Method Details

    • url

      Sets the URL for the chat completion request.
      Parameters:
      url - The URL.
      Returns:
      The builder instance for chaining.
    • key

      Sets the API key for the chat completion request.
      Parameters:
      key - The API key.
      Returns:
      The builder instance for chaining.
    • maxTokens

      AIChatBuilder maxTokens(int maxTokens)
      Sets the maximum number of tokens the completion can use.
      Parameters:
      maxTokens - The maximum number of tokens.
      Returns:
      The builder instance for chaining.
    • model

      AIChatBuilder model(String model)
      Sets the AI model to be used for the chat completion.
      Parameters:
      model - The model name.
      Returns:
      The builder instance for chaining.
    • systemMsg

      AIChatBuilder systemMsg(String text)
      Adds a system message to the chat.
      Parameters:
      text - The text of the message.
      Returns:
      The builder instance for chaining.
    • userMsg

      AIChatBuilder userMsg(String text)
      Adds a user message to the chat.
      Parameters:
      text - The text of the message.
      Returns:
      The builder instance for chaining.
    • assistantMsg

      AIChatBuilder assistantMsg(String text)
      Adds an assistant message to the chat.
      Parameters:
      text - The text of the message.
      Returns:
      The builder instance for chaining.
    • toJson

      String toJson()
      Converts the chat completion request to a JSON string.
      Returns:
      The JSON string.
    • execute

      String execute()
      Executes the chat completion request and returns the response.
      Returns:
      The chat completion response.