Class AIRequest

All Implemented Interfaces:
HasHandlers

public class AIRequest extends RefDataClass
Represents a request to AI for a response.
  • 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