Package atessera.sensei
Class SenseiConfig
java.lang.Object
atessera.sensei.SenseiConfig
Global configuration of the laboratory checking system.
The configuration can be supplied as a JSON file through
load(Path). Values that are not present in the JSON keep their
field initializers, so a configuration file may specify only the parts
it needs to override.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionPath to the MVStore database file.API key used to access the OpenAI compatible endpoint.Base URL of the OpenAI compatible API.Chat model name used for code review and verdict summarization.SMTP settings used for sending result e-mails. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SenseiConfigCreates a configuration with sample values for every field.booleanChecks whether an OpenAI API key is available.booleanhasSmtp()Checks whether SMTP settings look sufficient for sending mail.static SenseiConfigLoads the configuration from a JSON file.voidWrites the configuration to a JSON file.
-
Field Details
-
openAiApiKey
API key used to access the OpenAI compatible endpoint. -
openAiBaseUrl
Base URL of the OpenAI compatible API. -
openAiModel
Chat model name used for code review and verdict summarization. -
mvStorePath
Path to the MVStore database file. -
smtp
SMTP settings used for sending result e-mails.
-
-
Constructor Details
-
SenseiConfig
public SenseiConfig()
-
-
Method Details
-
load
Loads the configuration from a JSON file.- Parameters:
path- path to the JSON configuration file; must not benull- Returns:
- the loaded configuration
- Throws:
IOException- if the file cannot be read
-
createSample
Creates a configuration with sample values for every field.The OpenAI API key is taken from the
OPENAI_API_KEYenvironment variable when present, otherwise a placeholder is used.- Returns:
- a configuration filled with sample values
-
save
Writes the configuration to a JSON file.Parent directories are created when necessary.
- Parameters:
path- target file path; must not benull- Throws:
IOException- when the file cannot be written
-
hasOpenAiKey
public boolean hasOpenAiKey()Checks whether an OpenAI API key is available.- Returns:
truewhen LLM based checks can be performed
-
hasSmtp
public boolean hasSmtp()Checks whether SMTP settings look sufficient for sending mail.- Returns:
truewhen SMTP host and sender are configured
-