modelforge 0.1.1

Model target parsing primitives for thesa archives
Documentation

ModelForge

ModelForge provides model-provider and model-target parsing primitives used by thesa.

The crate normalizes Hugging Face, Ollama, and CivitAI target forms into simple archive targets. It does not call provider APIs and it does not download models; it only turns user-facing target strings into stable Rust enums.

Install

[dependencies]
modelforge = "0.1"

Providers

assert_eq!(modelforge::ModelProvider::Hf.slug(), "hf");
assert_eq!(
    modelforge::ModelProvider::from_slug("hugging-face"),
    Some(modelforge::ModelProvider::Hf)
);

Supported providers:

  • ModelProvider::Hf: Hugging Face Hub
  • ModelProvider::Ollama: local Ollama registry/runtime
  • ModelProvider::Civitai: CivitAI model catalog

Targets

let target = modelforge::parse_model_target_for_provider(
    "https://huggingface.co/openai-community/gpt2",
    modelforge::ModelProvider::Hf,
)?;

assert_eq!(target.kind(), "model");
assert_eq!(target.value(), Some("openai-community/gpt2"));
# Ok::<(), modelforge::ModelForgeError>(())

Normalized targets:

  • ModelTarget::Org(String): namespace, organization, owner, or search keyword
  • ModelTarget::Model(String): concrete model id
  • ModelTarget::Top: top/trending/popular preset
  • ModelTarget::Latest: latest/newest/new preset

Accepted Forms

Hugging Face:

  • owner
  • owner/model
  • https://huggingface.co/owner/model
  • top, trending, popular
  • latest, newest, new

Ollama:

  • model-name or search keyword
  • top, trending, popular
  • latest, newest, new

CivitAI:

  • numeric model id, such as 827184
  • https://civitai.com/models/827184
  • search keyword
  • top, trending, popular
  • latest, newest, new

Design

ModelForge keeps parsing separate from provider API clients. Consumers such as thesa can use the normalized target enum to decide whether to fetch a single model, list a namespace, or run a provider-specific preset query.