Package com.smartgwt.client.ai

# Class AIRequest

java.lang.Object
com.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.core.RefDataClass
com.smartgwt.client.ai.AIRequest

All Implemented Interfaces:
  `HasHandlers`

public class AIRequest extends RefDataClass
Represents a request to AI for a response.

- ## Field Summary

  ### Fields inherited from class com.smartgwt.client.core.RefDataClass

  `id`

  ### Fields inherited from class com.smartgwt.client.core.DataClass

  `factoryCreated, factoryProperties`

  ### Fields inherited from class com.smartgwt.client.core.JsObject

  `jsObj`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AIRequest()`
  `AIRequest(JavaScriptObject jsObj)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CancellationController`
  `getCancellationController()`
  If provided, the `CancellationController` that will be looked to for whether the AI request is canceled.
  `String`
  `getHistoryConclusion()`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `Map`
  `getHistoryDelimiters()`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `String`
  `getHistoryIntroduction()`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `AIMessageWithSource[]`
  `getMessages()`
  List of messages forming the request.
  `static AIRequest`
  `getOrCreateRef(JavaScriptObject jsObj)`
  `String`
  `getPrompt()`
  Prompt text to AI.
  `Integer`
  `getResponseMaximum()`
  When the `responseType` is "number", the maximum value that the response may take.
  `Integer`
  `getResponseMinimum()`
  When the `responseType` is "number", the minimum value that the response may take.
  `AIContentType`
  `getResponseType()`
  The type of content expected from AI.
  `Integer`
  `getTemperature()`
  A number from 0 to 1 representing how much variability or creativity in responses AI should generate.
  `Boolean`
  `getWillHandleError()`
  Unless willHandleError is `true`, responses that are non-successful will go through centralized error handling in the RPCManager, and the `AIResponseCallback` will not be called.
  `AIRequest`
  `setCancellationController(CancellationController cancellationController)`
  If provided, the `CancellationController` that will be looked to for whether the AI request is canceled.
  `AIRequest`
  `setHistoryConclusion(String historyConclusion)`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `AIRequest`
  `setHistoryDelimiters(Map historyDelimiters)`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `AIRequest`
  `setHistoryIntroduction(String historyIntroduction)`
  When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
  `AIRequest`
  `setMessages(AIMessageWithSource... messages)`
  List of messages forming the request.
  `AIRequest`
  `setPrompt(String prompt)`
  Prompt text to AI.
  `AIRequest`
  `setResponseMaximum(Integer responseMaximum)`
  When the `responseType` is "number", the maximum value that the response may take.
  `AIRequest`
  `setResponseMinimum(Integer responseMinimum)`
  When the `responseType` is "number", the minimum value that the response may take.
  `AIRequest`
  `setResponseType(AIContentType responseType)`
  The type of content expected from AI.
  `AIRequest`
  `setTemperature(Integer temperature)`
  A number from 0 to 1 representing how much variability or creativity in responses AI should generate.
  `AIRequest`
  `setWillHandleError(Boolean willHandleError)`
  Unless willHandleError is `true`, responses that are non-successful will go through centralized error handling in the RPCManager, and the `AIResponseCallback` will not be called.

  ### Methods inherited from class com.smartgwt.client.core.RefDataClass

  `getRef, getRef, internalSetID`

  ### Methods inherited from class com.smartgwt.client.core.DataClass

  `applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated`

  ### Methods inherited from class com.smartgwt.client.core.JsObject

  `equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AIRequest

    public AIRequest()

  - ### AIRequest

    public AIRequest(JavaScriptObject jsObj)

- ## Method Details

  - ### getOrCreateRef

    public static AIRequest getOrCreateRef(JavaScriptObject jsObj)

  - ### setCancellationController

    public AIRequest setCancellationController(CancellationController cancellationController)
    If provided, the `CancellationController` that will be looked to for whether the AI request is canceled.
    Parameters:
      `cancellationController` - New cancellationController value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getCancellationController

    public CancellationController getCancellationController()
    If provided, the `CancellationController` that will be looked to for whether the AI request is canceled.
    Returns:
      Current cancellationController value. Default value is null

  - ### setHistoryConclusion

    public AIRequest setHistoryConclusion(String historyConclusion)
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This text is included verbatim before the concatenation of all-but-the-last non-system message.
    Parameters:
      `historyConclusion` - New historyConclusion value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getHistoryConclusion

    public String getHistoryConclusion()
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This text is included verbatim before the concatenation of all-but-the-last non-system message.
    Returns:
      Current historyConclusion value. Default value is null

  - ### setHistoryDelimiters

    public AIRequest setHistoryDelimiters(Map historyDelimiters)
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This maps the `AIMessageSource` to the delimiter to be used to enclose the content of the message.
    Parameters:
      `historyDelimiters` - New historyDelimiters value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getHistoryDelimiters

    public Map getHistoryDelimiters()
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This maps the `AIMessageSource` to the delimiter to be used to enclose the content of the message.
    Returns:
      Current historyDelimiters value. Default value is null

  - ### setHistoryIntroduction

    public AIRequest setHistoryIntroduction(String historyIntroduction)
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This text is included verbatim before the concatenation of all-but-the-last non-system message.
    Parameters:
      `historyIntroduction` - New historyIntroduction value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getHistoryIntroduction

    public String getHistoryIntroduction()
    When this engine does not support multiple messages, all of the messages of the request must be concatenated together. This text is included verbatim before the concatenation of all-but-the-last non-system message.
    Returns:
      Current historyIntroduction value. Default value is null

  - ### setMessages

    public AIRequest setMessages(AIMessageWithSource... messages)
    List of messages forming the request.
    Parameters:
      `messages` - New messages value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getMessages

    public AIMessageWithSource[] getMessages()
    List of messages forming the request.
    Returns:
      Current messages value. Default value is null

  - ### setPrompt

    public AIRequest setPrompt(String prompt)
    Prompt text to AI. If `messages` are also provided, then this prompt is appended as another message with type "text" and source "user" when submitted to AI.
    Parameters:
      `prompt` - New prompt value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getPrompt

    public String getPrompt()
    Prompt text to AI. If `messages` are also provided, then this prompt is appended as another message with type "text" and source "user" when submitted to AI.
    Returns:
      Current prompt value. Default value is null

  - ### setResponseMaximum

    public AIRequest setResponseMaximum(Integer responseMaximum)
    When the `responseType` is "number", the maximum value that the response may take. If not specified, then there is no maximum.
    Parameters:
      `responseMaximum` - New responseMaximum value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getResponseMaximum

    public Integer getResponseMaximum()
    When the `responseType` is "number", the maximum value that the response may take. If not specified, then there is no maximum.
    Returns:
      Current responseMaximum value. Default value is null

  - ### setResponseMinimum

    public AIRequest setResponseMinimum(Integer responseMinimum)
    When the `responseType` is "number", the minimum value that the response may take. If not specified, then there is no minimum.
    Parameters:
      `responseMinimum` - New responseMinimum value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getResponseMinimum

    public Integer getResponseMinimum()
    When the `responseType` is "number", the minimum value that the response may take. If not specified, then there is no minimum.
    Returns:
      Current responseMinimum value. Default value is null

  - ### setResponseType

    public AIRequest setResponseType(AIContentType responseType)
    The type of content expected from AI.

    If this type is "number", then the response from AI is constrained by `responseMinimum` and `responseMaximum`.

    Parameters:
      `responseType` - New responseType value. Default value is "text"
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getResponseType

    public AIContentType getResponseType()
    The type of content expected from AI.

    If this type is "number", then the response from AI is constrained by `responseMinimum` and `responseMaximum`.

    Returns:
      Current responseType value. Default value is "text"

  - ### setTemperature

    public AIRequest setTemperature(Integer temperature)
    A number from 0 to 1 representing how much variability or creativity in responses AI should generate. 0 is little-to-no variation. 1 is high variation.
    Parameters:
      `temperature` - New temperature value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getTemperature

    public Integer getTemperature()
    A number from 0 to 1 representing how much variability or creativity in responses AI should generate. 0 is little-to-no variation. 1 is high variation.
    Returns:
      Current temperature value. Default value is null

  - ### setWillHandleError

    public AIRequest setWillHandleError(Boolean willHandleError)
    Unless willHandleError is `true`, responses that are non-successful will go through centralized error handling in the RPCManager, and the `AIResponseCallback` will not be called.

    Setting this attribute to `true` means that the callback will receive both successful and non-successful responses, and you must handle any errors.

    Parameters:
      `willHandleError` - New willHandleError value. Default value is null
    Returns:
      `AIRequest` instance, for chaining setter calls

  - ### getWillHandleError

    public Boolean getWillHandleError()
    Unless willHandleError is `true`, responses that are non-successful will go through centralized error handling in the RPCManager, and the `AIResponseCallback` will not be called.

    Setting this attribute to `true` means that the callback will receive both successful and non-successful responses, and you must handle any errors.

    Returns:
      Current willHandleError value. Default value is null