public class AI
extends java.lang.Object
AI engines
, and performing high-level operations using installed AI engines.Constructor and Description |
---|
AI() |
Modifier and Type | Method and Description |
---|---|
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. |
static void |
buildAIFieldRequest(BuildAIFieldRequestRequest buildRequest,
BuildAIFieldRequestResponseCallback callback)
Requests that available AI engine(s) be used to build an
AIFieldRequest 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 an
AdvancedCriteria 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 more
Hilite 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 java.lang.String |
getDefaultEngineId()
The ID of the default
AIEngine to use. |
static int |
getDefaultMaxRetries()
The defualt maximum number of retries for any one particular request to AI.
|
static java.lang.Boolean |
getDisabled()
Whether AI is disabled.
|
static AIEngine |
getEngine()
Returns the
AIEngine having the given engine ID. |
static AIEngine |
getEngine(java.lang.String engineId)
Returns the
AIEngine having the given engine ID. |
static java.lang.Boolean |
isAIFieldRequestNumerical(AIFieldRequest aiFieldRequest)
Returns
true if the given AIFieldRequest is numerical (its valueClass is ORDINAL, INTERVAL, or RATIO); false
otherwise. |
static boolean |
isEnabled()
Determines whether AI support is enabled.
|
static boolean |
registerEngine(AIEngine engine)
Registers the given
AIEngine . |
static void |
removeFromAIFilterCaches(AdvancedCriteria aiCriterion,
Record... records)
Removes information for the given records from an "aiFilter"
AdvancedCriteria . |
static void |
setDefaultEngineId(java.lang.String defaultEngineId)
The ID of the default
AIEngine to use. |
static void |
setDefaultMaxRetries(int defaultMaxRetries)
The defualt maximum number of retries for any one particular request to AI.
|
static void |
setDisabled(java.lang.Boolean disabled)
Whether AI is disabled.
|
static void |
suggestRecordSummaryTitle(SuggestRecordSummaryTitleRequest request,
SuggestRecordSummaryTitleCallback callback)
Requests that available
AIEngine (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(java.lang.String engineId)
Unregisters an
AIEngine specified by its ID. |
public static void setDefaultEngineId(java.lang.String defaultEngineId)
AIEngine
to use.defaultEngineId
- new defaultEngineId. Default value is "gpt-4".public static java.lang.String getDefaultEngineId()
AIEngine
to use.public static void setDefaultMaxRetries(int defaultMaxRetries)
defaultMaxRetries
- new defaultMaxRetries. Default value is 2.public static int getDefaultMaxRetries()
public static void setDisabled(java.lang.Boolean disabled)
By default, AI is disabled. This static property must be set to false
and the
default
AIEngine
must be registered in
order to enable the use of AI in the application.
disabled
- new disabled. Default value is true.public static java.lang.Boolean getDisabled()
By default, AI is disabled. This static property must be set to false
and the
default
AIEngine
must be registered in
order to enable the use of AI in the application.
public static void applyAIFilter(ApplyAIFilterRequest applyRequest, ApplyAIFilterResponseCallback callback)
AdvancedCriteria
on a list of records.applyRequest
- The request to AI to evaluate an "aiFilter" AdvancedCriteria
.callback
- The callback to call with the result.public static void buildAIFieldRequest(BuildAIFieldRequestRequest buildRequest, BuildAIFieldRequestResponseCallback callback)
AIFieldRequest
from a natural
language description of the per-record values to generate for a new AI-generated field.buildRequest
- The request.callback
- The callback to fire with the result.public static void buildCriterion(BuildCriterionRequest buildRequest, BuildCriterionResponseCallback callback)
AdvancedCriteria
object
according to the user's natural language description of a filter.buildRequest
- The request.callback
- The callback to fire with the result.public static void buildDataBoundUI(BuildDataBoundUIViaAIRequest buildRequest, BuildUIViaAIResponseCallback callback)
buildRequest
- The request to AI to build data-bound UI.callback
- The callback to call with the result.public static void buildHilites(BuildHilitesRequest buildRequest, BuildHilitesResponseCallback callback)
Hilite
objects
according to the user's natural language description of hilite criteria and styling to apply.buildRequest
- The request to AI to build Hilite
object(s).callback
- The callback to call with the result.public static void clearAIFilterCaches(AdvancedCriteria aiCriterion)
AdvancedCriteria
has been
applied.aiCriterion
- The "aiFilter" AdvancedCriteria
to update.public static AIEngine getEngine()
AIEngine
having the given engine ID.AIEngine
, or null
if the AIEngine
could not be found.public static AIEngine getEngine(java.lang.String engineId)
AIEngine
having the given engine ID.engineId
- the engineId of the AIEngine
to get. If not specified, defaultEngineId
is used.AIEngine
, or null
if the AIEngine
could not be found.public static java.lang.Boolean isAIFieldRequestNumerical(AIFieldRequest aiFieldRequest)
true
if the given AIFieldRequest
is numerical (its valueClass
is ORDINAL, INTERVAL, or RATIO); false
otherwise.aiFieldRequest
- The AIFieldRequest
to test.true
if and only if the given AIFieldRequest
is numerical.public static boolean isEnabled()
disabled
must be set to
false
and the default AIEngine
must be registered in order to enable the use
of AI.true
if the use of AI is enabled; false
otherwise.com.smartgwt.client.ai.AI#disabled
,
com.smartgwt.client.ai.AI#defaultEngineId
public static boolean registerEngine(AIEngine engine)
AIEngine
.engine
- The AIEngine
to register.true
if the AIEngine
was successfully registered; false
otherwise.unregisterEngine(java.lang.String)
public static void removeFromAIFilterCaches(AdvancedCriteria aiCriterion, Record... records)
AdvancedCriteria
.aiCriterion
- The "aiFilter" AdvancedCriteria
to update.records
- The records, about which any information held in aiCriterion
will be removed.public static void suggestRecordSummaryTitle(SuggestRecordSummaryTitleRequest request, SuggestRecordSummaryTitleCallback callback)
AIEngine
(s) be used to suggest an appropriate title for a new
field that will contain AI-generated record summaries.request
- The request.callback
- The callback to fire with the result.public static void summarizeRecords(SummarizeRecordsRequest request, SummarizeRecordsPartialResultCallback partialResultCallback, SummarizeRecordsResultCallback callback)
request
- The request.partialResultCallback
- The callback to fire with each partial result.callback
- The callback to fire with the result.public static void summarizeValue(SummarizeValueRequest request, SummarizeValueResultCallback callback)
request
- The request.callback
- The callback to fire with the SummarizeValueResult
.public static boolean unregisterEngine(java.lang.String engineId)
AIEngine
specified by its ID.engineId
- the ID of the AIEngine
to unregister.true
if the AIEngine
was successfully unregistered; false
otherwise.registerEngine(com.smartgwt.client.ai.AIEngine)