Class PicoLLM.DialogBuilder

java.lang.Object
ai.picovoice.picollm.PicoLLM.DialogBuilder
Enclosing class:
PicoLLM

public class PicoLLM.DialogBuilder extends Object
Builder class for creating a `PicoLLMDialog` instance.
  • Constructor Details

    • DialogBuilder

      public DialogBuilder()
  • Method Details

    • setMode

      public PicoLLM.DialogBuilder setMode(String mode)
      Sets the mode for the dialog builder.
      Parameters:
      mode - The mode to set. Some models (e.g., `phi-2`) define multiple chat template modes. For example, `phi-2` allows both `qa` and `chat` modes.
      Returns:
      DialogBuilder instance.
    • setHistory

      public PicoLLM.DialogBuilder setHistory(int history)
      Sets the history length for the dialog builder.
      Parameters:
      history - The history length to set. History refers to the number of latest back-and-forths to include in the prompt. Setting history to `null` will embed the entire dialog in the prompt.
      Returns:
      DialogBuilder instance.
    • setSystem

      public PicoLLM.DialogBuilder setSystem(String system)
      Sets the system instruction for the dialog builder.
      Parameters:
      system - The system instruction to set. System instruction to embed in the prompt for configuring the model's responses.
      Returns:
      DialogBuilder instance.
    • build

      public PicoLLMDialog build() throws PicoLLMException
      Constructs a PicoLLMDialog instance based on the configured settings.
      Returns:
      A new instance of PicoLLMDialog.
      Throws:
      PicoLLMException - If there's an issue constructing the dialog.