Record Class ChatRequest

java.lang.Object
java.lang.Record
com.axelor.ai.chat.ChatRequest
Record Components:
id - the conversation/chat ID
messageId - when present, the message ID to regenerate from — history is expected to be truncated up to and including this message
agent - the agent code to use
model - the model code to use
messages - conversation history, can be last message only, in which case the provider is expected to fetch prior history if needed
options - optional request options
agentPath - ordered list of agent codes from root to current; e.g. ["assistant", "studio"]. Null for the top-level agent.
maxSteps - maximum agentic loop iterations; null means use default
programmatic - whether no person is on the other end: the turn is kept in no chat
trial - whether this is a trial run, or a consultation within one: an administrator's test of an agent, whose changes are undone

public record ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath, Integer maxSteps, boolean programmatic, boolean trial) extends Record
A chat stream call as the loop runs it. Built by the server, never read from a request body: a client's call arrives as an ChatRequest.Input, which carries only what a client may choose.
  • Constructor Details

  • Method Details

    • agents

      public List<String> agents()
      The agents the request runs through, from the root to its own: the path when it ends with this agent, else the agent alone; none without an agent. What the request may reach is what every one of them may.
    • isSubAgent

      public boolean isSubAgent()
      True if this agent was invoked as a sub-agent (has a parent).
    • continuesAssistantTurn

      public boolean continuesAssistantTurn()
      True when this continues an assistant message the client already holds — an approval answer or a client-tool output, sent back with that message's own id. The stream keeps that id and emits only what follows the pause, so its buffer is a tail rather than a whole turn.
    • withMessages

      public ChatRequest withMessages(List<UIMessage> messages)
      The same request with its messages replaced.
    • withContext

      public ChatRequest withContext(Map<String,Object> context)
      The same request with its options' context replaced; the session id and zone are kept.
    • withAgent

      public ChatRequest withAgent(String agentCode)
      The same request answered by another agent.
    • sessionId

      public String sessionId()
      The claim session id sent with this request, or null.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • messageId

      public String messageId()
      Returns the value of the messageId record component.
      Returns:
      the value of the messageId record component
    • agent

      public String agent()
      Returns the value of the agent record component.
      Returns:
      the value of the agent record component
    • model

      public String model()
      Returns the value of the model record component.
      Returns:
      the value of the model record component
    • messages

      public List<UIMessage> messages()
      Returns the value of the messages record component.
      Returns:
      the value of the messages record component
    • options

      public ChatRequest.Options options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component
    • agentPath

      public List<String> agentPath()
      Returns the value of the agentPath record component.
      Returns:
      the value of the agentPath record component
    • maxSteps

      public Integer maxSteps()
      Returns the value of the maxSteps record component.
      Returns:
      the value of the maxSteps record component
    • programmatic

      public boolean programmatic()
      Returns the value of the programmatic record component.
      Returns:
      the value of the programmatic record component
    • trial

      public boolean trial()
      Returns the value of the trial record component.
      Returns:
      the value of the trial record component