Documentation
¶
Index ¶
- func BuildModelFromPath(t *testing.T, path string) types.ModelArtifact
- func NewStaticLayer(content []byte, mediaType oci.MediaType) oci.Layer
- func WithLayersError(base types.ModelArtifact, err error) types.ModelArtifact
- func WithRawConfigError(base types.ModelArtifact, err error) types.ModelArtifact
- type Artifact
- func NewArtifact(rawConfig []byte, configMediaType oci.MediaType, layers ...oci.Layer) *Artifact
- func NewDockerArtifact(t *testing.T, cfg types.Config, layers ...LayerSpec) *Artifact
- func NewDockerArtifactWithConfigMediaType(t *testing.T, cfg types.Config, configMediaType oci.MediaType, ...) *Artifact
- func NewGGUFArtifact(t *testing.T, modelPath string, extraLayers ...LayerSpec) *Artifact
- func NewGGUFArtifactWithConfigMediaType(t *testing.T, modelPath string, configMediaType oci.MediaType, ...) *Artifact
- func NewModelPackArtifact(t *testing.T, model modelpack.Model, layers ...LayerSpec) *Artifact
- func NewSafetensorsArtifact(t *testing.T, modelPath string, extraLayers ...LayerSpec) *Artifact
- func (a *Artifact) Config() (types.ModelConfig, error)
- func (a *Artifact) ConfigFile() (*oci.ConfigFile, error)
- func (a *Artifact) ConfigName() (oci.Hash, error)
- func (a *Artifact) Descriptor() (types.Descriptor, error)
- func (a *Artifact) Digest() (oci.Hash, error)
- func (a *Artifact) GetConfigMediaType() oci.MediaType
- func (a *Artifact) ID() (string, error)
- func (a *Artifact) LayerByDiffID(hash oci.Hash) (oci.Layer, error)
- func (a *Artifact) LayerByDigest(hash oci.Hash) (oci.Layer, error)
- func (a *Artifact) Layers() ([]oci.Layer, error)
- func (a *Artifact) Manifest() (*oci.Manifest, error)
- func (a *Artifact) MediaType() (oci.MediaType, error)
- func (a *Artifact) RawConfigFile() ([]byte, error)
- func (a *Artifact) RawManifest() ([]byte, error)
- func (a *Artifact) Size() (int64, error)
- type LayerSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildModelFromPath ¶
func BuildModelFromPath(t *testing.T, path string) types.ModelArtifact
BuildModelFromPath constructs a model artifact from a file path and fails the test on error.
func NewStaticLayer ¶ added in v1.1.29
NewStaticLayer creates an in-memory layer for tests that do not need a backing file path.
func WithLayersError ¶ added in v1.1.29
func WithLayersError(base types.ModelArtifact, err error) types.ModelArtifact
WithLayersError returns a wrapper that fails when Layers is requested.
func WithRawConfigError ¶ added in v1.1.29
func WithRawConfigError(base types.ModelArtifact, err error) types.ModelArtifact
WithRawConfigError returns a wrapper that fails when RawConfigFile is requested.
Types ¶
type Artifact ¶ added in v1.1.29
type Artifact struct {
// contains filtered or unexported fields
}
Artifact is a generic, configurable OCI model artifact for testing. It accepts raw config bytes, a config media type, and an arbitrary set of layers, allowing tests to construct Docker model-spec, ModelPack, or any custom OCI artifact without re-implementing the ModelArtifact interface in every test file.
func NewArtifact ¶ added in v1.1.29
NewArtifact creates a new generic test artifact with the given raw config bytes, config media type, and layers.
func NewDockerArtifact ¶ added in v1.1.29
NewDockerArtifact creates a Docker-format test artifact with the default config media type.
func NewDockerArtifactWithConfigMediaType ¶ added in v1.1.29
func NewDockerArtifactWithConfigMediaType( t *testing.T, cfg types.Config, configMediaType oci.MediaType, layers ...LayerSpec, ) *Artifact
NewDockerArtifactWithConfigMediaType creates a Docker-format test artifact with the given config media type.
func NewGGUFArtifact ¶ added in v1.1.29
NewGGUFArtifact creates a Docker-format GGUF test artifact.
func NewGGUFArtifactWithConfigMediaType ¶ added in v1.1.29
func NewGGUFArtifactWithConfigMediaType( t *testing.T, modelPath string, configMediaType oci.MediaType, extraLayers ...LayerSpec, ) *Artifact
NewGGUFArtifactWithConfigMediaType creates a GGUF test artifact with a custom Docker config media type.
func NewModelPackArtifact ¶ added in v1.1.29
NewModelPackArtifact creates a ModelPack-format test artifact and populates ModelFS DiffIDs from the layers.
func NewSafetensorsArtifact ¶ added in v1.1.29
NewSafetensorsArtifact creates a Docker-format safetensors test artifact.
func (*Artifact) Config ¶ added in v1.1.29
func (a *Artifact) Config() (types.ModelConfig, error)
Config implements types.ModelArtifact.
func (*Artifact) ConfigFile ¶ added in v1.1.29
func (a *Artifact) ConfigFile() (*oci.ConfigFile, error)
ConfigFile implements oci.Image. Model artifacts do not have a standard OCI config file.
func (*Artifact) ConfigName ¶ added in v1.1.29
ConfigName implements oci.Image.
func (*Artifact) Descriptor ¶ added in v1.1.29
func (a *Artifact) Descriptor() (types.Descriptor, error)
Descriptor implements types.ModelArtifact.
func (*Artifact) GetConfigMediaType ¶ added in v1.1.29
GetConfigMediaType implements partial.WithConfigMediaType so that ManifestForLayers uses the correct config media type when building the OCI manifest.
func (*Artifact) LayerByDiffID ¶ added in v1.1.29
LayerByDiffID implements oci.Image.
func (*Artifact) LayerByDigest ¶ added in v1.1.29
LayerByDigest implements oci.Image.
func (*Artifact) RawConfigFile ¶ added in v1.1.29
RawConfigFile implements partial.WithRawConfigFile.
func (*Artifact) RawManifest ¶ added in v1.1.29
RawManifest implements oci.Image.