Package com.axelor.ai.chat
Record Class ChatRequest
java.lang.Object
java.lang.Record
com.axelor.ai.chat.ChatRequest
- Record Components:
id- the conversation/chat IDmessageId- when present, the message ID to regenerate from — history is expected to be truncated up to and including this messageagent- the agent code to usemodel- the model code to usemessages- conversation history, can be last message only, in which case the provider is expected to fetch prior history if neededoptions- optional request optionsagentPath- 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 defaultprogrammatic- whether no person is on the other end: the turn is kept in no chattrial- 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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe body of a client's chat stream call.static final record -
Constructor Summary
ConstructorsConstructorDescriptionChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options) A top-level, interactive request: no agentPath, default maxSteps.ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath) An interactive request with default maxSteps.ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath, Integer maxSteps, boolean programmatic) A request that is no trial run.ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath, Integer maxSteps, boolean programmatic, boolean trial) Creates an instance of aChatRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionagent()Returns the value of theagentrecord component.Returns the value of theagentPathrecord component.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.booleanTrue 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.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleanTrue if this agent was invoked as a sub-agent (has a parent).maxSteps()Returns the value of themaxStepsrecord component.Returns the value of themessageIdrecord component.messages()Returns the value of themessagesrecord component.model()Returns the value of themodelrecord component.options()Returns the value of theoptionsrecord component.booleanReturns the value of theprogrammaticrecord component.The claim session id sent with this request, or null.final StringtoString()Returns a string representation of this record class.booleantrial()Returns the value of thetrialrecord component.The same request answered by another agent.withContext(Map<String, Object> context) The same request with its options' context replaced; the session id and zone are kept.withMessages(List<UIMessage> messages) The same request with its messages replaced.
-
Constructor Details
-
ChatRequest
public ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath, Integer maxSteps, boolean programmatic) A request that is no trial run. -
ChatRequest
public ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options) A top-level, interactive request: no agentPath, default maxSteps. -
ChatRequest
public ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath) An interactive request with default maxSteps. -
ChatRequest
public ChatRequest(String id, String messageId, String agent, String model, List<UIMessage> messages, ChatRequest.Options options, List<String> agentPath, Integer maxSteps, boolean programmatic, boolean trial) Creates an instance of aChatRequestrecord class.- Parameters:
id- the value for theidrecord componentmessageId- the value for themessageIdrecord componentagent- the value for theagentrecord componentmodel- the value for themodelrecord componentmessages- the value for themessagesrecord componentoptions- the value for theoptionsrecord componentagentPath- the value for theagentPathrecord componentmaxSteps- the value for themaxStepsrecord componentprogrammatic- the value for theprogrammaticrecord componenttrial- the value for thetrialrecord component
-
-
Method Details
-
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
The same request with its messages replaced. -
withContext
The same request with its options' context replaced; the session id and zone are kept. -
withAgent
The same request answered by another agent. -
sessionId
The claim session id sent with this request, or null. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
messageId
Returns the value of themessageIdrecord component.- Returns:
- the value of the
messageIdrecord component
-
agent
Returns the value of theagentrecord component.- Returns:
- the value of the
agentrecord component
-
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
messages
Returns the value of themessagesrecord component.- Returns:
- the value of the
messagesrecord component
-
options
Returns the value of theoptionsrecord component.- Returns:
- the value of the
optionsrecord component
-
agentPath
Returns the value of theagentPathrecord component.- Returns:
- the value of the
agentPathrecord component
-
maxSteps
Returns the value of themaxStepsrecord component.- Returns:
- the value of the
maxStepsrecord component
-
programmatic
public boolean programmatic()Returns the value of theprogrammaticrecord component.- Returns:
- the value of the
programmaticrecord component
-
trial
public boolean trial()Returns the value of thetrialrecord component.- Returns:
- the value of the
trialrecord component
-