HuggingfaceClient.Inference.ModelInfo (huggingface_client v0.1.0)

Copy Markdown View Source

Fetches model metadata and provider mapping information from the HuggingFace Hub.

Useful for tooling and diagnostics — e.g. listing which providers support a given model before making an inference call.

Example

{:ok, info} = HuggingfaceClient.Inference.ModelInfo.fetch("meta-llama/Llama-3.1-8B-Instruct",
  access_token: "hf_..."
)

IO.inspect(info.providers)
# => [%{"provider" => "groq", "task" => "conversational", "status" => "live"}, ...]

IO.puts(info.pipeline_tag)
# => "text-generation"

Summary

Functions

Returns the list of provider names that support a given model.

Fetches model metadata and provider mappings from the HF Hub.

Returns true if the model is available on the given provider.

Types

provider_entry()

@type provider_entry() :: %{required(String.t()) => String.t()}

t()

@type t() :: %HuggingfaceClient.Inference.ModelInfo{
  downloads: non_neg_integer() | nil,
  gated: boolean() | String.t(),
  id: String.t(),
  library_name: String.t() | nil,
  likes: non_neg_integer() | nil,
  pipeline_tag: String.t() | nil,
  private: boolean(),
  providers: [provider_entry()],
  tags: [String.t()]
}

Functions

available_providers(model_id, opts \\ [])

@spec available_providers(
  String.t(),
  keyword()
) :: {:ok, [String.t()]} | {:error, Exception.t()}

Returns the list of provider names that support a given model.

Only returns providers with status: "live".

fetch(model_id, opts \\ [])

@spec fetch(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, Exception.t()}

Fetches model metadata and provider mappings from the HF Hub.

Options

  • :access_token — HF token for private models
  • :hub_url — override the Hub base URL
  • :req_opts — extra options forwarded to Req

supported_by?(model_id, provider, opts \\ [])

@spec supported_by?(String.t(), String.t(), keyword()) ::
  {:ok, boolean()} | {:error, Exception.t()}

Returns true if the model is available on the given provider.