Class ToolValidator

java.lang.Object
ai.acolite.agentsdk.core.ToolValidator

public class ToolValidator extends Object
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 Details

    • ToolValidator

      public ToolValidator()
  • Method Details

    • validate

      public static void validate(Object tool)
      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

      public static void validateAll(List<?> tools)
      Validates a list of tools, collecting all validation errors.
      Parameters:
      tools - List of tools to validate
      Throws:
      IllegalArgumentException - if any tool fails validation