Class AiRequestOptions.Builder
- Enclosing class:
AiRequestOptions
AiRequestOptions.
The builder records requested overrides only. It does not validate saved prompt names, profile names, provider names, or model availability; those are resolved when the request starts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds immutable request options.exactSystemMessage(String systemMessage) Sets the complete system message exactly as supplied by the caller.mode(AiRequestMode mode) Sets the request execution mode.modelConfiguration(AiModelConfiguration modelConfiguration) Sets model-configuration overrides.Requests a saved assistant profile by name.Requests an inline assistant profile instruction.selectionOverride(AiSelectionOverride selectionOverride) Sets the Freeplane map selection injected into the first prompt message.systemMessage(String systemMessage) Sets a base system-message override while preserving Freeplane guidance.Sets the maximum request duration.toolAvailability(AiToolAvailability toolAvailability) Sets the AI tool availability requested for this call.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
timeout
Sets the maximum request duration.- Parameters:
timeout- positive timeout; must not benull- Returns:
- this builder
-
mode
Sets the request execution mode.This is mandatory for
askAi. If omitted forrunAiPrompt, the saved prompt decides whether the request is shown in chat or hidden.- Parameters:
mode- requested execution mode, ornullto leave it unset- Returns:
- this builder
-
modelConfiguration
Sets model-configuration overrides.Unset fields inside the configuration inherit independently. For a saved prompt, inherited fields come from the saved prompt; otherwise they come from the current model defaults. Use
AiModelSelection.defaultModel()to explicitly request the default model instead of a saved prompt's model.- Parameters:
modelConfiguration- model overrides, ornullto inherit all- Returns:
- this builder
-
toolAvailability
Sets the AI tool availability requested for this call.- Parameters:
toolAvailability- requested availability, ornullto inherit- Returns:
- this builder
-
selectionOverride
Sets the Freeplane map selection injected into the first prompt message.This changes only prompt composition. It does not change the user's UI selection and does not affect later tool results.
- Parameters:
selectionOverride- selection override, ornullto use the current selection- Returns:
- this builder
-
systemMessage
Sets a base system-message override while preserving Freeplane guidance.The value is trimmed when
build()is called. Passingnullclears the override and makes the request use the configured Freeplane AI system message. Passing a blank string stores"", which suppresses the configured base message but still lets Freeplane append generated guidance for the active tool level and other applicable chat context, such as map-selection handling, profile control, response format, or code-host use.This method clears the exact-system-message flag set by
exactSystemMessage(String); the last system-message builder call wins.- Parameters:
systemMessage- base system message override, blank to suppress the configured base message, ornullto inherit it- Returns:
- this builder
-
exactSystemMessage
Sets the complete system message exactly as supplied by the caller.The value is trimmed when
build()is called. When non-null, Freeplane treats the trimmed value, including"", as the complete system instruction and does not append generated guidance. The caller is then responsible for including any required instructions that Freeplane would normally add, such as tool-calling, map-selection, profile-control, response-format, or code-host instructions.Passing
nullclears the system-message override and clears the exact flag.systemMessage(String)also clears the exact flag; the last system-message builder call wins.- Parameters:
systemMessage- complete system message, blank for an empty exact system instruction, ornullto inherit the configured Freeplane system message- Returns:
- this builder
-
profile
Requests a saved assistant profile by name.The name is trimmed when
build()is called. The profile is looked up when the request starts; missing, blank, or ambiguous names complete the request with a configuration error.- Parameters:
name- saved profile name- Returns:
- this builder
-
profile
Requests an inline assistant profile instruction.This overload does not look up a saved profile. The name and message are trimmed when
build()is called. If the message is blank and the name is non-blank, Freeplane sends a profile marker for that name. If both are blank, no profile instruction is sent.- Parameters:
name- profile name to display in the instruction;nullis treated as blankmessage- inline profile instruction; must not benull- Returns:
- this builder
-
build
Builds immutable request options.- Returns:
- immutable options
- Throws:
NullPointerException- if timeout is unsetIllegalArgumentException- if timeout is zero or negative
-