Class PicoLLM.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • setAccessKey

      public PicoLLM.Builder setAccessKey(String accessKey)
      Sets the AccessKey.
      Parameters:
      accessKey - AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
      Returns:
      Builder instance.
    • setModelPath

      public PicoLLM.Builder setModelPath(String modelPath)
      Sets the model path.
      Parameters:
      modelPath - Absolute path to the file containing LLM parameters (`.pllm`).
      Returns:
      Builder instance.
    • setDevice

      public PicoLLM.Builder setDevice(String device)
      Sets the device to use for inference.
      Parameters:
      device - String representation of the device (e.g., CPU or GPU) to use for inference. If set to `best`, picoLLM picks the most suitable device. If set to `gpu`, the engine uses the first available GPU device. To select a specific GPU device, set this argument to `gpu:${GPU_INDEX}`, where `${GPU_INDEX}` is the index of the target GPU. If set to `cpu`, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}` is the desired number of threads.
      Returns:
      Builder instance.
    • build

      public PicoLLM build() throws PicoLLMException
      Builds a new PicoLLM instance using values defined by the builder.
      Returns:
      Constructed PicoLLM instance.
      Throws:
      PicoLLMException - if initialization fails.