HuggingfaceClient.HardcodedMappings (huggingface_client v0.1.0)

Copy Markdown View Source

Agent-backed store for runtime dev overrides of provider/model mappings.

Useful in tests or local development to pin specific model→provider mappings without hitting the Hub API. Keyed by {provider, hf_model_id}.

Example

HuggingfaceClient.HardcodedMappings.add("groq", "meta-llama/Llama-3-8B", %{
  "provider"    => "groq",
  "hf_model_id" => "meta-llama/Llama-3-8B",
  "provider_id" => "llama-3-8b",
  "status"      => "live",
  "task"        => "conversational"
})

mapping = HuggingfaceClient.HardcodedMappings.get("groq", "meta-llama/Llama-3-8B")

Summary

Functions

Adds or replaces a mapping for {provider, model_id}. Last write wins.

Returns a specification to start this module under a supervisor.

Returns the mapping for {provider, model_id}, or nil if not present.

Removes the mapping for {provider, model_id}. No-op if not present.

Clears all runtime additions.

Functions

add(provider, model_id, mapping)

@spec add(String.t(), String.t(), map()) :: :ok

Adds or replaces a mapping for {provider, model_id}. Last write wins.

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(provider, model_id)

@spec get(String.t(), String.t()) :: map() | nil

Returns the mapping for {provider, model_id}, or nil if not present.

remove(provider, model_id)

@spec remove(String.t(), String.t()) :: :ok

Removes the mapping for {provider, model_id}. No-op if not present.

reset()

@spec reset() :: :ok

Clears all runtime additions.