Class Chatbot

java.lang.Object
com.intellijava.core.function.Chatbot

public class Chatbot extends Object
Chatbot controller for most sophisticated AI chatbots.
Author:
github.com/Barqawiz
  • Constructor Details

    • Chatbot

      public Chatbot(String keyValue, String keyTypeString)
      Constructor for the Chatbot class. Creates class instance and set the API type and key.
      Parameters:
      keyValue - the API key.
      keyTypeString - either openai (default) or cohere or send empty string for default value.
      Throws:
      IllegalArgumentException - if the keyType passed is not "openai".
    • Chatbot

      public Chatbot(String keyValue, SupportedChatModels keyType)
      Constructor for the Chatbot class. Creates class instance and set the API enum type and key.
      Parameters:
      keyValue - the API key.
      keyType - enum version from the key type (SupportedModels).
      Throws:
      IllegalArgumentException - if the keyType passed is not "openai".
  • Method Details

    • getSupportedModels

      public List<String> getSupportedModels()
      Get the supported models names as array of string
      Returns:
      supportedModels
    • chat

      public List<String> chat(ChatModelInput modelInput) throws IOException
      Call a chat model to generate response based on the received messages history. To support multiple response call the variation function generateMultiText.
      Parameters:
      modelInput - language model parameters.
      Returns:
      the model response.
      Throws:
      IOException - if there is an error when connecting to the chat model.