setup_llm_parallel: Setup Parallel Environment for LLM Processing

View source: R/LLM_parallel_utils.R

setup_llm_parallelR Documentation

Setup Parallel Environment for LLM Processing

Description

Convenience function to set up the future plan for optimal LLM parallel processing. Automatically detects system capabilities and sets appropriate defaults.

Usage

setup_llm_parallel(strategy = NULL, workers = NULL, verbose = FALSE)

Arguments

strategy

Character. The future strategy to use. Options: "multisession", "multicore", "sequential". If NULL (default), automatically chooses "multisession".

workers

Integer. Number of workers to use. If NULL, auto-detects optimal number (availableCores - 1, capped at 8).

verbose

Logical. If TRUE, prints setup information.

Value

Invisibly returns the previous future plan.

Examples

## Not run: 
  # Automatic setup
  old_plan <- setup_llm_parallel()

  # Manual setup with specific workers
  setup_llm_parallel(workers = 4, verbose = TRUE)

  # Force sequential processing for debugging
  setup_llm_parallel(strategy = "sequential")

  # Restore old plan if needed
  future::plan(old_plan)

## End(Not run)

LLMR documentation built on June 8, 2025, 10:45 a.m.