Package ai.acolite.agentsdk.core
Class ToolValidator
java.lang.Object
ai.acolite.agentsdk.core.ToolValidator
Utility for validating that tools are properly configured for use with OpenAI's function calling
framework.
OpenAI's function calling requires properly annotated parameter classes. This validator checks that tools meet the requirements before runtime errors occur.
Example usage in tests:
@Test
void myTool_isProperlyConfigured() {
ToolValidator.validate(new MyTool());
}
Example usage at agent build time (automatic):
Agent<UnknownContext, TextOutput> agent =
Agent.<UnknownContext, TextOutput>builder()
.name("MyAgent")
.tools(List.of(new MyTool())) // Automatically validated
.build();
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidValidates that a tool is properly configured for OpenAI function calling.static voidvalidateAll(List<?> tools) Validates a list of tools, collecting all validation errors.
-
Constructor Details
-
ToolValidator
public ToolValidator()
-
-
Method Details
-
validate
Validates that a tool is properly configured for OpenAI function calling.- Parameters:
tool- The tool to validate- Throws:
IllegalArgumentException- if validation fails with details about what's wrong
-
validateAll
Validates a list of tools, collecting all validation errors.- Parameters:
tools- List of tools to validate- Throws:
IllegalArgumentException- if any tool fails validation
-