Package com.tnsai.metadata
Class ToolExampleSpec
java.lang.Object
com.tnsai.metadata.ToolExampleSpec
Immutable metadata about a tool usage example.
Extracted from
ToolExampleSpec annotation.
Following ADR-006: Immutable Models
- Author:
- TnsAI Team
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToolExampleSpec(ToolExample annotation) Creates example metadata from annotation.ToolExampleSpec(String description, String input, String output, boolean negative, String whyBad) Creates example metadata with all fields. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolExampleSpecfrom(ToolExample annotation) Factory method to create from annotation.booleanChecks if this example has a description.booleanChecks if this example has output.booleanChecks if this is a positive (good) example.Formats the example for inclusion in prompts or documentation.
-
Constructor Details
-
ToolExampleSpec
Creates example metadata from annotation.- Parameters:
annotation- the ToolExample annotation
-
ToolExampleSpec
public ToolExampleSpec(String description, String input, String output, boolean negative, String whyBad) Creates example metadata with all fields.- Parameters:
description- example descriptioninput- JSON input stringoutput- expected outputnegative- whether this is a negative examplewhyBad- explanation for negative examples
-
-
Method Details
-
from
Factory method to create from annotation.- Parameters:
annotation- the ToolExample annotation- Returns:
- new ToolExampleSpec instance
-
hasDescription
public boolean hasDescription()Checks if this example has a description.- Returns:
- true if description is not empty
-
hasOutput
public boolean hasOutput()Checks if this example has output.- Returns:
- true if output is not empty
-
isPositive
public boolean isPositive()Checks if this is a positive (good) example.- Returns:
- true if not a negative example
-
toFormattedString
Formats the example for inclusion in prompts or documentation.- Returns:
- formatted example string
-