Record Class ToolCallDecision
java.lang.Object
java.lang.Record
org.springframework.ai.model.tool.ToolCallDecision
- Record Components:
toolCallId- the key of the tool call the decision is about: its id, or its position key when it has no id of its own (seeToolCallDecisions.toolCallKeys(org.springframework.ai.chat.messages.AssistantMessage))allowed- whether the call may runmessage- for a denied call, the result the model receives;nullfor the default, never blank
public record ToolCallDecision(String toolCallId, boolean allowed, @Nullable String message)
extends Record
A caller's decision on one tool call that waits for confirmation: allow it to run, or
deny it with a message that the model receives as the call's result.
- Since:
- 2.1.0
- Author:
- Christian Tzolov
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe result a denied call answers the model with when the decision gives none. -
Constructor Summary
ConstructorsConstructorDescriptionToolCallDecision(String toolCallId, boolean allowed, @Nullable String message) Creates an instance of aToolCallDecisionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolCallDecisionAllows the tool call to run.booleanallowed()Returns the value of theallowedrecord component.static ToolCallDecisionDenies the tool call; the model receives the default message.static ToolCallDecisionDenies the tool call; the model receives the message as the call's result.The result a denied call answers the model with.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Stringmessage()Returns the value of themessagerecord component.Returns the value of thetoolCallIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_DENY_MESSAGE
The result a denied call answers the model with when the decision gives none.- See Also:
-
-
Constructor Details
-
ToolCallDecision
Creates an instance of aToolCallDecisionrecord class.- Parameters:
toolCallId- the value for thetoolCallIdrecord componentallowed- the value for theallowedrecord componentmessage- the value for themessagerecord component
-
-
Method Details
-
allow
Allows the tool call to run. -
deny
Denies the tool call; the model receives the default message. -
deny
Denies the tool call; the model receives the message as the call's result. -
denyMessage
The result a denied call answers the model with. -
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 '=='. -
toolCallId
Returns the value of thetoolCallIdrecord component.- Returns:
- the value of the
toolCallIdrecord component
-
allowed
public boolean allowed()Returns the value of theallowedrecord component.- Returns:
- the value of the
allowedrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-