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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyAIFilter
(ApplyAIFilterRequest applyRequest, ApplyAIFilterResponseCallback callback) Requests that available AI engine(s) be used to evaluate an "aiFilter"AdvancedCriteria
on a list of records.static void
buildAIFieldRequest
(BuildAIFieldRequestRequest buildRequest, BuildAIFieldRequestResponseCallback callback) Requests that available AI engine(s) be used to build anAIFieldRequest
from a natural language description of the per-record values to generate for a new AI-generated field.static void
buildCriterion
(BuildCriterionRequest buildRequest, BuildCriterionResponseCallback callback) Requests that available AI engine(s) be used to build anAdvancedCriteria
object according to the user's natural language description of a filter.static void
buildDataBoundUI
(BuildDataBoundUIViaAIRequest buildRequest, BuildUIViaAIResponseCallback callback) Requests that available AI engine(s) be used to build data-bound UI component(s) according to a user's description of what they would like to build.static void
buildHilites
(BuildHilitesRequest buildRequest, BuildHilitesResponseCallback callback) Requests that available AI engine(s) be used to build one or moreHilite
objects according to the user's natural language description of hilite criteria and styling to apply.static void
clearAIFilterCaches
(AdvancedCriteria aiCriterion) Removes information for all records to which an "aiFilter"AdvancedCriteria
has been applied.static String
The ID of the defaultAIEngine
to use.static int
The defualt maximum number of retries for any one particular request to AI.static Boolean
Whether AI is disabled.static AIEngine
Returns theAIEngine
having the given engine ID.static AIEngine
Returns theAIEngine
having the given engine ID.static Boolean
isAIFieldRequestNumerical
(AIFieldRequest aiFieldRequest) Returnstrue
if the givenAIFieldRequest
is numerical (itsvalueClass
is ORDINAL, INTERVAL, or RATIO);false
otherwise.static boolean
Determines whether AI support is enabled.static boolean
registerEngine
(AIEngine engine) Registers the givenAIEngine
.static void
removeFromAIFilterCaches
(AdvancedCriteria aiCriterion, Record... records) Removes information for the given records from an "aiFilter"AdvancedCriteria
.static void
setDefaultEngineId
(String defaultEngineId) The ID of the defaultAIEngine
to use.static void
setDefaultMaxRetries
(int defaultMaxRetries) The defualt maximum number of retries for any one particular request to AI.static void
setDisabled
(Boolean disabled) Whether AI is disabled.static void
suggestRecordSummaryTitle
(SuggestRecordSummaryTitleRequest request, SuggestRecordSummaryTitleCallback callback) Requests that availableAIEngine
(s) be used to suggest an appropriate title for a new field that will contain AI-generated record summaries.static void
summarizeRecords
(SummarizeRecordsRequest request, SummarizeRecordsPartialResultCallback partialResultCallback, SummarizeRecordsResultCallback callback) Requests that available AI engine(s) be used to generate summaries of records according to the user's natural language description of how to summarize each record.static void
summarizeValue
(SummarizeValueRequest request, SummarizeValueResultCallback callback) Requests that available AI engine(s) be used to generate a summary of a value according to a natural language description of how to summarize the value.static boolean
unregisterEngine
(String engineId) Unregisters anAIEngine
specified by its ID.
-
Constructor Details
-
AI
public AI()
-
-
Method Details
-
setDefaultEngineId
The ID of the defaultAIEngine
to use.- Parameters:
defaultEngineId
- new defaultEngineId. Default value is "gpt-4o".
-
getDefaultEngineId
The ID of the defaultAIEngine
to 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
false
and thedefault
AIEngine
must 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
false
and thedefault
AIEngine
must be registered in order to enable the use of AI in the application.- Returns:
- current value of disabled
-
applyAIFilter
public static void applyAIFilter(ApplyAIFilterRequest applyRequest, ApplyAIFilterResponseCallback callback) Requests that available AI engine(s) be used to evaluate an "aiFilter"AdvancedCriteria
on a list of records.- Parameters:
applyRequest
- The request to AI to evaluate an "aiFilter"AdvancedCriteria
.callback
- The callback to call with the result.
-
buildAIFieldRequest
public static void buildAIFieldRequest(BuildAIFieldRequestRequest buildRequest, BuildAIFieldRequestResponseCallback callback) Requests that available AI engine(s) be used to build anAIFieldRequest
from a natural language description of the per-record values to generate for a new AI-generated field.- Parameters:
buildRequest
- The request.callback
- The callback to fire with the result.
-
buildCriterion
public static void buildCriterion(BuildCriterionRequest buildRequest, BuildCriterionResponseCallback callback) Requests that available AI engine(s) be used to build anAdvancedCriteria
object according to the user's natural language description of a filter.- Parameters:
buildRequest
- The request.callback
- The callback to fire with the result.
-
buildDataBoundUI
public static void buildDataBoundUI(BuildDataBoundUIViaAIRequest buildRequest, BuildUIViaAIResponseCallback callback) Requests that available AI engine(s) be used to build data-bound UI component(s) according to a user's description of what they would like to build.- Parameters:
buildRequest
- The request to AI to build data-bound UI.callback
- The callback to call with the result.
-
buildHilites
public static void buildHilites(BuildHilitesRequest buildRequest, BuildHilitesResponseCallback callback) Requests that available AI engine(s) be used to build one or moreHilite
objects according to the user's natural language description of hilite criteria and styling to apply.- Parameters:
buildRequest
- The request to AI to buildHilite
object(s).callback
- The callback to call with the result.
-
clearAIFilterCaches
Removes information for all records to which an "aiFilter"AdvancedCriteria
has been applied.- Parameters:
aiCriterion
- The "aiFilter"AdvancedCriteria
to update.
-
getEngine
Returns theAIEngine
having the given engine ID.- Returns:
- the
AIEngine
, ornull
if theAIEngine
could not be found.
-
getEngine
Returns theAIEngine
having the given engine ID.- Parameters:
engineId
- the engineId of theAIEngine
to get. If not specified,defaultEngineId
is used.- Returns:
- the
AIEngine
, ornull
if theAIEngine
could not be found.
-
isAIFieldRequestNumerical
Returnstrue
if the givenAIFieldRequest
is numerical (itsvalueClass
is ORDINAL, INTERVAL, or RATIO);false
otherwise.- Parameters:
aiFieldRequest
- TheAIFieldRequest
to test.- Returns:
true
if and only if the givenAIFieldRequest
is numerical.
-
isEnabled
public static boolean isEnabled()Determines whether AI support is enabled.disabled
must be set tofalse
and the defaultAIEngine
must be registered in order to enable the use of AI.- Returns:
true
if the use of AI is enabled;false
otherwise.- See Also:
-
com.smartgwt.client.ai.AI#disabled
com.smartgwt.client.ai.AI#defaultEngineId
-
registerEngine
Registers the givenAIEngine
.- Parameters:
engine
- TheAIEngine
to register.- Returns:
true
if theAIEngine
was successfully registered;false
otherwise.- See Also:
-
removeFromAIFilterCaches
Removes information for the given records from an "aiFilter"AdvancedCriteria
.- Parameters:
aiCriterion
- The "aiFilter"AdvancedCriteria
to update.records
- The records, about which any information held inaiCriterion
will be removed.
-
suggestRecordSummaryTitle
public static void suggestRecordSummaryTitle(SuggestRecordSummaryTitleRequest request, SuggestRecordSummaryTitleCallback callback) Requests that availableAIEngine
(s) be used to suggest an appropriate title for a new field that will contain AI-generated record summaries.- Parameters:
request
- The request.callback
- The callback to fire with the result.
-
summarizeRecords
public static void summarizeRecords(SummarizeRecordsRequest request, SummarizeRecordsPartialResultCallback partialResultCallback, SummarizeRecordsResultCallback callback) Requests that available AI engine(s) be used to generate summaries of records according to the user's natural language description of how to summarize each record.- Parameters:
request
- The request.partialResultCallback
- The callback to fire with each partial result.callback
- The callback to fire with the result.
-
summarizeValue
public static void summarizeValue(SummarizeValueRequest request, SummarizeValueResultCallback callback) Requests that available AI engine(s) be used to generate a summary of a value according to a natural language description of how to summarize the value.- Parameters:
request
- The request.callback
- The callback to fire with theSummarizeValueResult
.
-
unregisterEngine
Unregisters anAIEngine
specified by its ID.- Parameters:
engineId
- the ID of theAIEngine
to unregister.- Returns:
true
if theAIEngine
was successfully unregistered;false
otherwise.- See Also:
-