Documentation
¶
Index ¶
- Constants
- type Capability
- type HFFileInfo
- type HuggingFaceModel
- func (hf *HuggingFaceModel) GetLocalFilename() string
- func (hf *HuggingFaceModel) IsValid() bool
- func (hf *HuggingFaceModel) ListGGUFFiles() ([]HFFileInfo, error)
- func (hf *HuggingFaceModel) ResolveFilename() error
- func (hf *HuggingFaceModel) String() string
- func (hf *HuggingFaceModel) ToAPIURL() string
- func (hf *HuggingFaceModel) ToDownloadURL() string
- func (hf *HuggingFaceModel) ToRepoURL() string
Constants ¶
const ( CapabilityCompletion = Capability("completion") CapabilityTools = Capability("tools") CapabilityInsert = Capability("insert") CapabilityVision = Capability("vision") CapabilityEmbedding = Capability("embedding") CapabilityThinking = Capability("thinking") )
const ( DefaultHFHost = "huggingface.co" DefaultHFBranch = "main" DefaultHFNamespace = "llamago" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
func (Capability) String ¶
func (c Capability) String() string
type HFFileInfo ¶
type HFFileInfo struct {
Path string `json:"path"`
Type string `json:"type"`
Size int64 `json:"size,omitempty"`
}
HFFileInfo represents a file in a Hugging Face repository
type HuggingFaceModel ¶
type HuggingFaceModel struct {
// Host is the Hugging Face host (default: huggingface.co)
Host string
// Namespace is the user or organization name (default: llamago)
Namespace string
// Repo is the repository name
Repo string
// Branch is the git branch or tag (default: main)
Branch string
// Filename is the specific file to download
// If empty, will be auto-detected
Filename string
// Pattern is used to filter files when Filename is not specified
// e.g., "Q4_K_M", "Q8_0", etc.
Pattern string
}
HuggingFaceModel represents a parsed Hugging Face model reference It supports multiple input formats: 1. Full URL: https://huggingface.co/namespace/repo/resolve/main/file.gguf 2. Repo with file: namespace/repo:file.gguf 3. Repo with pattern: namespace/repo:Q4_K_M (will search for matching files) 4. Simple repo: namespace/repo (will auto-detect GGUF files) 5. Repo only: repo (uses default namespace "llamago")
func ParseHuggingFaceModel ¶
func ParseHuggingFaceModel(s string) (*HuggingFaceModel, error)
ParseHuggingFaceModel parses a Hugging Face model reference string Supported formats:
- https://huggingface.co/namespace/repo/resolve/main/file.gguf
- namespace/repo:file.gguf
- namespace/repo:Q4_K_M
- namespace/repo
- repo (uses default namespace: llamago)
func (*HuggingFaceModel) GetLocalFilename ¶
func (hf *HuggingFaceModel) GetLocalFilename() string
GetLocalFilename returns the filename to use when saving locally
func (*HuggingFaceModel) IsValid ¶
func (hf *HuggingFaceModel) IsValid() bool
IsValid checks if the model reference is valid
func (*HuggingFaceModel) ListGGUFFiles ¶
func (hf *HuggingFaceModel) ListGGUFFiles() ([]HFFileInfo, error)
ListGGUFFiles fetches the list of GGUF files from the repository
func (*HuggingFaceModel) ResolveFilename ¶
func (hf *HuggingFaceModel) ResolveFilename() error
ResolveFilename attempts to determine the best matching GGUF file based on the pattern or automatically selects one if no pattern is given
func (*HuggingFaceModel) String ¶
func (hf *HuggingFaceModel) String() string
String returns a string representation of the model
func (*HuggingFaceModel) ToAPIURL ¶
func (hf *HuggingFaceModel) ToAPIURL() string
ToAPIURL returns the Hugging Face API URL for listing files
func (*HuggingFaceModel) ToDownloadURL ¶
func (hf *HuggingFaceModel) ToDownloadURL() string
ToDownloadURL returns the full download URL for this model
func (*HuggingFaceModel) ToRepoURL ¶
func (hf *HuggingFaceModel) ToRepoURL() string
ToRepoURL returns the URL to the repository