Skip to main content

Module reference

Module reference 

Source
Expand description

Parsing a user-typed model reference — a bare id, a hf.co/... or ollama.com/... link — into a Hugging Face repo (org/name) or an Ollama tag (name:version). Pure string work; the ambiguity is resolved consistently so the CLI and gateway accept identical inputs.

Functions§

hugging_face_repo
The org/name repo a Hugging Face reference points at, or None if raw is not a plausible HF repo. A multi-segment path is only accepted from an explicit hf.co/huggingface.co link whose third segment is empty or a known HF subpath.
is_hugging_face_link
Whether raw is a Hugging Face URL.
is_ollama_link
Whether raw is an Ollama URL.
is_ollama_tag_shaped
Whether reference is a well-formed Ollama tag (an explicit version is required for a namespaced reference). Part of the parsing API the gateway/cli use to validate a typed tag, alongside the other reference entry points.
normalized
A reference normalized for provider: Ollama tags gain :latest and lowercase; other providers lowercase.
normalized_tag
A tag with :latest added when no version is present, lowercased.
ollama_direct_tag
The Ollama tag for a search query — only when it isn’t an HF repo and the input carries an explicit : or is an Ollama link (so a bare word doesn’t resolve to Ollama by default).
ollama_install_tag
The Ollama tag for an install, allowing a namespaced reference without an explicit version (it defaults to :latest downstream).
ollama_tag
The Ollama tag a reference points at, requiring an explicit :version for a namespaced (org/name) reference.