Record Class AiOptions
- Record Components:
enabled- whether AI enrichment is enabledprovider- AI provider used to perform analysismodelName- provider-specific model identifierbaseUrl- base API endpoint used by the selected providerapiKey- API key used for authentication, if provided directlyapiKeyEnv- environment variable name containing the API keytaxonomyFile- optional path to an external taxonomy definitiontaxonomyMode- built-in taxonomy mode to use when no file is providedmaxClassChars- maximum number of characters allowed for class source submitted to the AI providertimeout- request timeout applied to AI callsmaxRetries- number of retry attempts for failed AI operationsconfidence- whether the AI provider should be asked to include a confidence score for each security-relevant method classification; requires model support and increases token usage slightly
MethodAtlasApp execution.
This record aggregates all runtime parameters required by the AI integration layer, including provider selection, model identification, authentication configuration, taxonomy selection, request limits, and retry behavior.
Instances of this record are typically constructed using the associated
AiOptions.Builder and passed to the AI subsystem when initializing an
AiSuggestionEngine. The configuration is immutable once constructed
and therefore safe to share between concurrent components.
Configuration Responsibilities
- AI provider selection and endpoint configuration
- model name resolution
- API key discovery
- taxonomy configuration for security classification
- input size limits for class source submission
- network timeout configuration
- retry policy for transient AI failures
Default values are supplied by the AiOptions.Builder when parameters are not
explicitly provided.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder used to construct validatedAiOptionsinstances.static enumBuilt-in taxonomy modes used for security classification. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault model identifier used when no model is explicitly configured. -
Constructor Summary
ConstructorsConstructorDescriptionAiOptions(boolean enabled, AiProvider provider, String modelName, String baseUrl, String apiKey, String apiKeyEnv, Path taxonomyFile, AiOptions.TaxonomyMode taxonomyMode, int maxClassChars, Duration timeout, int maxRetries, boolean confidence) Canonical constructor performing validation of configuration parameters. -
Method Summary
Modifier and TypeMethodDescriptionapiKey()Returns the value of theapiKeyrecord component.Returns the value of theapiKeyEnvrecord component.baseUrl()Returns the value of thebaseUrlrecord component.static AiOptions.Builderbuilder()Creates a newAiOptions.Builderused to constructAiOptionsinstances.booleanReturns the value of theconfidencerecord component.booleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxClassCharsrecord component.intReturns the value of themaxRetriesrecord component.Returns the value of themodelNamerecord component.provider()Returns the value of theproviderrecord component.Resolves the effective API key used for authenticating AI provider requests.Returns the value of thetaxonomyFilerecord component.Returns the value of thetaxonomyModerecord component.timeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_MODEL
Default model identifier used when no model is explicitly configured.This constant is intentionally public so that governance processes can locate and track the approved fallback model in version control without searching through builder internals.
- See Also:
-
-
Constructor Details
-
AiOptions
public AiOptions(boolean enabled, AiProvider provider, String modelName, String baseUrl, String apiKey, String apiKeyEnv, Path taxonomyFile, AiOptions.TaxonomyMode taxonomyMode, int maxClassChars, Duration timeout, int maxRetries, boolean confidence) Canonical constructor performing validation of configuration parameters.The constructor enforces basic invariants required for correct operation of the AI integration layer. Invalid values result in an
IllegalArgumentException.- Throws:
NullPointerException- if required parameters such asprovider,modelName,timeout, ortaxonomyModearenullIllegalArgumentException- if configuration values violate required constraints
-
-
Method Details
-
builder
Creates a newAiOptions.Builderused to constructAiOptionsinstances.The builder supplies sensible defaults for most configuration values and allows incremental customization before producing the final immutable configuration record.
- Returns:
- new builder instance
-
resolvedApiKey
Resolves the effective API key used for authenticating AI provider requests.The resolution strategy is:
- If
apiKey()is defined and non-empty, it is returned. - If
apiKeyEnv()is defined, the corresponding environment variable is resolved usingSystem.getenv(String). - If neither source yields a value,
nullis returned.
- Returns:
- resolved API key or
nullif none is available
- If
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-
modelName
Returns the value of themodelNamerecord component.- Returns:
- the value of the
modelNamerecord component
-
baseUrl
Returns the value of thebaseUrlrecord component.- Returns:
- the value of the
baseUrlrecord component
-
apiKey
Returns the value of theapiKeyrecord component.- Returns:
- the value of the
apiKeyrecord component
-
apiKeyEnv
Returns the value of theapiKeyEnvrecord component.- Returns:
- the value of the
apiKeyEnvrecord component
-
taxonomyFile
Returns the value of thetaxonomyFilerecord component.- Returns:
- the value of the
taxonomyFilerecord component
-
taxonomyMode
Returns the value of thetaxonomyModerecord component.- Returns:
- the value of the
taxonomyModerecord component
-
maxClassChars
public int maxClassChars()Returns the value of themaxClassCharsrecord component.- Returns:
- the value of the
maxClassCharsrecord component
-
timeout
Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
maxRetries
public int maxRetries()Returns the value of themaxRetriesrecord component.- Returns:
- the value of the
maxRetriesrecord component
-
confidence
public boolean confidence()Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-