Package ai.picovoice.picollm
Class PicoLLM.Builder
- java.lang.Object
-
- ai.picovoice.picollm.PicoLLM.Builder
-
- Enclosing class:
- PicoLLM
public static class PicoLLM.Builder extends java.lang.ObjectBuilder class for creating a `PicoLLM` instance.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PicoLLMbuild()Builds a new PicoLLM instance using values defined by the builder.PicoLLM.BuildersetAccessKey(java.lang.String accessKey)Sets the AccessKey.PicoLLM.BuildersetDevice(java.lang.String device)Sets the device to use for inference.PicoLLM.BuildersetModelPath(java.lang.String modelPath)Sets the model path.
-
-
-
Method Detail
-
setAccessKey
public PicoLLM.Builder setAccessKey(java.lang.String accessKey)
Sets the AccessKey.- Parameters:
accessKey- AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)- Returns:
- Builder instance.
-
setModelPath
public PicoLLM.Builder setModelPath(java.lang.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(java.lang.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.
-
-