Package com.intellijava.core.function
Class Chatbot
java.lang.Object
com.intellijava.core.function.Chatbot
Chatbot controller for most sophisticated AI chatbots.
- Author:
- github.com/Barqawiz
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchat
(ChatModelInput modelInput) Call a chat model to generate response based on the received messages history.Get the supported models names as array of string
-
Constructor Details
-
Chatbot
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
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
Get the supported models names as array of string- Returns:
- supportedModels
-
chat
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.
-