Learn R Programming

localLLM (version 1.2.1)

.with_hf_token: Temporarily apply an HF token for a scoped operation

Description

This helper sets the `HF_TOKEN` environment variable for the duration of a code block and restores the previous value afterwards.

Usage

.with_hf_token(token, expr)

Arguments

token

Character scalar or NULL. When NULL, the current token (if any) is used. When non-NULL, the environment variable is temporarily set to this value.

expr

Expression to evaluate within the temporary token context.