Class EmbeddedAssistantBuilder

java.lang.Object
com.inductiveautomation.ignition.designer.ai.EmbeddedAssistantBuilder

public final class EmbeddedAssistantBuilder extends Object
Fluent builder for mounting an embedded "Ask AI" assistant, collapsing the steps every host otherwise repeats: gating on readiness, assembling the EmbedHost, and unwrapping the result into the surface the host wants — an inline AssistSession, the shared AssistAction, or a ready-to-mount AssistButton/AssistToolbarButton.

Obtained through DesignerAiContext.assistant(). Configure it in a map from DesignerContext.getAiContext() and run the terminal as a flatMap method reference, so the absent-module case folds into the same empty result every terminal returns when AI is not ready or no provider/model is configured — the host keeps a single fallback branch.

Drop an icon-only button on a text editor's toolbar:

context.getAiContext()
    .map(ai -> ai.assistant()
        .agent(() -> createAgent(ai))
        .host(EmbedHost.forTextEditorWithInsert(TextlikeComponent.of(editor)))
        .promptAssists(ai.promptAssists().tags()))
    .flatMap(EmbeddedAssistantBuilder::toolbarButton)
    .ifPresent(button -> toolbar.add(button, 0));

Or mount an inline session inside a panel, extracting a configure helper when the wiring is long:

assistSession = context.getAiContext()
    .map(this::configureAssistant)
    .flatMap(EmbeddedAssistantBuilder::inline)
    .orElse(null);

private EmbeddedAssistantBuilder configureAssistant(DesignerAiContext ai) {
  return ai.assistant()
      .agent(() -> new InstanceWizardAgent(ai.tools()))
      .host(host -> host
          .composer(composer)
          .rendererFactory(rendererFactory))
      .promptAssists(new UdtPromptAssist(context));
}