Class AIEngine

java.lang.Object
com.smartgwt.client.core.BaseClass
com.smartgwt.client.ai.AIEngine
All Implemented Interfaces:
HasHandlers

public class AIEngine extends BaseClass
Provides access to a particular generative AI model.
  • Constructor Details

    • AIEngine

      public AIEngine()
    • AIEngine

      public AIEngine(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static AIEngine getOrCreateRef(JavaScriptObject jsObj)
    • setJavaScriptObject

      public void setJavaScriptObject(JavaScriptObject jsObj)
      Overrides:
      setJavaScriptObject in class BaseClass
    • create

      public JavaScriptObject create()
      Specified by:
      create in class BaseClass
    • isCreated

      public boolean isCreated()
      Overrides:
      isCreated in class BaseClass
    • getJsObj

      public JavaScriptObject getJsObj()
      Overrides:
      getJsObj in class BaseClass
    • getOrCreateJsObj

      public JavaScriptObject getOrCreateJsObj()
      Overrides:
      getOrCreateJsObj in class BaseClass
    • setEngineId

      public AIEngine setEngineId(String engineId) throws IllegalStateException
      The unique ID of this engine.
      Parameters:
      engineId - New engineId value. Default value is null
      Returns:
      AIEngine instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getEngineId

      public String getEngineId()
      The unique ID of this engine.
      Returns:
      Current engineId value. Default value is null
    • setName

      public AIEngine setName(String name) throws IllegalStateException
      The local name of this engine.
      Parameters:
      name - New name value. Default value is null
      Returns:
      AIEngine instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getName

      public String getName()
      The local name of this engine.
      Returns:
      Current name value. Default value is null
    • setProvider

      public AIEngine setProvider(String provider) throws IllegalStateException
      The provider of this engine. Typically this is the name of the company or organization that provides access to the AI model.
      Parameters:
      provider - New provider value. Default value is null
      Returns:
      AIEngine instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getProvider

      public String getProvider()
      The provider of this engine. Typically this is the name of the company or organization that provides access to the AI model.
      Returns:
      Current provider value. Default value is null
    • canSupportVisionRequests

      public boolean canSupportVisionRequests()
      Whether this AI engine can handle vision requests, or requests where one or more of the messages is an image.
      Returns:
      true if this AI engine can handle vision requests; false otherwise.
    • couldSupportRequest

      public boolean couldSupportRequest(AIRequest aiRequest)
      Determines whether this engine could support the given request.

      The reason for the uncertainty is that the implementation may use estimates (e.g. the number of tokens in a given message, as applied to input token limits), or an AI may decide to refuse to respond to the request.

      Parameters:
      aiRequest - The request to check.
      Returns:
      true if this AIEngine could support the request; false otherwise.
    • sendRequest

      public void sendRequest(AIRequest aiRequest, AIResponseCallback callback)
      Sends a request to this AI engine.
      Parameters:
      aiRequest - The request.
      callback - The callback to fire with the response.