Class ToolInputSchemaAugmenter
java.lang.Object
org.springframework.ai.tool.augment.ToolInputSchemaAugmenter
This utility provides functionality to augment a JSON Schema with additional fields
based on a provided Record type. It uses a JSON Schema Generator to generate the schema
for the Record's fields and integrates them into an existing JSON Schema. The augmented
schema can then be used to re-define the tool inputs for tool calling.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents an extended argument type with additional metadata such as description and required status. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaugmentToolInputSchema(String jsonSchemaString, String propertyName, Type propertyType, String description, boolean required) static StringaugmentToolInputSchema(String jsonSchemaString, List<ToolInputSchemaAugmenter.AugmentedArgumentType> argumentType) static <T extends Record>
List<ToolInputSchemaAugmenter.AugmentedArgumentType> toAugmentedArgumentTypes(Class<T> recordClass) Extracts the tool argument types from a record class annotated withToolParam.
-
Method Details
-
toAugmentedArgumentTypes
public static <T extends Record> List<ToolInputSchemaAugmenter.AugmentedArgumentType> toAugmentedArgumentTypes(Class<T> recordClass) Extracts the tool argument types from a record class annotated withToolParam. It retrieves the field names, types, descriptions, and required status from the record components.- Parameters:
recordClass- The record class to extract argument types from.- Returns:
- A list of
ToolInputSchemaAugmenter.AugmentedArgumentTyperepresenting the tool input argument types.
-
augmentToolInputSchema
-
augmentToolInputSchema
public static String augmentToolInputSchema(String jsonSchemaString, List<ToolInputSchemaAugmenter.AugmentedArgumentType> argumentType)
-