HuggingfaceClient.Inference.Config (huggingface_client v0.1.0)

Copy Markdown View Source

Runtime configuration for the inference layer.

Reads from Application env (set in config/*.exs) with sensible defaults. All URLs are overridable in tests via Application.put_env/3.

Summary

Functions

Returns a list of all known provider IDs.

Returns the base HuggingFace Hub URL.

Returns the direct API base URL for a given provider ID.

Returns the HuggingFace inference router URL.

Returns the User-Agent string sent with all inference requests.

Functions

all_providers()

@spec all_providers() :: [String.t()]

Returns a list of all known provider IDs.

hub_url()

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

Returns the base HuggingFace Hub URL.

Reads from :hf_hub_url application env (distinct from :hub_url used by Hub.Client and overridden in test config). Falls back to HF_ENDPOINT env var, then the hard-coded default.

provider_base_url(provider)

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

Returns the direct API base URL for a given provider ID.

Falls back to the router URL for unknown providers.

router_url()

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

Returns the HuggingFace inference router URL.

user_agent()

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

Returns the User-Agent string sent with all inference requests.