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:
    com.google.gwt.event.shared.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 and Description
    `AIRequest()`
    `AIRequest(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CancellationController` | `getCancellationController()` If provided, the `CancellationController` that will be looked to for whether the AI request is canceled.
    `java.lang.String` | `getHistoryConclusion()` When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
    `java.util.Map` | `getHistoryDelimiters()` When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
    `java.lang.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(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `java.lang.String` | `getPrompt()` Prompt text to AI.
    `java.lang.Integer` | `getResponseMaximum()` When the `responseType` is "number", the maximum value that the response may take.
    `java.lang.Integer` | `getResponseMinimum()` When the `responseType` is "number", the minimum value that the response may take.
    `AIContentType` | `getResponseType()` The type of content expected from AI.
    `java.lang.Integer` | `getTemperature()` A number from 0 to 1 representing how much variability or creativity in responses AI should generate.
    `java.lang.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(java.lang.String historyConclusion)` When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
    `AIRequest` | `setHistoryDelimiters(java.util.Map historyDelimiters)` When this engine does not support multiple messages, all of the messages of the request must be concatenated together.
    `AIRequest` | `setHistoryIntroduction(java.lang.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(java.lang.String prompt)` Prompt text to AI.
    `AIRequest` | `setResponseMaximum(java.lang.Integer responseMaximum)` When the `responseType` is "number", the maximum value that the response may take.
    `AIRequest` | `setResponseMinimum(java.lang.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(java.lang.Integer temperature)` A number from 0 to 1 representing how much variability or creativity in responses AI should generate.
    `AIRequest` | `setWillHandleError(java.lang.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 Detail

    - #### AIRequest

          public AIRequest()

    - #### AIRequest

          public AIRequest(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### getOrCreateRef

          public static AIRequest getOrCreateRef(com.google.gwt.core.client.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(java.lang.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 java.lang.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(java.util.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 java.util.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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