Class AiToolInput
java.lang.Object
com.kingsrook.qqq.backend.core.actions.ai.tools.AiToolInput
Typed, validating access to the (untrusted) input object of an AI tool call.
Every accessor throws an INVALID_INPUT
AiToolException for a value of
the wrong type, so tools never see unchecked input.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA value as an object (a map with string keys).static StringA value as a string - accepting strings, numbers and booleans.getOptionalInteger(String key) An optional integer.getOptionalList(String key) An optional list.getOptionalMap(String key) An optional object (map).getOptionalString(String key) An optional string (numbers are accepted, as their string form).An optional list of strings.getRequiredString(String key) A required, non-blank string.booleanWhether the input has a (non-null) value for a key.voidrequireOnlyKeys(Collection<String> allowedKeys) Reject any keys outside the allowed set (the schemas are additionalProperties = false, and the kernel enforces that, rather than trusting the model).
-
Field Details
-
MAX_STRING_LENGTH
public static final int MAX_STRING_LENGTH- See Also:
-
-
Constructor Details
-
AiToolInput
-
-
Method Details
-
requireOnlyKeys
Reject any keys outside the allowed set (the schemas are additionalProperties = false, and the kernel enforces that, rather than trusting the model).- Throws:
AiToolException
-
getRequiredString
A required, non-blank string.- Throws:
AiToolException
-
getOptionalString
An optional string (numbers are accepted, as their string form).- Throws:
AiToolException
-
getOptionalInteger
An optional integer.- Throws:
AiToolException
-
getOptionalStringList
An optional list of strings.- Throws:
AiToolException
-
getOptionalList
An optional list.- Throws:
AiToolException
-
getOptionalMap
An optional object (map).- Throws:
AiToolException
-
has
Whether the input has a (non-null) value for a key. -
asString
A value as a string - accepting strings, numbers and booleans.- Throws:
AiToolException
-
asMap
A value as an object (a map with string keys).- Throws:
AiToolException
-