Class SystemMessageConfig
The system message controls the behavior and personality of the AI assistant. This configuration allows you to either append to, replace, or fine-tune the default system message.
Example - Append Mode
var config = new SystemMessageConfig().setMode(SystemMessageMode.APPEND)
.setContent("Always respond in a formal tone.");
Example - Replace Mode
var config = new SystemMessageConfig().setMode(SystemMessageMode.REPLACE)
.setContent("You are a helpful coding assistant.");
Example - Customize Mode
var config = new SystemMessageConfig().setMode(SystemMessageMode.CUSTOMIZE)
.setSections(
Map.of(SystemPromptSections.TONE,
new SectionOverride().setAction(SectionOverrideAction.REPLACE)
.setContent("Be concise and formal."),
SystemPromptSections.CODE_CHANGE_RULES,
new SectionOverride().setAction(SectionOverrideAction.REMOVE)))
.setContent("Additional instructions appended after all sections.");
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the system message content.getMode()Gets the system message mode.Gets the section-level overrides forSystemMessageMode.CUSTOMIZEmode.setContent(String content) Sets the system message content.setMode(SystemMessageMode mode) Sets the system message mode.setSections(Map<String, SectionOverride> sections) Sets section-level overrides forSystemMessageMode.CUSTOMIZEmode.
-
Constructor Details
-
SystemMessageConfig
public SystemMessageConfig()
-
-
Method Details
-
getMode
Gets the system message mode.- Returns:
- the mode (APPEND, REPLACE, or CUSTOMIZE)
-
setMode
Sets the system message mode.Use
SystemMessageMode.APPENDto add to the default system message while preserving guardrails,SystemMessageMode.REPLACEto fully customize the system message, orSystemMessageMode.CUSTOMIZEto override individual sections.- Parameters:
mode- the mode (APPEND, REPLACE, or CUSTOMIZE)- Returns:
- this config for method chaining
-
getContent
Gets the system message content.- Returns:
- the content to append or use as replacement
-
setContent
Sets the system message content.For
SystemMessageMode.APPENDandSystemMessageMode.REPLACEmodes, this is the primary content. ForSystemMessageMode.CUSTOMIZEmode, this is appended after all section overrides.- Parameters:
content- the system message content- Returns:
- this config for method chaining
-
getSections
Gets the section-level overrides forSystemMessageMode.CUSTOMIZEmode.- Returns:
- the sections map, or
null
-
setSections
Sets section-level overrides forSystemMessageMode.CUSTOMIZEmode.Keys are section identifiers from
SystemPromptSections. Each value describes how that section should be modified. Sections with atransformcallback are handled locally by the SDK via asystemMessage.transformRPC call; the rest are sent to the CLI as-is.- Parameters:
sections- a map of section identifier to override operation- Returns:
- this config for method chaining
- Since:
- 1.2.0
-