artifact

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegistry   = "localhost"
	DefaultRepository = "_"
)

Variables

This section is empty.

Functions

func DefaultReference added in v1.12.0

func DefaultReference() *registry.Reference

DefaultReference returns a reference that can be used when no reference is supplied. It uses the default registry and repository

func FormatRepositoryForDisplay added in v1.12.0

func FormatRepositoryForDisplay(repo string) string

FormatRepositoryForDisplay removes default values from a repository string to avoid surfacing defaulted fields when displaying references, which may be confusing.

func IsModelKitReference added in v1.12.0

func IsModelKitReference(ref string) bool

IsModelKitReference returns true if the ref string "looks" like a modelkit reference

func ParseReference added in v1.12.0

func ParseReference(refString string) (reference *registry.Reference, extraTags []string, err error)

ParseReference parses a reference string into a Reference struct. It attempts to make references conform to an expected structure, with a defined registry and repository by filling default values for registry and repository where appropriate. Where the first part of a reference doesn't look like a registry URL, the default registry is used, turning e.g. testorg/testrepo into localhost/testorg/testrepo. If refString does not contain a registry or a repository (i.e. is a base SHA256 hash), the returned reference uses placeholder values for registry and repository.

See FormatRepositoryForDisplay for removing default values from a registry for displaying to the user.

func ReferenceIsDigest added in v1.12.0

func ReferenceIsDigest(ref string) bool

ReferenceIsDigest returns if the reference is a digest. If false, reference should be treated as a tag

Types

type Code

type Code struct {
	Path        string `json:"path,omitempty" yaml:"path,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	License     string `json:"license,omitempty" yaml:"license,omitempty"`
	*LayerInfo  `json:",inline" yaml:",inline"`
}

type DataSet

type DataSet struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Path        string `json:"path,omitempty" yaml:"path,omitempty"`
	RemotePath  string `json:"remotePath,omitempty" yaml:"remotePath,omitempty"`
	RemoteHash  string `json:"remoteHash,omitempty" yaml:"remoteHash,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	License     string `json:"license,omitempty" yaml:"license,omitempty"`
	// Parameters is an arbitrary section of yaml that can be used to store any additional
	// metadata relevant to the dataset, with a few caveats:
	//  * Only a json-compatible subset of yaml is supported
	//  * Strings will be serialized without flow parameters, etc.
	//  * Numbers will be converted to decimal representations
	//  * Maps will be sorted alphabetically by key
	//  * It's recommended to store metadata like preprocessing steps, formats, etc.
	Parameters any `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	*LayerInfo `json:",inline" yaml:",inline"`
}

type Docs

type Docs struct {
	Path        string `json:"path" yaml:"path"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	*LayerInfo  `json:",inline" yaml:",inline"`
}

type KitFile

type KitFile struct {
	ManifestVersion string    `json:"manifestVersion" yaml:"manifestVersion"`
	Package         Package   `json:"package,omitempty" yaml:"package,omitempty"`
	Model           *Model    `json:"model,omitempty" yaml:"model,omitempty"`
	Code            []Code    `json:"code,omitempty" yaml:"code,omitempty"`
	DataSets        []DataSet `json:"datasets,omitempty" yaml:"datasets,omitempty"`
	Docs            []Docs    `json:"docs,omitempty" yaml:"docs,omitempty"`
	Prompts         []Prompt  `json:"prompts,omitempty" yaml:"prompts,omitempty"`
}

func (*KitFile) LoadModel

func (kf *KitFile) LoadModel(kitfileContent io.ReadCloser) (err error)

func (*KitFile) MarshalToJSON

func (kf *KitFile) MarshalToJSON() ([]byte, error)

func (*KitFile) MarshalToYAML

func (kf *KitFile) MarshalToYAML() ([]byte, error)

func (*KitFile) ToModelPackConfig added in v1.10.0

func (kf *KitFile) ToModelPackConfig(diffIDs []digest.Digest) modelspecv1.Model

func (*KitFile) Validate added in v1.12.0

func (kf *KitFile) Validate() (warnings []string, err error)

type LayerInfo

type LayerInfo struct {
	// Digest for the layer corresponding to this element
	Digest string `json:"digest,omitempty" yaml:"-"`
	// Diff ID (uncompressed digest) for the layer corresponding to this element
	DiffId string `json:"diffId,omitempty" yaml:"-"`
}

type Model

type Model struct {
	Name        string      `json:"name,omitempty" yaml:"name,omitempty"`
	Path        string      `json:"path,omitempty" yaml:"path,omitempty"`
	License     string      `json:"license,omitempty" yaml:"license,omitempty"`
	Framework   string      `json:"framework,omitempty" yaml:"framework,omitempty"`
	Format      string      `json:"format,omitempty" yaml:"format,omitempty"`
	Version     string      `json:"version,omitempty" yaml:"version,omitempty"`
	Description string      `json:"description,omitempty" yaml:"description,omitempty"`
	Parts       []ModelPart `json:"parts,omitempty" yaml:"parts,omitempty"`
	// Parameters is an arbitrary section of yaml that can be used to store any additional
	// data that may be relevant to the current model, with a few caveats:
	//  * Only a json-compatible subset of yaml is supported
	//  * Strings will be serialized without flow parameters, etc.
	//  * Numbers will be converted to decimal representations (0xFF -> 255, 1.2e+3 -> 1200)
	//  * Maps will be sorted alphabetically by key
	Parameters any `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	*LayerInfo `json:",inline" yaml:",inline"`
}

type ModelPart

type ModelPart struct {
	Name       string `json:"name,omitempty" yaml:"name,omitempty"`
	Path       string `json:"path,omitempty" yaml:"path,omitempty"`
	License    string `json:"license,omitempty" yaml:"license,omitempty"`
	Type       string `json:"type,omitempty" yaml:"type,omitempty"`
	*LayerInfo `json:",inline" yaml:",inline"`
}

type Package

type Package struct {
	Name        string   `json:"name,omitempty" yaml:"name,omitempty"`
	Version     string   `json:"version,omitempty" yaml:"version,omitempty"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
	License     string   `json:"license,omitempty" yaml:"license,omitempty"`
	Authors     []string `json:"authors,omitempty" yaml:"authors,omitempty,flow"`
}

type PathType added in v1.12.0

type PathType int

PathType represents different types of paths in Kitfile fields, e.g. local on-disk paths or remote S3 URLs.

const (
	UnknownPathType PathType = iota
	LocalPathType
	ModelReferencePathType
	S3PathType
)

func GetPathType added in v1.12.0

func GetPathType(path string) (PathType, error)

type Prompt added in v1.11.0

type Prompt struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Path        string `json:"path,omitempty" yaml:"path,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	*LayerInfo  `json:",inline" yaml:",inline"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL