Package com.axelor.ai.tool.system
Record Class ToolContext
java.lang.Object
java.lang.Record
com.axelor.ai.tool.system.ToolContext
- Record Components:
agents- the codes of the agents the call runs through, from the root to the one calling: a sub-agent is held to the reach of every agent that consulted itchatId- the chat the call runs in, or null for a programmatic call with no chattoolCallId- the call's id in the chat, or nullanswer- the user's answer when the call carries on after a confirmation it asked for:trueto carry on,falseto decline; null otherwisequestion- the id of the questionansweranswers, as the tool gave it; null otherwiseactiveView- the context of the view open beside the chat when the message was sent, as the client builds it for the view's own actions — a form's values, unsaved edits included — or nullaccess- what the call may do for its user; null to decide for the current user when asked
public record ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question, Map<String,Object> activeView, Access access)
extends Record
Execution context passed to system tools. Carries agent-scoped configuration so tools can enforce
authorization server-side, and the call's place in a chat for a tool that can pause.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes) A context outside any chat.ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question) A context in a chat, with no view open beside it.ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question, Map<String, Object> activeView) A context whose access is decided for the current user when asked.ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question, Map<String, Object> activeView, Access access) Creates an instance of aToolContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaccess()What the call may do: the access it was given, else its agents' for the current user, decided now.Returns the value of theactiveViewrecord component.agents()Returns the value of theagentsrecord component.Returns the value of theallowedKnowledgeBaseIdsrecord component.answer()Returns the value of theanswerrecord component.Returns the value of theavailableSkillCodesrecord component.chatId()Returns the value of thechatIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleaninChat()Whether the call has a chat, and so a user who can be asked.question()Returns the value of thequestionrecord component.Returns the value of thetoolCallIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ToolContext
public ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question, Map<String, Object> activeView) A context whose access is decided for the current user when asked. -
ToolContext
public ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes) A context outside any chat. -
ToolContext
public ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question) A context in a chat, with no view open beside it. -
ToolContext
public ToolContext(List<String> agents, Set<Long> allowedKnowledgeBaseIds, Set<String> availableSkillCodes, String chatId, String toolCallId, Boolean answer, String question, Map<String, Object> activeView, Access access) Creates an instance of aToolContextrecord class.- Parameters:
agents- the value for theagentsrecord componentallowedKnowledgeBaseIds- the value for theallowedKnowledgeBaseIdsrecord componentavailableSkillCodes- the value for theavailableSkillCodesrecord componentchatId- the value for thechatIdrecord componenttoolCallId- the value for thetoolCallIdrecord componentanswer- the value for theanswerrecord componentquestion- the value for thequestionrecord componentactiveView- the value for theactiveViewrecord componentaccess- the value for theaccessrecord component
-
-
Method Details
-
access
What the call may do: the access it was given, else its agents' for the current user, decided now. A tool asks once per call, since a fresh one decides afresh. -
inChat
public boolean inChat()Whether the call has a chat, and so a user who can be asked. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
agents
Returns the value of theagentsrecord component.- Returns:
- the value of the
agentsrecord component
-
allowedKnowledgeBaseIds
Returns the value of theallowedKnowledgeBaseIdsrecord component.- Returns:
- the value of the
allowedKnowledgeBaseIdsrecord component
-
availableSkillCodes
Returns the value of theavailableSkillCodesrecord component.- Returns:
- the value of the
availableSkillCodesrecord component
-
chatId
Returns the value of thechatIdrecord component.- Returns:
- the value of the
chatIdrecord component
-
toolCallId
Returns the value of thetoolCallIdrecord component.- Returns:
- the value of the
toolCallIdrecord component
-
answer
Returns the value of theanswerrecord component.- Returns:
- the value of the
answerrecord component
-
question
Returns the value of thequestionrecord component.- Returns:
- the value of the
questionrecord component
-
activeView
Returns the value of theactiveViewrecord component.- Returns:
- the value of the
activeViewrecord component
-