Class AIOrchestrator.Reconnector
- Enclosing class:
AIOrchestrator
AIOrchestrator after deserialization. Obtain an instance via
AIOrchestrator.reconnect(LLMProvider).
The provider is specified when the reconnector is created. Optional
transient dependencies (tools, controller, and file attachments) can be
restored via chained methods before calling apply(). The
apply() call replays the existing conversation history onto the
new provider but does not modify the UI.
orchestrator.reconnect(provider).withTools(toolObj) // optional
.withController(controller) // optional
.withAttachments(attachmentsByMsgId) // optional
.apply();
-
Method Summary
Modifier and TypeMethodDescriptionvoidapply()Applies the reconnection, restoring the provider, tools, and conversation history on the new provider.withAttachments(Map<String, List<AIAttachment>> attachmentsByMessageId) Sets the file attachments to restore on the new provider's conversation memory.withController(AIController controller) Sets the controller to use after reconnection.Sets the objects containing vendor-specific tool-annotated methods that will be available to the LLM.
-
Method Details
-
withTools
Sets the objects containing vendor-specific tool-annotated methods that will be available to the LLM.- Parameters:
tools- the objects containing tool methods- Returns:
- this reconnector
-
withController
Sets the controller to use after reconnection.- Parameters:
controller- the controller to use, notnull- Returns:
- this reconnector
- Throws:
IllegalArgumentException- if any tool name is invalid
-
withAttachments
public AIOrchestrator.Reconnector withAttachments(Map<String, List<AIAttachment>> attachmentsByMessageId) Sets the file attachments to restore on the new provider's conversation memory. The map is keyed byChatMessage.messageId()and contains the list ofAIAttachmentobjects for each message.Attachments are not stored in the orchestrator's conversation history. If the application persisted attachment data via
AttachmentSubmitListenerbefore serialization, pass it here so the new provider can reconstruct multimodal context. PassCollections.emptyMap()(the default) if there are no attachments to restore.The UI is not affected by this method; attachment thumbnails in the message list are preserved across serialization automatically.
- Parameters:
attachmentsByMessageId- a map from message ID to attachment list- Returns:
- this reconnector
-
apply
public void apply()Applies the reconnection, restoring the provider, tools, and conversation history on the new provider. The existing conversation history is replayed onto the new provider's memory so that it has full context for subsequent prompts.The UI (message list, input, file receiver) is not modified -- those components survive serialization and retain their state automatically.
-