Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Ollama Ollama ParseNamedManifest

From Leeroopedia
Knowledge Sources
Domains Storage, Model_Management
Last Updated 2026-02-14 00:00 GMT

Overview

Concrete tool for reading and parsing model manifests from local storage and remote registries provided by the manifest and server packages.

Description

ParseNamedManifest reads a local manifest file by model name, parses the JSON content, and returns a Manifest struct with Config and Layers fields.

pullModelManifest fetches a manifest from the remote Ollama registry via authenticated HTTP GET.

PushModel orchestrates the push flow: reads local manifest, checks remote blob existence, uploads missing blobs, and pushes the manifest.

Usage

Called by push/pull operations and model management functions to determine model composition.

Code Reference

Source Location

  • Repository: ollama
  • File: manifest/manifest.go (ParseNamedManifest), server/images.go (pullModelManifest, PushModel)
  • Lines: manifest.go:L112-147 (ParseNamedManifest), images.go:L811-828 (pullModelManifest), images.go:L485-550 (PushModel)

Signature

func ParseNamedManifest(n model.Name) (*Manifest, error)
func pullModelManifest(ctx context.Context, n model.Name, regOpts *registryOptions) (*Manifest, error)
func PushModel(ctx context.Context, name string, regOpts *registryOptions, fn func(api.ProgressResponse)) error

Import

import "github.com/ollama/ollama/manifest"
import "github.com/ollama/ollama/server"

I/O Contract

Inputs (ParseNamedManifest)

Name Type Required Description
n model.Name Yes Fully qualified model name (host/namespace/model:tag)

Outputs (ParseNamedManifest)

Name Type Description
*Manifest *Manifest Parsed manifest with Config layer and content Layers list
error error Non-nil if manifest file not found or JSON invalid

Usage Examples

Reading a Local Manifest

import (
    "github.com/ollama/ollama/manifest"
    "github.com/ollama/ollama/model"
)

name := model.ParseName("llama3:latest")
m, err := manifest.ParseNamedManifest(name)
if err != nil {
    // model not found locally
}
// m.Layers contains all model components
for _, layer := range m.Layers {
    fmt.Printf("Layer: %s (%s, %d bytes)\n", layer.Digest, layer.MediaType, layer.Size)
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment