HfHub.Config (HfHub v0.3.1)

Copy Markdown View Source

Configuration utilities for HfHub.

Provides functions to access and manage configuration settings.

Summary

Functions

Gets the cache directory path from application configuration.

Gets cache options.

Gets the HuggingFace Hub endpoint URL.

Gets HTTP client options.

Functions

cache_dir()

@spec cache_dir() :: Path.t()

Gets the cache directory path from application configuration.

Per Elixir runtime-configuration best practices, this library no longer reads HF_HUB_CACHE or HF_HOME from the OS environment directly. Hosts wire env vars into Application.put_env(:hf_hub, :cache_dir, ...) from their config/runtime.exs. See the HfHub moduledoc for the recommended snippet.

Falls back to the default ~/.cache/huggingface if no app-env value is set.

Examples

cache_dir = HfHub.Config.cache_dir()
# => "/home/user/.cache/huggingface"

cache_opts()

@spec cache_opts() :: keyword()

Gets cache options.

Examples

opts = HfHub.Config.cache_opts()

endpoint()

@spec endpoint() :: String.t()

Gets the HuggingFace Hub endpoint URL.

Defaults to "https://huggingface.co".

Examples

endpoint = HfHub.Config.endpoint()
# => "https://huggingface.co"

http_opts()

@spec http_opts() :: keyword()

Gets HTTP client options.

Examples

opts = HfHub.Config.http_opts()