Package com.smartgwt.client.ai
Class AI
java.lang.Object
com.smartgwt.client.ai.AI
Provides class methods for enabling and disabling the use of AI technology, registering and unregistering
AI engines, and performing high-level operations using installed AI engines.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaskDataQuestion(UserAIRequest question) Asks AI to answer a question about the data of the application.static voidaskDataQuestion(String question) Asks AI to answer a question about the data of the application.static voidaskDataQuestion(String question, DataSource... dataSources) static voidaskDataQuestion(String question, DataSource[] dataSources, DataQuestionSettings settings) static voidaskDataQuestion(String question, DataSource[] dataSources, DataQuestionSettings settings, AskDataQuestionResultCallback callback) Asks AI to answer a question about the data of the application.static voidcancelDataQuestion(String questionId) Cancels a data question if not already canceled.static StringThe ID of the defaultAIEngineto use.static intThe defualt maximum number of retries for any one particular request to AI.static BooleanWhether AI is disabled.static AIEngineReturns theAIEnginehaving the given engine ID.static AIEngineReturns theAIEnginehaving the given engine ID.static voidpauseDataQuestion(String questionId) Pauses a data question if not already paused or canceled.static voidresumeDataQuestion(String questionId) Resumes a data question if paused.static voidsetDefaultEngineId(String defaultEngineId) The ID of the defaultAIEngineto use.static voidsetDefaultMaxRetries(int defaultMaxRetries) The defualt maximum number of retries for any one particular request to AI.static voidsetDisabled(Boolean disabled) Whether AI is disabled.
-
Constructor Details
-
AI
public AI()
-
-
Method Details
-
setDefaultEngineId
The ID of the defaultAIEngineto use.- Parameters:
defaultEngineId- new defaultEngineId. Default value is "gpt-4o".
-
getDefaultEngineId
The ID of the defaultAIEngineto use.- Returns:
- current value of defaultEngineId
-
setDefaultMaxRetries
public static void setDefaultMaxRetries(int defaultMaxRetries) The defualt maximum number of retries for any one particular request to AI.- Parameters:
defaultMaxRetries- new defaultMaxRetries. Default value is 2.
-
getDefaultMaxRetries
public static int getDefaultMaxRetries()The defualt maximum number of retries for any one particular request to AI.- Returns:
- current value of defaultMaxRetries
-
setDisabled
Whether AI is disabled.By default, AI is disabled. This static property must be set to
falseand thedefaultAIEnginemust be registered in order to enable the use of AI in the application.- Parameters:
disabled- new disabled. Default value is true.
-
getDisabled
Whether AI is disabled.By default, AI is disabled. This static property must be set to
falseand thedefaultAIEnginemust be registered in order to enable the use of AI in the application.- Returns:
- current value of disabled
-
askDataQuestion
Asks AI to answer a question about the data of the application.- Parameters:
question- The text of the end-user's question or their request for an answer to a data question.
-
askDataQuestion
Asks AI to answer a question about the data of the application.- Parameters:
question- The text of the end-user's question or their request for an answer to a data question.
-
askDataQuestion
- See Also:
-
askDataQuestion
public static void askDataQuestion(String question, DataSource[] dataSources, DataQuestionSettings settings) - See Also:
-
askDataQuestion
public static void askDataQuestion(String question, DataSource[] dataSources, DataQuestionSettings settings, AskDataQuestionResultCallback callback) Asks AI to answer a question about the data of the application.- Parameters:
question- The text of the end-user's question or their request for an answer to a data question.dataSources- The available data sources. All data sources in the array must have a global ID. Ifnull, then the array of all DataSources available to the AI module is used.settings- Settings to use when answering the data question.callback- The callback to call with the result.
-
cancelDataQuestion
Cancels a data question if not already canceled.- Parameters:
questionId- The ID of the data question to cancel.
-
getEngine
Returns theAIEnginehaving the given engine ID.- Returns:
- the
AIEngine, ornullif theAIEnginecould not be found.
-
getEngine
Returns theAIEnginehaving the given engine ID.- Parameters:
engineId- the engineId of theAIEngineto get. If not specified,defaultEngineIdis used.- Returns:
- the
AIEngine, ornullif theAIEnginecould not be found.
-
pauseDataQuestion
Pauses a data question if not already paused or canceled.- Parameters:
questionId- The ID of the data question to pause.
-
resumeDataQuestion
Resumes a data question if paused.- Parameters:
questionId- The ID of the data question to resume.
-