Package dev.langchain4j.agent.tool
Class ToolSpecifications
-
- All Implemented Interfaces:
public class ToolSpecifications
Utility methods for ToolSpecifications.
-
-
Method Summary
Modifier and Type Method Description static List<ToolSpecification>
toolSpecificationsFrom(Class<out Object> classWithTools)
Returns ToolSpecifications for all methods annotated with @Tool within the specified class. static List<ToolSpecification>
toolSpecificationsFrom(Object objectWithTools)
Returns ToolSpecifications for all methods annotated with @Tool within the class of the specified object. static void
validateSpecifications(List<ToolSpecification> toolSpecifications)
Validates all the ToolSpecifications. static ToolSpecification
toolSpecificationFrom(Method method)
Returns the ToolSpecification for the given method annotated with @Tool. -
-
Method Detail
-
toolSpecificationsFrom
static List<ToolSpecification> toolSpecificationsFrom(Class<out Object> classWithTools)
Returns ToolSpecifications for all methods annotated with @Tool within the specified class.
- Parameters:
classWithTools
- the class.- Returns:
the ToolSpecifications.
-
toolSpecificationsFrom
static List<ToolSpecification> toolSpecificationsFrom(Object objectWithTools)
Returns ToolSpecifications for all methods annotated with @Tool within the class of the specified object.
- Parameters:
objectWithTools
- the object.- Returns:
the ToolSpecifications.
-
validateSpecifications
static void validateSpecifications(List<ToolSpecification> toolSpecifications)
Validates all the ToolSpecifications. The validation checks for duplicate method names. Throws IllegalArgumentException if validation fails
- Parameters:
toolSpecifications
- list of ToolSpecification to be validated.
-
toolSpecificationFrom
static ToolSpecification toolSpecificationFrom(Method method)
Returns the ToolSpecification for the given method annotated with @Tool.
- Parameters:
method
- the method.- Returns:
the ToolSpecification.
-
-
-
-