forCpuOnly method

OllamaBuilder forCpuOnly({
  1. int? threads,
})

Configure for CPU-only inference

Optimized for systems without GPU or when GPU usage should be avoided.

Implementation

OllamaBuilder forCpuOnly({int? threads}) {
  final builder = numGpu(0)
      .numBatch(64) // Smaller batch for CPU
      .keepAlive("15m");

  if (threads != null) {
    builder.numThread(threads);
  }

  return builder;
}