Class AiSuggestionEngineImpl
- All Implemented Interfaces:
AiSuggestionEngine
AiSuggestionEngine that coordinates
provider selection and taxonomy loading for AI-based security classification.
This implementation acts as the primary orchestration layer between the
command-line application and the provider-specific AI client subsystem. It
resolves the effective AiProviderClient through
AiProviderFactory, loads the taxonomy text used to guide
classification, and delegates class-level analysis requests to the selected
provider client.
Responsibilities
- creating the effective provider client from
AiOptions - loading taxonomy text from a configured file or from the selected built-in taxonomy mode
- delegating class analysis requests to the provider client
- presenting a provider-independent
AiSuggestionEnginecontract to higher-level callers
Instances of this class are immutable after construction and are intended to be created once per application run.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAiSuggestionEngineImpl(AiOptions options) Creates a new AI suggestion engine using the supplied runtime options. -
Method Summary
Modifier and TypeMethodDescriptionsuggestForClass(String fileStem, String fqcn, String classSource, List<PromptBuilder.TargetMethod> targetMethods) Requests AI-generated security classification for a single parsed test class.
-
Constructor Details
-
AiSuggestionEngineImpl
Creates a new AI suggestion engine using the supplied runtime options.During construction, the implementation resolves the effective provider client and loads the taxonomy text that will be supplied to the AI provider for subsequent classification requests. The taxonomy is taken from an external file when configured; otherwise, the built-in taxonomy selected by
AiOptions.taxonomyMode()is used.- Parameters:
options- AI runtime configuration controlling provider selection, taxonomy loading, and request behavior- Throws:
AiSuggestionException- if provider initialization fails or if the configured taxonomy cannot be loaded
-
-
Method Details
-
suggestForClass
public AiClassSuggestion suggestForClass(String fileStem, String fqcn, String classSource, List<PromptBuilder.TargetMethod> targetMethods) throws AiSuggestionException Requests AI-generated security classification for a single parsed test class.The method delegates directly to the configured
AiProviderClient, supplying the fully qualified class name, the complete class source, and the taxonomy text loaded at engine initialization time.- Specified by:
suggestForClassin interfaceAiSuggestionEngine- Parameters:
fileStem- dot-separated path stem identifying the source file; used by file-based engines to locate response filesfqcn- fully qualified class name of the analyzed test classclassSource- complete source code of the class to analyzetargetMethods- deterministically extracted JUnit test methods that must be classified- Returns:
- normalized AI classification result for the class and its methods
- Throws:
AiSuggestionException- if the provider fails to analyze the class or returns an invalid response- See Also:
-