Interface AIChatBuilder

    • Method Detail

      • url

        AIChatBuilder url​(String url)
        Sets the URL for the chat completion request.
        Parameters:
        url - The URL.
        Returns:
        The builder instance for chaining.
      • key

        AIChatBuilder key​(String key)
        Sets the API key for the chat completion request.
        Parameters:
        key - The API key.
        Returns:
        The builder instance for chaining.
      • organizationId

        AIChatBuilder organizationId​(String organizationId)
        Sets the organization ID for the chat completion request - if applicable (OpenAI).
        Parameters:
        organizationId - The organization ID.
        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.